Skip to content

Commit b01e115

Browse files
committed
[CC-33024] Remove the deprecated fields of CockroachDB operator
1 parent 56bb490 commit b01e115

File tree

16 files changed

+936
-745
lines changed

16 files changed

+936
-745
lines changed

build/templates/cockroachdb-parent/charts/cockroachdb/values.yaml

Lines changed: 73 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ cockroachdb:
169169
# timestamp captures the annotation timestamp used for rolling restarts.
170170
timestamp: "2021-10-18T00:00:00Z"
171171
# resources captures the resource requests and limits for CockroachDB pods.
172-
resources: ~
173172
# limits:
174173
# cpu: 4000m
175174
# memory: 16Gi
@@ -276,9 +275,6 @@ cockroachdb:
276275
# If not set, the default provisioner will be chosen (gp2 on AWS, standard on GKE).
277276
# storageClassName: ""
278277
#
279-
# podLabels captures additional labels to apply to CockroachDB pods.
280-
podLabels:
281-
app.kubernetes.io/component: cockroachdb
282278
# startFlags specify the flags that will be used for starting the cluster.
283279
# Any flag defined in here will take precedence over the first-class
284280
# fields responsible for setting the same flags.
@@ -290,25 +286,8 @@ cockroachdb:
290286
# # omit defines a set of flags which will be omitted from the start command.
291287
# omit:
292288
# - ""
293-
# env captures environment variables set on CockroachDB pods.
294-
env: []
295-
# - name: APP_NAME
296-
# value: "CRDB"
297-
# - name: POD_NAME
298-
# valueFrom:
299-
# fieldRef:
300-
# fieldPath: metadata.name
301289
# rollingRestartDelay specifies the delay between rolling restarts of CockroachDB pods.
302290
rollingRestartDelay: 30s
303-
# topologySpreadConstraints captures pod topology spread constraints.
304-
# It is recommended to spread CockroachDB pods across zones to ensure high availability.
305-
topologySpreadConstraints:
306-
# maxSkew defines the degree to which the pods can be unevenly distributed.
307-
- maxSkew: 1
308-
# topologyKey defines the key for topology spread.
309-
topologyKey: topology.kubernetes.io/zone
310-
# whenUnsatisfiable defines the behavior when constraints cannot be met.
311-
whenUnsatisfiable: DoNotSchedule
312291
# service captures the Kubernetes Service configurations for CockroachDB pods.
313292
service:
314293
# ports captures the service port definitions.
@@ -355,54 +334,7 @@ cockroachdb:
355334
ingressClassName: ""
356335
annotations: {}
357336
host: ""
358-
# podAnnotations captures annotations to apply to CockroachDB pods.
359-
podAnnotations: {}
360-
# terminationGracePeriod determines the time available to CockroachDB for graceful drain.
361-
# It follows the metav1.Duration format, e.g., "300s", "5m" or "1h".
362-
# terminationGracePeriod: "300s"
363-
# nodeSelector captures the node selector labels for scheduling pods.
364-
nodeSelector: {}
365-
# affinity captures scheduling affinity rules for CockroachDB pods.
366-
affinity:
367-
# nodeAffinity:
368-
# requiredDuringSchedulingIgnoredDuringExecution:
369-
# nodeSelectorTerms:
370-
# - matchExpressions:
371-
# - key: kubernetes.io/os
372-
# operator: In
373-
# values:
374-
# - linux
375-
# podAffinity:
376-
# requiredDuringSchedulingIgnoredDuringExecution:
377-
# - labelSelector:
378-
# matchExpressions:
379-
# - key: security
380-
# operator: In
381-
# values:
382-
# - S1
383-
# topologyKey: topology.kubernetes.io/zone
384-
# podAntiAffinity:
385-
# preferredDuringSchedulingIgnoredDuringExecution:
386-
# - weight: 100
387-
# podAffinityTerm:
388-
# labelSelector:
389-
# matchExpressions:
390-
# - key: security
391-
# operator: In
392-
# values:
393-
# - S2
394-
# topologyKey: topology.kubernetes.io/zone
395337
#
396-
# sideCars captures the configuration for sidecar containers.
397-
sideCars:
398-
# initContainers captures init containers for CockroachDB pods.
399-
initContainers: []
400-
# containers captures additional containers for CockroachDB pods.
401-
containers: []
402-
# volumes captures additional volumes for CockroachDB pods.
403-
volumes: []
404-
# tolerations captures the tolerations for scheduling CockroachDB pods.
405-
tolerations: []
406338
# localityLabels captures labels used to determine node locality.
407339
# It is an ordered, comma-separated list of keys that which must be present as labels on the nodes.
408340
# For region and zone to be part of the locality, the labels (topology.kubernetes.io/region, topology.kubernetes.io/region) must be set on the nodes.
@@ -457,18 +389,85 @@ cockroachdb:
457389
# podTemplate is an optional pod specification that overrides the default pod specification configured by the operator.
458390
# If specified, podTemplate is merged with the default pod specification, with settings in podTemplate taking precedence.
459391
# This can be used to add or update containers, volumes, and other settings of the CockroachDB pod.
460-
podTemplate: {}
392+
podTemplate:
461393
# # metadata captures the pod metadata for CockroachDB pods.
462-
# metadata: {}
394+
metadata:
395+
labels:
396+
app.kubernetes.io/component: cockroachdb
397+
annotations: {}
463398
# # spec captures the pod specification for CockroachDB pods.
464-
# spec:
399+
spec:
465400
# # initContainers captures the list of init containers for CockroachDB pods.
466-
# initContainers:
401+
initContainers:
467402
# - name : cockroachdb-init
468403
# image: us-docker.pkg.dev/cockroach-cloud-images/data-plane/init-container@sha256:c3e4ba851802a429c7f76c639a64b9152d206cebb31162c1760f05e98f7c4254
469404
# # containers captures the list of containers for CockroachDB pods.
470-
# containers:
471-
# - name: cockroachdb
405+
containers:
406+
- name: cockroachdb
407+
# env captures environment variables set on CockroachDB pods.
408+
env: []
409+
# - name: APP_NAME
410+
# value: "CRDB"
411+
# - name: POD_NAME
412+
# valueFrom:
413+
# fieldRef:
414+
# fieldPath: metadata.name
415+
resources: {}
416+
# image: cockroachdb/cockroach:v25.2.2
417+
# - name: cert-reloader
418+
# image: us-docker.pkg.dev/cockroach-cloud-images/data-plane/inotifywait:87edf086db32734c7fa083a62d1055d664900840
419+
volumes: []
420+
# - name: custom-volume
421+
# emptyDir: {}
422+
# # imagePullSecrets captures the secrets for fetching images from private registries.
423+
imagePullSecrets: []
424+
# topologySpreadConstraints captures pod topology spread constraints.
425+
# It is recommended to spread CockroachDB pods across zones to ensure high availability.
426+
topologySpreadConstraints:
427+
# maxSkew defines the degree to which the pods can be unevenly distributed.
428+
- maxSkew: 1
429+
# topologyKey defines the key for topology spread.
430+
topologyKey: topology.kubernetes.io/zone
431+
# whenUnsatisfiable defines the behavior when constraints cannot be met.
432+
whenUnsatisfiable: DoNotSchedule
433+
# terminationGracePeriodSeconds determines the time available to CockroachDB for graceful drain.
434+
terminationGracePeriodSeconds: 300
435+
# tolerations captures the tolerations for pods of the self-signer job.
436+
# https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
437+
# tolerations: []
438+
# nodeSelector captures the node selector labels for scheduling pods.
439+
# nodeSelector: {}
440+
# affinity captures scheduling affinity rules for CockroachDB pods.
441+
# affinity:
442+
# nodeAffinity:
443+
# requiredDuringSchedulingIgnoredDuringExecution:
444+
# nodeSelectorTerms:
445+
# - matchExpressions:
446+
# - key: kubernetes.io/os
447+
# operator: In
448+
# values:
449+
# - linux
450+
# podAffinity:
451+
# requiredDuringSchedulingIgnoredDuringExecution:
452+
# - labelSelector:
453+
# matchExpressions:
454+
# - key: security
455+
# operator: In
456+
# values:
457+
# - S1
458+
# topologyKey: topology.kubernetes.io/zone
459+
# podAntiAffinity:
460+
# preferredDuringSchedulingIgnoredDuringExecution:
461+
# - weight: 100
462+
# podAffinityTerm:
463+
# labelSelector:
464+
# matchExpressions:
465+
# - key: security
466+
# operator: In
467+
# values:
468+
# - S2
469+
# topologyKey: topology.kubernetes.io/zone
470+
#
472471
# image: cockroachdb/cockroach:v25.2.2
473472
# - name: cert-reloader
474473
# image: us-docker.pkg.dev/cockroach-cloud-images/data-plane/inotifywait:87edf086db32734c7fa083a62d1055d664900840

