diff --git a/helm/agents/argo-rollouts/templates/_helpers.tpl b/helm/agents/argo-rollouts/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/argo-rollouts/templates/_helpers.tpl +++ b/helm/agents/argo-rollouts/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/argo-rollouts/values.yaml b/helm/agents/argo-rollouts/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/argo-rollouts/values.yaml +++ b/helm/agents/argo-rollouts/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/cilium-debug/templates/_helpers.tpl b/helm/agents/cilium-debug/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/cilium-debug/templates/_helpers.tpl +++ b/helm/agents/cilium-debug/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/cilium-debug/values.yaml b/helm/agents/cilium-debug/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/cilium-debug/values.yaml +++ b/helm/agents/cilium-debug/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/cilium-manager/templates/_helpers.tpl b/helm/agents/cilium-manager/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/cilium-manager/templates/_helpers.tpl +++ b/helm/agents/cilium-manager/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/cilium-manager/values.yaml b/helm/agents/cilium-manager/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/cilium-manager/values.yaml +++ b/helm/agents/cilium-manager/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/cilium-policy/templates/_helpers.tpl b/helm/agents/cilium-policy/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/cilium-policy/templates/_helpers.tpl +++ b/helm/agents/cilium-policy/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/cilium-policy/values.yaml b/helm/agents/cilium-policy/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/cilium-policy/values.yaml +++ b/helm/agents/cilium-policy/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/helm/templates/_helpers.tpl b/helm/agents/helm/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/helm/templates/_helpers.tpl +++ b/helm/agents/helm/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/helm/values.yaml b/helm/agents/helm/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/helm/values.yaml +++ b/helm/agents/helm/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/istio/templates/_helpers.tpl b/helm/agents/istio/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/istio/templates/_helpers.tpl +++ b/helm/agents/istio/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/istio/values.yaml b/helm/agents/istio/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/istio/values.yaml +++ b/helm/agents/istio/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/k8s/templates/_helpers.tpl b/helm/agents/k8s/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/k8s/templates/_helpers.tpl +++ b/helm/agents/k8s/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/k8s/values.yaml b/helm/agents/k8s/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/k8s/values.yaml +++ b/helm/agents/k8s/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/kgateway/templates/_helpers.tpl b/helm/agents/kgateway/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/kgateway/templates/_helpers.tpl +++ b/helm/agents/kgateway/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/kgateway/values.yaml b/helm/agents/kgateway/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/kgateway/values.yaml +++ b/helm/agents/kgateway/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/agents/observability/templates/_helpers.tpl b/helm/agents/observability/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/observability/templates/_helpers.tpl +++ b/helm/agents/observability/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/observability/values.yaml b/helm/agents/observability/values.yaml index 88456ab347..6524dac5ac 100644 --- a/helm/agents/observability/values.yaml +++ b/helm/agents/observability/values.yaml @@ -26,6 +26,9 @@ podSecurityContext: {} securityContext: {} +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} + # -- Optional Grafana datasource name for Prometheus (e.g. "Prometheus"). When set, the agent # uses this datasource name for all Prometheus queries instead of discovering it at runtime. grafana: diff --git a/helm/agents/promql/templates/_helpers.tpl b/helm/agents/promql/templates/_helpers.tpl index 683d0a2303..bdca15ce70 100644 --- a/helm/agents/promql/templates/_helpers.tpl +++ b/helm/agents/promql/templates/_helpers.tpl @@ -11,6 +11,10 @@ podSecurityContext: securityContext: {{- toYaml . | nindent 2 }} {{- end }} +{{- with .Values.nodeSelector }} +nodeSelector: + {{- toYaml . | nindent 2 }} +{{- end }} resources: {{- toYaml .Values.resources | nindent 2 }} {{- end }} diff --git a/helm/agents/promql/values.yaml b/helm/agents/promql/values.yaml index 560178fb77..bce4a7ae94 100644 --- a/helm/agents/promql/values.yaml +++ b/helm/agents/promql/values.yaml @@ -25,3 +25,6 @@ compaction: {} podSecurityContext: {} securityContext: {} + +# -- Optional nodeSelector to constrain the agent pods to nodes with matching labels. +nodeSelector: {} diff --git a/helm/kagent/tests/agent-nodeselector_test.yaml b/helm/kagent/tests/agent-nodeselector_test.yaml new file mode 100644 index 0000000000..1bc5144d93 --- /dev/null +++ b/helm/kagent/tests/agent-nodeselector_test.yaml @@ -0,0 +1,228 @@ +suite: test agent nodeSelector configuration +# The agent charts under helm/agents/* are subcharts of the kagent chart and rely +# on parent-chart helpers (kagent.namespace, kagent.labels, ...), so their templates +# are exercised here via the parent chart rather than standalone. Each agent renders +# the shared "agent.deploymentSpec" helper, which emits +# spec.declarative.deployment.nodeSelector only when the subchart's +# .Values.nodeSelector is set. +templates: + - charts/argo-rollouts-agent/templates/agent.yaml + - charts/cilium-debug-agent/templates/agent.yaml + - charts/cilium-manager-agent/templates/agent.yaml + - charts/cilium-policy-agent/templates/agent.yaml + - charts/helm-agent/templates/agent.yaml + - charts/istio-agent/templates/agent.yaml + - charts/k8s-agent/templates/agent.yaml + - charts/kgateway-agent/templates/agent.yaml + - charts/observability-agent/templates/agent.yaml + - charts/promql-agent/templates/agent.yaml +tests: + # ============================================================================= + # argo-rollouts-agent + # ============================================================================= + - it: should not set nodeSelector by default for argo-rollouts-agent + template: charts/argo-rollouts-agent/templates/agent.yaml + set: + argo-rollouts-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for argo-rollouts-agent + template: charts/argo-rollouts-agent/templates/agent.yaml + set: + argo-rollouts-agent.enabled: true + argo-rollouts-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # cilium-debug-agent + # ============================================================================= + - it: should not set nodeSelector by default for cilium-debug-agent + template: charts/cilium-debug-agent/templates/agent.yaml + set: + cilium-debug-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for cilium-debug-agent + template: charts/cilium-debug-agent/templates/agent.yaml + set: + cilium-debug-agent.enabled: true + cilium-debug-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # cilium-manager-agent + # ============================================================================= + - it: should not set nodeSelector by default for cilium-manager-agent + template: charts/cilium-manager-agent/templates/agent.yaml + set: + cilium-manager-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for cilium-manager-agent + template: charts/cilium-manager-agent/templates/agent.yaml + set: + cilium-manager-agent.enabled: true + cilium-manager-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # cilium-policy-agent + # ============================================================================= + - it: should not set nodeSelector by default for cilium-policy-agent + template: charts/cilium-policy-agent/templates/agent.yaml + set: + cilium-policy-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for cilium-policy-agent + template: charts/cilium-policy-agent/templates/agent.yaml + set: + cilium-policy-agent.enabled: true + cilium-policy-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # helm-agent + # ============================================================================= + - it: should not set nodeSelector by default for helm-agent + template: charts/helm-agent/templates/agent.yaml + set: + helm-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for helm-agent + template: charts/helm-agent/templates/agent.yaml + set: + helm-agent.enabled: true + helm-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # istio-agent + # ============================================================================= + - it: should not set nodeSelector by default for istio-agent + template: charts/istio-agent/templates/agent.yaml + set: + istio-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for istio-agent + template: charts/istio-agent/templates/agent.yaml + set: + istio-agent.enabled: true + istio-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # k8s-agent + # ============================================================================= + - it: should not set nodeSelector by default for k8s-agent + template: charts/k8s-agent/templates/agent.yaml + set: + k8s-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for k8s-agent + template: charts/k8s-agent/templates/agent.yaml + set: + k8s-agent.enabled: true + k8s-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # kgateway-agent + # ============================================================================= + - it: should not set nodeSelector by default for kgateway-agent + template: charts/kgateway-agent/templates/agent.yaml + set: + kgateway-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for kgateway-agent + template: charts/kgateway-agent/templates/agent.yaml + set: + kgateway-agent.enabled: true + kgateway-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # observability-agent + # ============================================================================= + - it: should not set nodeSelector by default for observability-agent + template: charts/observability-agent/templates/agent.yaml + set: + observability-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for observability-agent + template: charts/observability-agent/templates/agent.yaml + set: + observability-agent.enabled: true + observability-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd + + # ============================================================================= + # promql-agent + # ============================================================================= + - it: should not set nodeSelector by default for promql-agent + template: charts/promql-agent/templates/agent.yaml + set: + promql-agent.enabled: true + asserts: + - isNull: + path: spec.declarative.deployment.nodeSelector + - it: should set nodeSelector when provided for promql-agent + template: charts/promql-agent/templates/agent.yaml + set: + promql-agent.enabled: true + promql-agent.nodeSelector: + disktype: ssd + asserts: + - equal: + path: spec.declarative.deployment.nodeSelector.disktype + value: ssd