Skip to content

Commit

Permalink
Changes for correct csi-nfs support (#81)
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Karpov <[email protected]>
  • Loading branch information
krpsh123 authored Dec 10, 2024
1 parent f8216a6 commit 85704fd
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/helm_lib/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
type: library
name: deckhouse_lib_helm
version: 1.37.1
version: 1.38.0
description: "Helm utils template definitions for Deckhouse modules."
27 changes: 22 additions & 5 deletions charts/helm_lib/templates/_csi_controller.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ metadata:
name: {{ $fullname }}
namespace: d8-{{ $context.Chart.Name }}
{{- include "helm_lib_module_labels" (list $context (dict "app" "csi-controller")) | nindent 2 }}

{{- if eq $context.Chart.Name "csi-nfs" }}
annotations:
pod-reloader.deckhouse.io/auto: "true"
{{- end }}
spec:
replicas: 1
revisionHistoryLimit: 2
Expand All @@ -185,7 +190,11 @@ spec:
cloud-config-checksum: {{ include (print $context.Template.BasePath "/cloud-controller-manager/secret.yaml") $context | sha256sum }}
{{- end }}
spec:
hostNetwork: true
{{- if eq $context.Chart.Name "csi-nfs" }}
{{- print "hostNetwork: false" | nindent 6 }}
{{- else }}
{{- print "hostNetwork: true" | nindent 6 }}
{{- end }}
dnsPolicy: ClusterFirstWithHostNet
imagePullSecrets:
- name: deckhouse-registry
Expand Down Expand Up @@ -360,14 +369,20 @@ spec:
image: {{ $livenessprobeImage | quote }}
args:
- "--csi-address=$(ADDRESS)"
- "--http-endpoint=$(HOST_IP):{{ $livenessProbePort }}"
{{- if eq $context.Chart.Name "csi-nfs" }}
{{- printf "- \"--http-endpoint=:%d\"" $livenessProbePort | nindent 8 }}
{{- else }}
{{- printf "- \"--http-endpoint=%s:%d\"" "$(HOST_IP)" $livenessProbePort | nindent 8 }}
{{- end }}
env:
- name: ADDRESS
value: /csi/csi.sock
{{- if ne $context.Chart.Name "csi-nfs" }}
- name: HOST_IP
valueFrom:
fieldRef:
fieldPath: status.hostIP
{{- end }}
volumeMounts:
- name: socket-dir
mountPath: /csi
Expand Down Expand Up @@ -435,9 +450,11 @@ spec:
- name: tmp
emptyDir: {}
{{- end }}
{{- if $additionalControllerVolumes }}
{{- $additionalControllerVolumes | toYaml | nindent 6 }}
{{- end }}

{{- if $additionalControllerVolumes }}
{{- $additionalControllerVolumes | toYaml | nindent 6 }}
{{- end }}

{{- end }}
{{- end }}

Expand Down
28 changes: 22 additions & 6 deletions charts/helm_lib/templates/_csi_node.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ memory: 25Mi
{{- $additionalNodeVolumeMounts := $config.additionalNodeVolumeMounts }}
{{- $additionalNodeLivenessProbesCmd := $config.additionalNodeLivenessProbesCmd }}
{{- $additionalNodeSelectorTerms := $config.additionalNodeSelectorTerms }}
{{- $additionalContainers := $config.additionalContainers }}
{{- $initContainers := $config.initContainers }}

{{- $kubernetesSemVer := semver $context.Values.global.discovery.kubernetesVersion }}
Expand Down Expand Up @@ -67,6 +68,11 @@ metadata:
name: {{ $fullname }}
namespace: d8-{{ $context.Chart.Name }}
{{- include "helm_lib_module_labels" (list $context (dict "app" "csi-node")) | nindent 2 }}

{{- if eq $context.Chart.Name "csi-nfs" }}
annotations:
pod-reloader.deckhouse.io/auto: "true"
{{- end }}
spec:
updateStrategy:
type: RollingUpdate
Expand Down Expand Up @@ -100,7 +106,11 @@ spec:
{{- include "helm_lib_priority_class" (tuple $context "system-node-critical") | nindent 6 }}
{{- include "helm_lib_tolerations" (tuple $context "any-node" "with-no-csi") | nindent 6 }}
{{- include "helm_lib_module_pod_security_context_run_as_user_root" . | nindent 6 }}
hostNetwork: true
{{- if eq $context.Chart.Name "csi-nfs" }}
{{- print "hostNetwork: false" | nindent 6 }}
{{- else }}
{{- print "hostNetwork: true" | nindent 6 }}
{{- end }}
dnsPolicy: ClusterFirstWithHostNet
containers:
- name: node-driver-registrar
Expand Down Expand Up @@ -157,16 +167,20 @@ spec:
mountPath: /csi
- name: device-dir
mountPath: /dev
{{- if $additionalNodeVolumeMounts }}
{{- $additionalNodeVolumeMounts | toYaml | nindent 8 }}
{{- end }}
{{- if $additionalNodeVolumeMounts }}
{{- $additionalNodeVolumeMounts | toYaml | nindent 8 }}
{{- end }}
resources:
requests:
{{- include "helm_lib_module_ephemeral_storage_logs_with_extra" 10 | nindent 12 }}
{{- if not ($context.Values.global.enabledModules | has "vertical-pod-autoscaler-crd") }}
{{- include "node_resources" $context | nindent 12 }}
{{- end }}

{{- if $additionalContainers }}
{{- $additionalContainers | toYaml | nindent 6 }}
{{- end }}

{{- if $initContainers }}
initContainers:
{{- range $initContainer := $initContainers }}
Expand Down Expand Up @@ -196,9 +210,11 @@ spec:
hostPath:
path: /dev
type: Directory
{{- if $additionalNodeVolumes }}
{{- $additionalNodeVolumes | toYaml | nindent 6 }}

{{- if $additionalNodeVolumes }}
{{- $additionalNodeVolumes | toYaml | nindent 6 }}
{{- end }}

{{- end }}
{{- end }}
{{- end }}

0 comments on commit 85704fd

Please sign in to comment.