Pawel Wieczorek | 76dd9bf | 2019-09-26 16:43:01 +0200 | [diff] [blame] | 1 | package check |
| 2 | |
| 3 | // Informer collects and returns information on cluster. |
| 4 | type Informer interface { |
| 5 | // GetAPIParams returns API server parameters. |
| 6 | GetAPIParams() ([]string, error) |
Pawel Wieczorek | 96f4e2f | 2019-09-27 16:10:33 +0200 | [diff] [blame] | 7 | // GetSchedulerParams returns scheduler parameters. |
| 8 | GetSchedulerParams() ([]string, error) |
Pawel Wieczorek | 5a61d61 | 2019-09-27 18:26:13 +0200 | [diff] [blame] | 9 | // GetControllerManagerParams returns controller manager parameters. |
| 10 | GetControllerManagerParams() ([]string, error) |
Pawel Wieczorek | f649f22 | 2019-10-07 17:00:49 +0200 | [diff] [blame] | 11 | // GetEtcdParams returns etcd parameters. |
| 12 | GetEtcdParams() ([]string, error) |
Pawel Wieczorek | 76dd9bf | 2019-09-26 16:43:01 +0200 | [diff] [blame] | 13 | } |
| 14 | |
| 15 | // Command represents commands run on cluster. |
| 16 | type Command int |
| 17 | |
| 18 | const ( |
| 19 | // APIProcess represents API server command ("kube-apiserver"). |
| 20 | APIProcess Command = iota |
Pawel Wieczorek | 96f4e2f | 2019-09-27 16:10:33 +0200 | [diff] [blame] | 21 | // SchedulerProcess represents scheduler command ("kube-scheduler"). |
| 22 | SchedulerProcess |
Pawel Wieczorek | 5a61d61 | 2019-09-27 18:26:13 +0200 | [diff] [blame] | 23 | // ControllerManagerProcess represents controller manager command ("kube-controller-manager"). |
| 24 | ControllerManagerProcess |
Pawel Wieczorek | f649f22 | 2019-10-07 17:00:49 +0200 | [diff] [blame] | 25 | // EtcdProcess represents controller manager service ("etcd"). |
| 26 | EtcdProcess |
Pawel Wieczorek | 76dd9bf | 2019-09-26 16:43:01 +0200 | [diff] [blame] | 27 | ) |
| 28 | |
| 29 | func (c Command) String() string { |
| 30 | names := [...]string{ |
| 31 | "kube-apiserver", |
Pawel Wieczorek | 96f4e2f | 2019-09-27 16:10:33 +0200 | [diff] [blame] | 32 | "kube-scheduler", |
Pawel Wieczorek | 5a61d61 | 2019-09-27 18:26:13 +0200 | [diff] [blame] | 33 | "kube-controller-manager", |
Pawel Wieczorek | f649f22 | 2019-10-07 17:00:49 +0200 | [diff] [blame] | 34 | "etcd", |
Pawel Wieczorek | 76dd9bf | 2019-09-26 16:43:01 +0200 | [diff] [blame] | 35 | } |
| 36 | |
Pawel Wieczorek | f649f22 | 2019-10-07 17:00:49 +0200 | [diff] [blame] | 37 | if c < APIProcess || c > EtcdProcess { |
Pawel Wieczorek | 76dd9bf | 2019-09-26 16:43:01 +0200 | [diff] [blame] | 38 | return "exit" |
| 39 | } |
| 40 | return names[c] |
| 41 | } |