Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: apps/v1
kind: DaemonSet
kind: {{ .Values.controllerKind }}
metadata:
name: {{ include "occm.name" . }}
labels: {{- include "occm.labels.standard" . | nindent 4 }}
Expand All @@ -12,8 +12,14 @@ spec:
selector:
matchLabels:
{{- include "occm.controllermanager.matchLabels" . | nindent 6 }}
{{- if eq .Values.controllerKind "Deployment" }}
replicas: {{ .Values.controllerReplicas }}
strategy:
type: RollingUpdate
{{- else }}
updateStrategy:
type: RollingUpdate
{{- end }}
template:
metadata:
annotations:
Expand All @@ -26,10 +32,17 @@ spec:
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if eq .Values.controllerKind "Deployment" }}
{{- with .Values.deploymentNodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- else }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
{{- with .Values.podSecurityContext }}
securityContext:
{{- toYaml . | nindent 8 }}
Expand Down
14 changes: 13 additions & 1 deletion charts/openstack-cloud-controller-manager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
#
# Define deployment mode for the controller and provide cloud credentials in cloudConfig at the end of the file
#
# Controller kind: DaemonSet or Deployment
# Use DaemonSet to run on all control-plane nodes (default)
# Use Deployment to run a specific number of replicas
controllerKind: DaemonSet

# Number of replicas (only used when controllerKind is Deployment)
controllerReplicas: 2

## Annotations to apply to all resources
commonAnnotations: {}
# commonAnnotations:
Expand Down Expand Up @@ -55,10 +63,14 @@ hostNetwork: true
# Set to ClusterFirst if hostNetwork is disabled
dnsPolicy: ClusterFirstWithHostNet

# Set nodeSelector where the controller should run, i.e. controlplane nodes
# Set nodeSelector where the controller should run, i.e. controlplane nodes (used for DaemonSet)
nodeSelector:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use a single nodeSelector values for both daemonset and deployment?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been a while, but I don't think so, because one can't remove a value from the helm default values. And with a deployment I would need an empty nodeSelector (at least that's part of the use case for this change).

Let me check that again

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, just checked, without this split field gitops users (at least for flux) can't clear the nodeSelector, as that would only work by setting it to null but setting fields to null in yaml is dropped by the apiServer and so never reaches helm inside of flux.

node-role.kubernetes.io/control-plane: ""

# Set nodeSelector for Deployment (used when controllerKind is Deployment)
# Defaults to empty (no node restriction)
deploymentNodeSelector: {}

# Set tolerations for nodes where the controller should run, i.e. node
# should be uninitialized, controlplane...
tolerations:
Expand Down
Loading