blob: b9814829e1a6e354d9518a8ecdf531f14b6959bd [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 Wieczorek76dd9bf2019-09-26 16:43:01 +02009}
10
11// Command represents commands run on cluster.
12type Command int
13
14const (
15 // APIProcess represents API server command ("kube-apiserver").
16 APIProcess Command = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020017 // SchedulerProcess represents scheduler command ("kube-scheduler").
18 SchedulerProcess
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020019)
20
21func (c Command) String() string {
22 names := [...]string{
23 "kube-apiserver",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020024 "kube-scheduler",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020025 }
26
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020027 if c < APIProcess || c > SchedulerProcess {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020028 return "exit"
29 }
30 return names[c]
31}
32
33// Service represents services run on Rancher-based cluster.
34type Service int
35
36const (
37 // APIService represents API server service ("kubernetes/kubernetes").
38 APIService Service = iota
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020039 // SchedulerService represents scheduler service ("kubernetes/scheduler").
40 SchedulerService
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020041)
42
43func (s Service) String() string {
44 names := [...]string{
45 "kubernetes/kubernetes",
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020046 "kubernetes/scheduler",
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020047 }
48
Pawel Wieczorek96f4e2f2019-09-27 16:10:33 +020049 if s < APIService || s > SchedulerService {
Pawel Wieczorek76dd9bf2019-09-26 16:43:01 +020050 return ""
51 }
52 return names[s]
53}