Skip to content

Commit 084e5aa

Browse files
feat(openstack-cloud-controller-manager): add option to change deployment type
1 parent e862efc commit 084e5aa

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

charts/openstack-cloud-controller-manager/templates/daemonset.yaml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: apps/v1
2-
kind: DaemonSet
2+
kind: {{ .Values.controllerKind }}
33
metadata:
44
name: {{ include "occm.name" . }}
55
labels: {{- include "common.labels.standard" . | nindent 4 }}
@@ -12,8 +12,14 @@ spec:
1212
selector:
1313
matchLabels:
1414
{{- include "occm.controllermanager.matchLabels" . | nindent 6 }}
15+
{{- if eq .Values.controllerKind "Deployment" }}
16+
replicas: {{ .Values.controllerReplicas }}
17+
strategy:
18+
type: RollingUpdate
19+
{{- else }}
1520
updateStrategy:
1621
type: RollingUpdate
22+
{{- end }}
1723
template:
1824
metadata:
1925
annotations:
@@ -26,10 +32,17 @@ spec:
2632
imagePullSecrets:
2733
{{- toYaml . | nindent 8 }}
2834
{{- end }}
35+
{{- if eq .Values.controllerKind "Deployment" }}
36+
{{- with .Values.deploymentNodeSelector }}
37+
nodeSelector:
38+
{{- toYaml . | nindent 8 }}
39+
{{- end }}
40+
{{- else }}
2941
{{- with .Values.nodeSelector }}
3042
nodeSelector:
3143
{{- toYaml . | nindent 8 }}
3244
{{- end }}
45+
{{- end }}
3346
{{- with .Values.podSecurityContext }}
3447
securityContext:
3548
{{- toYaml . | nindent 8 }}

charts/openstack-cloud-controller-manager/values.yaml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
#
33
# Define deployment mode for the controller and provide cloud credentials in cloudConfig at the end of the file
44
#
5+
# Controller kind: DaemonSet or Deployment
6+
# Use DaemonSet to run on all control-plane nodes (default)
7+
# Use Deployment to run a specific number of replicas
8+
controllerKind: DaemonSet
9+
10+
# Number of replicas (only used when controllerKind is Deployment)
11+
controllerReplicas: 2
12+
513
## Annotations to apply to all resources
614
commonAnnotations: {}
715
# commonAnnotations:
@@ -48,10 +56,14 @@ readinessProbe: {}
4856

4957
dnsPolicy: ClusterFirst
5058

51-
# Set nodeSelector where the controller should run, i.e. controlplane nodes
59+
# Set nodeSelector where the controller should run, i.e. controlplane nodes (used for DaemonSet)
5260
nodeSelector:
5361
node-role.kubernetes.io/control-plane: ""
5462

63+
# Set nodeSelector for Deployment (used when controllerKind is Deployment)
64+
# Defaults to empty (no node restriction)
65+
deploymentNodeSelector: {}
66+
5567
# Set tolerations for nodes where the controller should run, i.e. node
5668
# should be uninitialized, controlplane...
5769
tolerations:

0 commit comments

Comments
 (0)