blob: 53a291e0f7610120ad3a8c096ec49954e050bdfd [file] [log] [blame]
Mohammed Naser65cda132024-05-02 14:34:08 -04001{{- if .Values.master.enable }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05002apiVersion: apps/v1
3kind: Deployment
4metadata:
5 name: {{ include "node-feature-discovery.fullname" . }}-master
Mohammed Naser65cda132024-05-02 14:34:08 -04006 namespace: {{ include "node-feature-discovery.namespace" . }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05007 labels:
8 {{- include "node-feature-discovery.labels" . | nindent 4 }}
9 role: master
Mohammed Naser65cda132024-05-02 14:34:08 -040010 {{- with .Values.master.deploymentAnnotations }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050011 annotations:
Mohammed Naser65cda132024-05-02 14:34:08 -040012 {{- toYaml . | nindent 4 }}
13 {{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050014spec:
15 replicas: {{ .Values.master.replicaCount }}
16 selector:
17 matchLabels:
18 {{- include "node-feature-discovery.selectorLabels" . | nindent 6 }}
19 role: master
20 template:
21 metadata:
22 labels:
23 {{- include "node-feature-discovery.selectorLabels" . | nindent 8 }}
24 role: master
Mohammed Naser65cda132024-05-02 14:34:08 -040025 {{- with .Values.master.annotations }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050026 annotations:
Mohammed Naser65cda132024-05-02 14:34:08 -040027 {{- toYaml . | nindent 8 }}
28 {{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050029 spec:
30 {{- with .Values.imagePullSecrets }}
31 imagePullSecrets:
32 {{- toYaml . | nindent 8 }}
33 {{- end }}
34 serviceAccountName: {{ include "node-feature-discovery.master.serviceAccountName" . }}
Mohammed Naser65cda132024-05-02 14:34:08 -040035 enableServiceLinks: false
Mohammed Naser9ad0d462023-01-15 20:36:37 -050036 securityContext:
37 {{- toYaml .Values.master.podSecurityContext | nindent 8 }}
38 containers:
39 - name: master
40 securityContext:
41 {{- toYaml .Values.master.securityContext | nindent 12 }}
42 image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
43 imagePullPolicy: {{ .Values.image.pullPolicy }}
44 livenessProbe:
Mohammed Naser65cda132024-05-02 14:34:08 -040045 grpc:
46 port: 8080
Mohammed Naser9ad0d462023-01-15 20:36:37 -050047 initialDelaySeconds: 10
48 periodSeconds: 10
49 readinessProbe:
Mohammed Naser65cda132024-05-02 14:34:08 -040050 grpc:
51 port: 8080
Mohammed Naser9ad0d462023-01-15 20:36:37 -050052 initialDelaySeconds: 5
53 periodSeconds: 10
54 failureThreshold: 10
55 ports:
Mohammed Naser65cda132024-05-02 14:34:08 -040056 - containerPort: {{ .Values.master.port | default "8080" }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050057 name: grpc
Mohammed Naser65cda132024-05-02 14:34:08 -040058 - containerPort: {{ .Values.master.metricsPort | default "8081" }}
59 name: metrics
Mohammed Naser9ad0d462023-01-15 20:36:37 -050060 env:
61 - name: NODE_NAME
62 valueFrom:
63 fieldRef:
64 fieldPath: spec.nodeName
65 command:
66 - "nfd-master"
67 resources:
68 {{- toYaml .Values.master.resources | nindent 12 }}
69 args:
70 {{- if .Values.master.instance | empty | not }}
Mohammed Naser65cda132024-05-02 14:34:08 -040071 - "-instance={{ .Values.master.instance }}"
72 {{- end }}
73 {{- if not .Values.enableNodeFeatureApi }}
74 - "-port={{ .Values.master.port | default "8080" }}"
75 - "-enable-nodefeature-api=false"
76 {{- else if gt (int .Values.master.replicaCount) 1 }}
77 - "-enable-leader-election"
Mohammed Naser9ad0d462023-01-15 20:36:37 -050078 {{- end }}
79 {{- if .Values.master.extraLabelNs | empty | not }}
Mohammed Naser65cda132024-05-02 14:34:08 -040080 - "-extra-label-ns={{- join "," .Values.master.extraLabelNs }}"
81 {{- end }}
82 {{- if .Values.master.denyLabelNs | empty | not }}
83 - "-deny-label-ns={{- join "," .Values.master.denyLabelNs }}"
Mohammed Naser9ad0d462023-01-15 20:36:37 -050084 {{- end }}
85 {{- if .Values.master.resourceLabels | empty | not }}
Mohammed Naser65cda132024-05-02 14:34:08 -040086 - "-resource-labels={{- join "," .Values.master.resourceLabels }}"
87 {{- end }}
88 {{- if .Values.master.enableTaints }}
89 - "-enable-taints"
90 {{- end }}
91 {{- if .Values.master.crdController | kindIs "invalid" | not }}
92 - "-crd-controller={{ .Values.master.crdController }}"
93 {{- else }}
94 ## By default, disable crd controller for other than the default instances
95 - "-crd-controller={{ .Values.master.instance | empty }}"
Mohammed Naser9ad0d462023-01-15 20:36:37 -050096 {{- end }}
97 {{- if .Values.master.featureRulesController | kindIs "invalid" | not }}
98 - "-featurerules-controller={{ .Values.master.featureRulesController }}"
Mohammed Naser9ad0d462023-01-15 20:36:37 -050099 {{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -0400100 {{- if .Values.master.resyncPeriod }}
101 - "-resync-period={{ .Values.master.resyncPeriod }}"
102 {{- end }}
103 {{- if .Values.master.nfdApiParallelism | empty | not }}
104 - "-nfd-api-parallelism={{ .Values.master.nfdApiParallelism }}"
105 {{- end }}
106 {{- if .Values.tls.enable }}
107 - "-ca-file=/etc/kubernetes/node-feature-discovery/certs/ca.crt"
108 - "-key-file=/etc/kubernetes/node-feature-discovery/certs/tls.key"
109 - "-cert-file=/etc/kubernetes/node-feature-discovery/certs/tls.crt"
110 {{- end }}
111 - "-metrics={{ .Values.master.metricsPort | default "8081" }}"
Mohammed Naser9ad0d462023-01-15 20:36:37 -0500112 volumeMounts:
Mohammed Naser65cda132024-05-02 14:34:08 -0400113 {{- if .Values.tls.enable }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -0500114 - name: nfd-master-cert
115 mountPath: "/etc/kubernetes/node-feature-discovery/certs"
116 readOnly: true
Mohammed Naser65cda132024-05-02 14:34:08 -0400117 {{- end }}
118 - name: nfd-master-conf
119 mountPath: "/etc/kubernetes/node-feature-discovery"
120 readOnly: true
Mohammed Naser9ad0d462023-01-15 20:36:37 -0500121 volumes:
Mohammed Naser65cda132024-05-02 14:34:08 -0400122 {{- if .Values.tls.enable }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -0500123 - name: nfd-master-cert
124 secret:
125 secretName: nfd-master-cert
Mohammed Naser65cda132024-05-02 14:34:08 -0400126 {{- end }}
127 - name: nfd-master-conf
128 configMap:
129 name: {{ include "node-feature-discovery.fullname" . }}-master-conf
130 items:
131 - key: nfd-master.conf
132 path: nfd-master.conf
Mohammed Naser9ad0d462023-01-15 20:36:37 -0500133 {{- with .Values.master.nodeSelector }}
134 nodeSelector:
135 {{- toYaml . | nindent 8 }}
136 {{- end }}
137 {{- with .Values.master.affinity }}
138 affinity:
139 {{- toYaml . | nindent 8 }}
140 {{- end }}
141 {{- with .Values.master.tolerations }}
142 tolerations:
143 {{- toYaml . | nindent 8 }}
144 {{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -0400145{{- end }}