blob: 728be18ffdc2306ad71c4c298d94c0761ceaafd0 [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 Wieczorekf649f222019-10-07 17:00:49 +020011 // GetEtcdParams returns etcd parameters.
12 GetEtcdParams() ([]string, error)
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020013}
14
15// Command represents commands run on cluster.
16type Command int
17
18const (
19 // APIProcess represents API server command ("kube-apiserver").
20 APIProcess Command = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020021 // SchedulerProcess represents scheduler command ("kube-scheduler").
22 SchedulerProcess
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020023 // ControllerManagerProcess represents controller manager command ("kube-controller-manager").
24 ControllerManagerProcess
Pawel Wieczorekf649f222019-10-07 17:00:49 +020025 // EtcdProcess represents controller manager service ("etcd").
26 EtcdProcess
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020027)
28
29func (c Command) String() string {
30 names := [...]string{
31 "kube-apiserver",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020032 "kube-scheduler",
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020033 "kube-controller-manager",
Pawel Wieczorekf649f222019-10-07 17:00:49 +020034 "etcd",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020035 }
36
Pawel Wieczorekf649f222019-10-07 17:00:49 +020037 if c < APIProcess || c > EtcdProcess {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020038 return "exit"
39 }
40 return names[c]
41}
42
43// Service represents services run on Rancher-based cluster.
44type Service int
45
46const (
47 // APIService represents API server service ("kubernetes/kubernetes").
48 APIService Service = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020049 // SchedulerService represents scheduler service ("kubernetes/scheduler").
50 SchedulerService
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020051 // ControllerManagerService represents controller manager service ("kubernetes/controller-manager").
52 ControllerManagerService
Pawel Wieczorekf649f222019-10-07 17:00:49 +020053 // EtcdService represents etcd service ("kubernetes/etcd").
54 EtcdService
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020055)
56
57func (s Service) String() string {
58 names := [...]string{
59 "kubernetes/kubernetes",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020060 "kubernetes/scheduler",
Pawel Wieczorek5a61d612019-09-27 18:26:13 +020061 "kubernetes/controller-manager",
Pawel Wieczorekf649f222019-10-07 17:00:49 +020062 "kubernetes/etcd",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020063 }
64
Pawel Wieczorekf649f222019-10-07 17:00:49 +020065 if s < APIService || s > EtcdService {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020066 return ""
67 }
68 return names[s]
69}