diff --git a/api/v1/checks.go b/api/v1/checks.go index 1a169b1ff..25f760f7c 100644 --- a/api/v1/checks.go +++ b/api/v1/checks.go @@ -498,6 +498,7 @@ type PodCheck struct { ExpectedContent string `yaml:"expectedContent,omitempty" json:"expectedContent,omitempty" template:"true"` ExpectedHTTPStatuses []int `yaml:"expectedHttpStatuses,omitempty" json:"expectedHttpStatuses,omitempty"` PriorityClass string `yaml:"priorityClass,omitempty" json:"priorityClass,omitempty"` + RoundRobinNodes bool `yaml:"roundRobinNodes,omitempty" json:"roundRobinNodes,omitempty"` } func (c PodCheck) GetEndpoint() string { diff --git a/checks/pod.go b/checks/pod.go index e5fb350f7..1cae25dea 100644 --- a/checks/pod.go +++ b/checks/pod.go @@ -19,9 +19,11 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" canaryv1 "github.com/flanksource/canary-checker/api/v1" + "github.com/flanksource/canary-checker/pkg" "github.com/flanksource/canary-checker/pkg/metrics" "github.com/flanksource/commons/logger" + perrors "github.com/pkg/errors" v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" @@ -89,9 +91,13 @@ func (c *PodChecker) newPod(podCheck canaryv1.PodCheck, nodeName string) (*v1.Po pod.Labels[nameLabel] = pod.Name pod.Labels[podCheckSelector] = c.podCheckSelectorValue(podCheck) pod.Labels[podGeneralSelector] = "true" - pod.Spec.NodeSelector = map[string]string{ - "kubernetes.io/hostname": nodeName, + + if podCheck.RoundRobinNodes { + pod.Spec.NodeSelector = map[string]string{ + "kubernetes.io/hostname": nodeName, + } } + if podCheck.PriorityClass != "" { pod.Spec.PriorityClassName = podCheck.PriorityClass } diff --git a/config/deploy/crd.yaml b/config/deploy/crd.yaml index aeea2bf6f..332f432b6 100644 --- a/config/deploy/crd.yaml +++ b/config/deploy/crd.yaml @@ -4473,6 +4473,8 @@ spec: readyTimeout: format: int64 type: integer + roundRobinNodes: + type: boolean scheduleTimeout: format: int64 type: integer diff --git a/config/deploy/manifests.yaml b/config/deploy/manifests.yaml index 09550dacc..2495c7c27 100644 --- a/config/deploy/manifests.yaml +++ b/config/deploy/manifests.yaml @@ -4473,6 +4473,8 @@ spec: readyTimeout: format: int64 type: integer + roundRobinNodes: + type: boolean scheduleTimeout: format: int64 type: integer diff --git a/config/schemas/canary.schema.json b/config/schemas/canary.schema.json index e6c19d84e..60d1fe306 100644 --- a/config/schemas/canary.schema.json +++ b/config/schemas/canary.schema.json @@ -2611,6 +2611,9 @@ }, "priorityClass": { "type": "string" + }, + "roundRobinNodes": { + "type": "boolean" } }, "additionalProperties": false, diff --git a/config/schemas/component.schema.json b/config/schemas/component.schema.json index 030db15e6..6cbf37fe7 100644 --- a/config/schemas/component.schema.json +++ b/config/schemas/component.schema.json @@ -2873,6 +2873,9 @@ }, "priorityClass": { "type": "string" + }, + "roundRobinNodes": { + "type": "boolean" } }, "additionalProperties": false, diff --git a/config/schemas/health_pod.schema.json b/config/schemas/health_pod.schema.json index 9164c4929..9677280f2 100644 --- a/config/schemas/health_pod.schema.json +++ b/config/schemas/health_pod.schema.json @@ -129,6 +129,9 @@ }, "priorityClass": { "type": "string" + }, + "roundRobinNodes": { + "type": "boolean" } }, "additionalProperties": false, diff --git a/config/schemas/topology.schema.json b/config/schemas/topology.schema.json index 5ad8096ae..db9746e6b 100644 --- a/config/schemas/topology.schema.json +++ b/config/schemas/topology.schema.json @@ -2843,6 +2843,9 @@ }, "priorityClass": { "type": "string" + }, + "roundRobinNodes": { + "type": "boolean" } }, "additionalProperties": false,