Skip to content

Commit ef0129e

Browse files
authored
Add basic Helm chart unittests for kuberay-operator (#3253)
1 parent 24ec28c commit ef0129e

11 files changed

+459
-25
lines changed

Diff for: helm-chart/kuberay-operator/templates/deployment.yaml

+28-17
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ apiVersion: apps/v1
22
kind: Deployment
33
metadata:
44
name: {{ include "kuberay-operator.fullname" . }}
5+
namespace: {{ .Release.Namespace }}
56
labels:
6-
{{ include "kuberay-operator.labels" . | indent 4 }}
7-
{{- if .Values.labels }}
8-
{{- toYaml .Values.labels | nindent 4 }}
9-
{{- end }}
7+
{{- include "kuberay-operator.labels" . | nindent 4 }}
8+
{{- with .Values.labels }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
1011
spec:
1112
replicas: 1
1213
strategy:
@@ -21,12 +22,12 @@ spec:
2122
app.kubernetes.io/name: {{ include "kuberay-operator.name" . }}
2223
app.kubernetes.io/instance: {{ .Release.Name }}
2324
app.kubernetes.io/component: {{ include "kuberay-operator.component" . }}
24-
{{- if .Values.labels }}
25-
{{- toYaml .Values.labels | nindent 8 }}
25+
{{- with .Values.labels }}
26+
{{- toYaml . | nindent 8 }}
2627
{{- end }}
27-
{{- if .Values.annotations }}
28+
{{- with .Values.annotations }}
2829
annotations:
29-
{{- toYaml .Values.annotations | nindent 8 }}
30+
{{- toYaml . | nindent 8 }}
3031
{{- end }}
3132
spec:
3233
{{- with .Values.imagePullSecrets }}
@@ -44,14 +45,20 @@ spec:
4445
emptyDir: {}
4546
{{- end }}
4647
{{- end }}
48+
{{- with .Values.podSecurityContext }}
4749
securityContext:
48-
{{- toYaml .Values.podSecurityContext | nindent 8 }}
50+
{{- toYaml . | nindent 8 }}
51+
{{- end }}
4952
containers:
5053
- name: {{ .Chart.Name }}
54+
{{- with .Values.securityContext }}
5155
securityContext:
52-
{{- toYaml .Values.securityContext | nindent 12 }}
56+
{{- toYaml . | nindent 12 }}
57+
{{- end }}
5358
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
54-
imagePullPolicy: {{ .Values.image.pullPolicy }}
59+
{{- with .Values.image.pullPolicy }}
60+
imagePullPolicy: {{ . }}
61+
{{- end }}
5562
{{- if and (.Values.logging.baseDir) (.Values.logging.fileName) }}
5663
volumeMounts:
5764
- name: kuberay-logs
@@ -107,8 +114,10 @@ spec:
107114
- name: http
108115
containerPort: 8080
109116
protocol: TCP
117+
{{- with .Values.env }}
110118
env:
111-
{{- toYaml .Values.env | nindent 12}}
119+
{{- toYaml . | nindent 12 }}
120+
{{- end }}
112121
livenessProbe:
113122
httpGet:
114123
path: /metrics
@@ -123,17 +132,19 @@ spec:
123132
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
124133
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
125134
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
135+
{{- with .Values.resources }}
126136
resources:
127-
{{- toYaml .Values.resources | nindent 12 }}
137+
{{- toYaml . | nindent 12 }}
138+
{{- end }}
128139
{{- with .Values.nodeSelector }}
129140
nodeSelector:
130141
{{- toYaml . | nindent 8 }}
131142
{{- end }}
132-
{{- with .Values.affinity }}
143+
{{- with .Values.affinity }}
133144
affinity:
134145
{{- toYaml . | nindent 8 }}
135-
{{- end }}
136-
{{- with .Values.tolerations }}
146+
{{- end }}
147+
{{- with .Values.tolerations }}
137148
tolerations:
138149
{{- toYaml . | nindent 8 }}
139-
{{- end }}
150+
{{- end }}

Diff for: helm-chart/kuberay-operator/templates/role.yaml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
{{- if and .Values.rbacEnable (not .Values.singleNamespaceInstall) }}
2-
32
kind: ClusterRole
43
apiVersion: rbac.authorization.k8s.io/v1
54
metadata:
6-
labels:
7-
{{ include "kuberay-operator.labels" . | indent 4 }}
85
name: {{ include "kuberay-operator.fullname" . }}
6+
labels:
7+
{{- include "kuberay-operator.labels" . | nindent 4 }}
98
{{ include "role.consistentRules" (dict "batchSchedulerEnabled" .Values.batchScheduler.enabled "batchSchedulerName" .Values.batchScheduler.name) }}
109
{{- end }}

Diff for: helm-chart/kuberay-operator/templates/rolebinding.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
kind: ClusterRoleBinding
33
apiVersion: rbac.authorization.k8s.io/v1
44
metadata:
5-
labels:
6-
{{ include "kuberay-operator.labels" . | indent 4 }}
75
name: {{ include "kuberay-operator.fullname" . }}
6+
labels:
7+
{{- include "kuberay-operator.labels" . | nindent 4 }}
88
subjects:
99
- kind: ServiceAccount
1010
name: {{ .Values.serviceAccount.name }}
1111
namespace: {{ .Release.Namespace }}
1212
roleRef:
13+
apiGroup: rbac.authorization.k8s.io
1314
kind: ClusterRole
1415
name: {{ include "kuberay-operator.fullname" . }}
15-
apiGroup: rbac.authorization.k8s.io
1616
{{- end }}

Diff for: helm-chart/kuberay-operator/templates/service.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ apiVersion: v1
22
kind: Service
33
metadata:
44
name: {{ include "kuberay-operator.fullname" . }}
5+
namespace: {{ .Release.Namespace }}
56
labels:
6-
{{ include "kuberay-operator.labels" . | indent 4 }}
7+
{{- include "kuberay-operator.labels" . | nindent 4 }}
78
spec:
89
type: {{ .Values.service.type }}
910
ports:

Diff for: helm-chart/kuberay-operator/templates/serviceaccount.yaml

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
55
name: {{ template "kuberay-operator.serviceAccountName" . }}
6+
namespace: {{ .Release.Namespace }}
67
labels:
7-
{{ include "kuberay-operator.labels" . | indent 4 }}
8+
{{- include "kuberay-operator.labels" . | nindent 4 }}
89
{{- end -}}

0 commit comments

Comments
 (0)