From bb5dd6ac5cbc2f76de2e3536ae03485f85cb83bf Mon Sep 17 00:00:00 2001 From: Steve Hipwell Date: Tue, 24 Oct 2023 17:26:00 +0100 Subject: [PATCH] feat(chart): Made node agent optional (#2623) Signed-off-by: Steve Hipwell --- charts/aws-vpc-cni/README.md | 3 +++ charts/aws-vpc-cni/templates/daemonset.yaml | 16 +++++++++++++--- charts/aws-vpc-cni/values.yaml | 3 +++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/charts/aws-vpc-cni/README.md b/charts/aws-vpc-cni/README.md index 99a45fa555..cecfc20a59 100644 --- a/charts/aws-vpc-cni/README.md +++ b/charts/aws-vpc-cni/README.md @@ -60,8 +60,10 @@ The following table lists the configurable parameters for this chart and their d | `init.image.override` | A custom docker image to use | `nil` | | `init.env` | List of init container environment variables. See [here](https://github.com/aws/amazon-vpc-cni-k8s#cni-configuration-variables) for options | (see `values.yaml`) | | `init.securityContext` | Init container Security context | `privileged: true` | +| `init.resources` | Init container resources, will defualt to .Values.resources if not set | `{}` | | `originalMatchLabels` | Use the original daemonset matchLabels | `false` | | `nameOverride` | Override the name of the chart | `aws-node` | +| `nodeAgent.enabled` | If the Node Agent container should be created | `true` | | `nodeAgent.image.tag` | Image tag for Node Agent | `v1.0.4` | | `nodeAgent.image.domain`| ECR repository domain | `amazonaws.com` | | `nodeAgent.image.region`| ECR repository region to use. Should match your cluster | `us-west-2` | @@ -74,6 +76,7 @@ The following table lists the configurable parameters for this chart and their d | `nodeAgent.metricsBindAddr` | Node Agent port for metrics | `8162` | | `nodeAgent.healthProbeBindAddr` | Node Agent port for health probes | `8163` | | `nodeAgent.enableIpv6` | Enable IPv6 support for Node Agent | `false` | +| `nodeAgent.resources` | Node Agent resources, will defualt to .Values.resources if not set | `{}` | | `extraVolumes` | Array to add extra volumes | `[]` | | `extraVolumeMounts` | Array to add extra mount | `[]` | | `nodeSelector` | Node labels for pod assignment | `{}` | diff --git a/charts/aws-vpc-cni/templates/daemonset.yaml b/charts/aws-vpc-cni/templates/daemonset.yaml index 6d829943f4..281898542f 100644 --- a/charts/aws-vpc-cni/templates/daemonset.yaml +++ b/charts/aws-vpc-cni/templates/daemonset.yaml @@ -48,8 +48,10 @@ spec: {{- end }} securityContext: {{- toYaml .Values.init.securityContext | nindent 12 }} + {{- with default .Values.resources .Values.init.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - mountPath: /host/opt/cni/bin name: cni-bin-dir @@ -91,8 +93,10 @@ spec: fieldRef: apiVersion: v1 fieldPath: metadata.name + {{- with .Values.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} securityContext: {{- toYaml .Values.securityContext | nindent 12 }} volumeMounts: @@ -116,6 +120,7 @@ spec: {{- with .Values.extraVolumeMounts }} {{- toYaml .| nindent 10 }} {{- end }} + {{- if .Values.nodeAgent.enabled }} - name: aws-eks-nodeagent image: {{ include "aws-vpc-cni.nodeAgentImage" . }} env: @@ -131,8 +136,10 @@ spec: - --enable-policy-event-logs={{ .Values.nodeAgent.enablePolicyEventLogs }} - --metrics-bind-addr={{ include "aws-vpc-cni.nodeAgentMetricsBindAddr" . }} - --health-probe-bind-addr={{ include "aws-vpc-cni.nodeAgentHealthProbeBindAddr" . }} + {{- with default .Values.resources .Values.nodeAgent.resources }} resources: - {{- toYaml .Values.resources | nindent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} securityContext: {{- toYaml .Values.nodeAgent.securityContext | nindent 12 }} volumeMounts: @@ -144,10 +151,13 @@ spec: name: log-dir - mountPath: /var/run/aws-node name: run-dir + {{- end }} volumes: + {{- if .Values.nodeAgent.enabled }} - name: bpf-pin-path hostPath: path: /sys/fs/bpf + {{- end }} - name: cni-bin-dir hostPath: path: /opt/cni/bin diff --git a/charts/aws-vpc-cni/values.yaml b/charts/aws-vpc-cni/values.yaml index a4c0cdb3a4..f60f8c066d 100644 --- a/charts/aws-vpc-cni/values.yaml +++ b/charts/aws-vpc-cni/values.yaml @@ -22,8 +22,10 @@ init: ENABLE_IPv6: "false" securityContext: privileged: true + resources: {} nodeAgent: + enabled: true image: tag: v1.0.4 domain: amazonaws.com @@ -44,6 +46,7 @@ nodeAgent: enableIpv6: "false" metricsBindAddr: "8162" healthProbeBindAddr: "8163" + resources: {} image: tag: v1.15.1