blob: cf412c112fa7ab8854c0dbd2a1beb4dc3dda9a4c [file] [log] [blame]
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +02001package check
2
3// Informer collects and returns information on cluster.
4type Informer interface {
5 // GetAPIParams returns API server parameters.
6 GetAPIParams() ([]string, error)
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +02007 // GetSchedulerParams returns scheduler parameters.
8 GetSchedulerParams() ([]string, error)
Pawel Wieczorek5a61d612019-09-27 18:26:13 +02009 // GetControllerManagerParams returns controller manager parameters.
10 GetControllerManagerParams() ([]string, error)
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020011}
12
13// Command represents commands run on cluster.
14type Command int
15
16const (
17 // APIProcess represents API server command ("kube-apiserver").
18 APIProcess Command = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020019 // SchedulerProcess represents scheduler command ("kube-scheduler").
20 SchedulerProcess
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020021 // ControllerManagerProcess represents controller manager command ("kube-controller-manager").
22 ControllerManagerProcess
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020023)
24
25func (c Command) String() string {
26 names := [...]string{
27 "kube-apiserver",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020028 "kube-scheduler",
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020029 "kube-controller-manager",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020030 }
31
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020032 if c < APIProcess || c > ControllerManagerProcess {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020033 return "exit"
34 }
35 return names[c]
36}
37
38// Service represents services run on Rancher-based cluster.
39type Service int
40
41const (
42 // APIService represents API server service ("kubernetes/kubernetes").
43 APIService Service = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020044 // SchedulerService represents scheduler service ("kubernetes/scheduler").
45 SchedulerService
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020046 // ControllerManagerService represents controller manager service ("kubernetes/controller-manager").
47 ControllerManagerService
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020048)
49
50func (s Service) String() string {
51 names := [...]string{
52 "kubernetes/kubernetes",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020053 "kubernetes/scheduler",
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020054 "kubernetes/controller-manager",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020055 }
56
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020057 if s < APIService || s > ControllerManagerService {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020058 return ""
59 }
60 return names[s]
61}