Issue-ID: SECCOM-235
Change-Id: I7da645737440172d3cf11f33069daa2697f83056
Signed-off-by: Pawel Wieczorek <p.wieczorek2@samsung.com>
type Informer interface {
// GetAPIParams returns API server parameters.
GetAPIParams() ([]string, error)
type Informer interface {
// GetAPIParams returns API server parameters.
GetAPIParams() ([]string, error)
+ // GetSchedulerParams returns scheduler parameters.
+ GetSchedulerParams() ([]string, error)
}
// Command represents commands run on cluster.
}
// Command represents commands run on cluster.
const (
// APIProcess represents API server command ("kube-apiserver").
APIProcess Command = iota
const (
// APIProcess represents API server command ("kube-apiserver").
APIProcess Command = iota
+ // SchedulerProcess represents scheduler command ("kube-scheduler").
+ SchedulerProcess
)
func (c Command) String() string {
names := [...]string{
"kube-apiserver",
)
func (c Command) String() string {
names := [...]string{
"kube-apiserver",
- if c < APIProcess || c > APIProcess {
+ if c < APIProcess || c > SchedulerProcess {
return "exit"
}
return names[c]
return "exit"
}
return names[c]
const (
// APIService represents API server service ("kubernetes/kubernetes").
APIService Service = iota
const (
// APIService represents API server service ("kubernetes/kubernetes").
APIService Service = iota
+ // SchedulerService represents scheduler service ("kubernetes/scheduler").
+ SchedulerService
)
func (s Service) String() string {
names := [...]string{
"kubernetes/kubernetes",
)
func (s Service) String() string {
names := [...]string{
"kubernetes/kubernetes",
+ "kubernetes/scheduler",
- if s < APIService || s > APIService {
+ if s < APIService || s > SchedulerService {
return ""
}
return names[s]
return ""
}
return names[s]
log.Fatal(err)
}
master.CheckAPI(apiParams)
log.Fatal(err)
}
master.CheckAPI(apiParams)
+
+ _, err = info.GetSchedulerParams()
+ if err != nil {
+ log.Fatal(err)
+ }
return getProcessParams(check.APIProcess, check.APIService)
}
return getProcessParams(check.APIProcess, check.APIService)
}
+// GetSchedulerParams returns parameters of running Kubernetes scheduler.
+// It queries default environment set in configuration file.
+func (r *Rancher) GetSchedulerParams() ([]string, error) {
+ return getProcessParams(check.SchedulerProcess, check.SchedulerService)
+}
+
func getProcessParams(process check.Command, service check.Service) ([]string, error) {
hosts, err := listHosts()
if err != nil {
func getProcessParams(process check.Command, service check.Service) ([]string, error) {
hosts, err := listHosts()
if err != nil {
return getProcessParams(check.APIProcess)
}
return getProcessParams(check.APIProcess)
}
+// GetSchedulerParams returns parameters of running Kubernetes scheduler.
+// It queries only cluster nodes with "controlplane" role.
+func (r *Raw) GetSchedulerParams() ([]string, error) {
+ return getProcessParams(check.SchedulerProcess)
+}
+
func getProcessParams(process check.Command) ([]string, error) {
nodes, err := config.GetNodesInfo()
if err != nil {
func getProcessParams(process check.Command) ([]string, error) {
nodes, err := config.GetNodesInfo()
if err != nil {