cockroachdb-parent/charts/cockroachdb/templates/crdb.yaml

Lines changed: 134 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ metadata:
99
namespace: {{ .Release.Namespace }}
1010
labels:
1111
{{- include "cluster.labels" . | nindent 4 }}
12-
{{- with .Values.cockroachdb.crdbCluster.podLabels }}
12+
{{- with .Values.cockroachdb.crdbCluster.podTemplate.metadata.labels }}
1313
{{- toYaml . | nindent 4 }}
1414
{{- end }}
1515
{{- with .Values.k8s.labels }}
@@ -59,57 +59,18 @@ spec:
5959
{{- with .Values.cockroachdb.crdbCluster.walFailoverSpec }}
6060
walFailoverSpec: {{- toYaml . | nindent 8 }}
6161
{{- end }}
62-
env:
63-
- name: GODEBUG
64-
value: {{ include "godebugList" . }}
65-
{{- with .Values.cockroachdb.crdbCluster.env }}
66-
{{- toYaml . | nindent 8 }}
67-
{{- end }}
68-
{{- with .Values.cockroachdb.crdbCluster.topologySpreadConstraints }}
69-
topologySpreadConstraints: {{- toYaml . | nindent 8 }}
70-
{{- end }}
71-
{{- if .Values.cockroachdb.crdbCluster.terminationGracePeriod }}
72-
terminationGracePeriod: {{ .Values.cockroachdb.crdbCluster.terminationGracePeriod }}
73-
{{- end }}
74-
podLabels:
75-
app.kubernetes.io/name: {{ template "cockroachdb.name" . }}
76-
app.kubernetes.io/instance: {{ .Release.Name | quote }}
77-
{{- with .Values.cockroachdb.crdbCluster.podLabels }}
78-
{{- toYaml . | nindent 8 }}
79-
{{- end }}
80-
podAnnotations:
81-
helm.sh/restartedAt: {{ .Values.cockroachdb.crdbCluster.timestamp | quote }}
82-
{{- with .Values.cockroachdb.crdbCluster.podAnnotations }}
83-
{{- toYaml . | nindent 8 }}
84-
{{- end }}
85-
{{- with .Values.cockroachdb.crdbCluster.resources }}
86-
resourceRequirements: {{- toYaml . | nindent 8 }}
87-
{{- end }}
8862
{{- with .Values.cockroachdb.crdbCluster.localityLabels }}
8963
localityLabels: {{- toYaml . | nindent 8 }}
9064
{{- end }}
9165
{{- with .Values.cockroachdb.crdbCluster.localityMappings }}
9266
localityMappings: {{- toYaml . | nindent 8 }}
9367
{{- end }}
94-
{{- with .Values.cockroachdb.crdbCluster.tolerations }}
95-
tolerations: {{- toYaml . | nindent 8 }}
96-
{{- end }}
97-
{{- with .Values.cockroachdb.crdbCluster.nodeSelector }}
98-
nodeSelector: {{- toYaml . | nindent 8 }}
99-
{{- end }}
100-
{{- with .Values.cockroachdb.crdbCluster.affinity }}
101-
affinity: {{- toYaml . | nindent 8 }}
102-
{{- end }}
103-
serviceAccountName: {{ include "cockroachdb.serviceAccount.name" . }}
10468
{{- if .Values.cockroachdb.crdbCluster.loggingConfigMapName }}
10569
loggingConfigMapName: {{ .Values.cockroachdb.crdbCluster.loggingConfigMapName }}
10670
{{- end }}
10771
{{- with .Values.cockroachdb.crdbCluster.loggingConfigVars }}
10872
loggingConfigVars: {{- toYaml . | nindent 8 }}
10973
{{- end }}
110-
{{- with .Values.cockroachdb.crdbCluster.sideCars }}
111-
sideCars: {{- toYaml . | nindent 8 }}
112-
{{- end }}
11374
{{- if .Values.cockroachdb.crdbCluster.service.ports.grpc.port }}
11475
grpcPort: {{ .Values.cockroachdb.crdbCluster.service.ports.grpc.port }}
11576
{{- end }}
@@ -123,7 +84,139 @@ spec:
12384
startFlags: {{- toYaml . | nindent 8 }}
12485
{{- end }}
12586
{{- with .Values.cockroachdb.crdbCluster.podTemplate }}
126-
podTemplate: {{- toYaml . | nindent 8 }}
87+
podTemplate:
88+
metadata:
89+
labels:
90+
app.kubernetes.io/name: {{ template "cockroachdb.name" $ }}
91+
app.kubernetes.io/instance: {{ $.Release.Name | quote }}
92+
{{- with .metadata.labels }}
93+
{{- toYaml . | nindent 12 }}
94+
{{- end }}
95+
annotations:
96+
helm.sh/restartedAt: {{ $.Values.cockroachdb.crdbCluster.timestamp | quote }}
97+
{{- with .metadata.annotations }}
98+
{{- toYaml . | nindent 12 }}
99+
{{- end }}
100+
spec:
101+
{{- if .spec.imagePullSecrets }}
102+
imagePullSecrets:
103+
{{- range .spec.imagePullSecrets }}
104+
- name: {{ .name }}
105+
{{- end }}
106+
{{- end }}
107+
{{- with .spec.topologySpreadConstraints }}
108+
topologySpreadConstraints:
109+
{{- toYaml . | nindent 12 }}
110+
{{- end }}
111+
{{- if .spec.terminationGracePeriodSeconds }}
112+
terminationGracePeriodSeconds: {{ .spec.terminationGracePeriodSeconds }}
113+
{{- end }}
114+
{{- with .spec.tolerations }}
115+
tolerations:
116+
{{- toYaml . | nindent 12 }}
117+
{{- end }}
118+
{{- with .spec.nodeSelector }}
119+
nodeSelector:
120+
{{- toYaml . | nindent 12 }}
121+
{{- end }}
122+
{{- with .spec.affinity }}
123+
affinity:
124+
{{- toYaml . | nindent 12 }}
125+
{{- end }}
126+
serviceAccountName: {{ include "cockroachdb.serviceAccount.name" $ }}
127+
{{- if .spec.initContainers }}
128+
initContainers:
129+
{{- range .spec.initContainers }}
130+
- name: {{ .name }}
131+
{{- if .image }}
132+
image: {{ .image }}
133+
{{- end }}
134+
{{- if .imagePullPolicy }}
135+
imagePullPolicy: {{ .imagePullPolicy }}
136+
{{- end }}
137+
{{- if .env }}
138+
env:
139+
{{- toYaml .env | nindent 16 }}
140+
{{- end }}
141+
{{- with .resources }}
142+
resources:
143+
{{- toYaml . | nindent 16 }}
144+
{{- end }}
145+
{{- with .volumeMounts }}
146+
volumeMounts:
147+
{{- toYaml . | nindent 16 }}
148+
{{- end }}
149+
{{- with .ports }}
150+
ports:
151+
{{- toYaml . | nindent 16 }}
152+
{{- end }}
153+
{{- end }}
154+
{{- end }}
155+
{{- if .spec.containers }}
156+
containers:
157+
{{- range .spec.containers }}
158+
- name: {{ .name }}
159+
{{- if .image }}
160+
image: {{ .image }}
161+
{{- end }}
162+
{{- if .imagePullPolicy }}
163+
imagePullPolicy: {{ .imagePullPolicy }}
164+
{{- end }}
165+
{{- if eq .name "cockroachdb" }}
166+
env:
167+
- name: GODEBUG
168+
value: {{ include "godebugList" $ }}
169+
{{- with .env }}
170+
{{- toYaml . | nindent 16 }}
171+
{{- end }}
172+
{{- else if .env }}
173+
env:
174+
{{- toYaml .env | nindent 16 }}
175+
{{- end }}
176+
{{- with .resources }}
177+
resources:
178+
{{- toYaml . | nindent 16 }}
179+
{{- end }}
180+
{{- with .volumeMounts }}
181+
volumeMounts:
182+
{{- toYaml . | nindent 16 }}
183+
{{- end }}
184+
{{- with .ports }}
185+
ports:
186+
{{- toYaml . | nindent 16 }}
187+
{{- end }}
188+
{{- end }}
189+
{{- end }}
190+
{{- if .spec.volumes }}
191+
volumes:
192+
{{- range .spec.volumes }}
193+
- name: {{ .name }}
194+
{{- with .configMap }}
195+
configMap:
196+
{{- toYaml . | nindent 6 }}
197+
{{- end }}
198+
{{- with .secret }}
199+
secret:
200+
{{- toYaml . | nindent 6 }}
201+
{{- end }}
202+
{{- with .persistentVolumeClaim }}
203+
persistentVolumeClaim:
204+
{{- toYaml . | nindent 6 }}
205+
{{- end }}
206+
{{- with .emptyDir }}
207+
emptyDir:
208+
{{- toYaml . | nindent 6 }}
209+
{{- end }}
210+
{{- with .hostPath }}
211+
hostPath:
212+
{{- toYaml . | nindent 6 }}
213+
{{- end }}
214+
{{- with .projected }}
215+
projected:
216+
{{- toYaml . | nindent 6 }}
217+
{{- end }}
218+
{{- end }}
219+
{{- end }}
127220
{{- end }}
128221
{{- with .Values.cockroachdb.crdbCluster.persistentVolumeClaimRetentionPolicy }}
129222
persistentVolumeClaimRetentionPolicy: {{- toYaml . | nindent 8 }}

0 commit comments

Comments
 (0)