Mohammed Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 1 | {{- if and .Values.gc.enable (or .Values.enableNodeFeatureApi .Values.topologyUpdater.enable) -}} |
| 2 | apiVersion: apps/v1 |
| 3 | kind: Deployment |
| 4 | metadata: |
| 5 | name: {{ include "node-feature-discovery.fullname" . }}-gc |
| 6 | namespace: {{ include "node-feature-discovery.namespace" . }} |
| 7 | labels: |
| 8 | {{- include "node-feature-discovery.labels" . | nindent 4 }} |
| 9 | role: gc |
| 10 | {{- with .Values.gc.deploymentAnnotations }} |
| 11 | annotations: |
| 12 | {{- toYaml . | nindent 4 }} |
| 13 | {{- end }} |
| 14 | spec: |
| 15 | replicas: {{ .Values.gc.replicaCount | default 1 }} |
| 16 | selector: |
| 17 | matchLabels: |
| 18 | {{- include "node-feature-discovery.selectorLabels" . | nindent 6 }} |
| 19 | role: gc |
| 20 | template: |
| 21 | metadata: |
| 22 | labels: |
| 23 | {{- include "node-feature-discovery.selectorLabels" . | nindent 8 }} |
| 24 | role: gc |
| 25 | {{- with .Values.gc.annotations }} |
| 26 | annotations: |
| 27 | {{- toYaml . | nindent 8 }} |
| 28 | {{- end }} |
| 29 | spec: |
| 30 | serviceAccountName: {{ include "node-feature-discovery.gc.serviceAccountName" . }} |
| 31 | dnsPolicy: ClusterFirstWithHostNet |
| 32 | {{- with .Values.imagePullSecrets }} |
| 33 | imagePullSecrets: |
| 34 | {{- toYaml . | nindent 8 }} |
| 35 | {{- end }} |
| 36 | securityContext: |
| 37 | {{- toYaml .Values.gc.podSecurityContext | nindent 8 }} |
| 38 | containers: |
| 39 | - name: gc |
| 40 | image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" |
| 41 | imagePullPolicy: "{{ .Values.image.pullPolicy }}" |
| 42 | env: |
| 43 | - name: NODE_NAME |
| 44 | valueFrom: |
| 45 | fieldRef: |
| 46 | fieldPath: spec.nodeName |
| 47 | command: |
| 48 | - "nfd-gc" |
| 49 | args: |
| 50 | {{- if .Values.gc.interval | empty | not }} |
| 51 | - "-gc-interval={{ .Values.gc.interval }}" |
| 52 | {{- end }} |
| 53 | resources: |
| 54 | {{- toYaml .Values.gc.resources | nindent 12 }} |
| 55 | securityContext: |
| 56 | allowPrivilegeEscalation: false |
| 57 | capabilities: |
| 58 | drop: [ "ALL" ] |
| 59 | readOnlyRootFilesystem: true |
| 60 | runAsNonRoot: true |
| 61 | ports: |
| 62 | - name: metrics |
| 63 | containerPort: {{ .Values.gc.metricsPort | default "8081"}} |
| 64 | |
| 65 | {{- with .Values.gc.nodeSelector }} |
| 66 | nodeSelector: |
| 67 | {{- toYaml . | nindent 8 }} |
| 68 | {{- end }} |
| 69 | {{- with .Values.gc.affinity }} |
| 70 | affinity: |
| 71 | {{- toYaml . | nindent 8 }} |
| 72 | {{- end }} |
| 73 | {{- with .Values.gc.tolerations }} |
| 74 | tolerations: |
| 75 | {{- toYaml . | nindent 8 }} |
| 76 | {{- end }} |
| 77 | {{- end }} |