Skip to content

Commit

Permalink
Add users and files to MachinePool KubeadmConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
nprokopic committed Oct 18, 2023
1 parent f016423 commit 04090c7
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 22 deletions.
26 changes: 6 additions & 20 deletions helm/cluster/templates/clusterapi/_helpers_files.tpl
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
{{- define "cluster.internal.kubeadm.files" }}
{{- include "cluster.internal.kubeadm.files.sysctl" . }}
{{- include "cluster.internal.kubeadm.files.systemd" . }}
{{- include "cluster.internal.kubeadm.files.ssh" . }}
{{- include "cluster.internal.kubeadm.files.cri" . }}
{{- include "cluster.internal.kubeadm.files.kubelet" . }}
{{- include "cluster.internal.kubeadm.files.kubernetes" . }}
{{- include "cluster.internal.kubeadm.files.proxy" . }}
{{- include "cluster.internal.kubeadm.files.sysctl" $ }}
{{- include "cluster.internal.kubeadm.files.systemd" $ }}
{{- include "cluster.internal.kubeadm.files.ssh" $ }}
{{- include "cluster.internal.kubeadm.files.cri" $ }}
{{- include "cluster.internal.kubeadm.files.kubelet" $ }}
{{- include "cluster.internal.kubeadm.files.proxy" $ }}
{{- end }}

{{- define "cluster.internal.kubeadm.files.sysctl" }}
Expand Down Expand Up @@ -61,19 +60,6 @@
{{- end }}
{{- end }}

{{- define "cluster.internal.kubeadm.files.kubernetes" }}
- path: /etc/kubernetes/policies/audit-policy.yaml
permissions: "0600"
encoding: base64
content: {{ $.Files.Get "files/etc/kubernetes/policies/audit-policy.yaml" | b64enc }}
- path: /etc/kubernetes/encryption/config.yaml
permissions: "0600"
contentFrom:
secret:
name: {{ include "cluster.resource.name" $ }}-encryption-provider-config
key: encryption
{{- end }}

{{- define "cluster.internal.kubeadm.files.proxy" }}
{{- if and $.Values.global.connectivity.proxy $.Values.global.connectivity.proxy.enabled }}
- path: /etc/systemd/system/containerd.service.d/http-proxy.conf
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
{{- define "cluster.internal.controlPlane.kubeadm.files" }}
{{- include "cluster.internal.kubeadm.files" . -}}
{{- include "cluster.internal.kubeadm.files" $ -}}
{{- include "cluster.internal.kubeadm.files.kubernetes" . }}
{{- if $.Values.global.controlPlane.oidc.caPem }}
- path: /etc/ssl/certs/oidc.pem
permissions: "0600"
encoding: base64
content: {{ tpl ($.Files.Get "files/etc/ssl/certs/oidc.pem") . | b64enc }}
{{- end }}
{{- end }}

{{- define "cluster.internal.kubeadm.files.kubernetes" }}
- path: /etc/kubernetes/policies/audit-policy.yaml
permissions: "0600"
encoding: base64
content: {{ $.Files.Get "files/etc/kubernetes/policies/audit-policy.yaml" | b64enc }}
- path: /etc/kubernetes/encryption/config.yaml
permissions: "0600"
contentFrom:
secret:
name: {{ include "cluster.resource.name" $ }}-encryption-provider-config
key: encryption
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
joinConfiguration:
{{- include "cluster.internal.controlPlane.kubeadm.joinConfiguration" $ | indent 6 }}
files:
{{- include "cluster.internal.controlPlane.kubeadm.files" . | indent 4 }}
{{- include "cluster.internal.controlPlane.kubeadm.files" $ | indent 4 }}
preKubeadmCommands:
{{- include "cluster.internal.controlPlane.kubeadm.preKubeadmCommands" $ | indent 4 }}
postKubeadmCommands:
Expand Down
3 changes: 3 additions & 0 deletions helm/cluster/templates/clusterapi/workers/_helpers_files.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{{- define "cluster.internal.workers.kubeadm.files" }}
{{- include "cluster.internal.kubeadm.files" $ -}}
{{- end }}
4 changes: 4 additions & 0 deletions helm/cluster/templates/clusterapi/workers/kubeadmconfig.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
{{- include "cluster.internal.workers.kubeadm.preKubeadmCommands" $ | indent 2 }}
postKubeadmCommands:
{{- include "cluster.internal.workers.kubeadm.postKubeadmCommands" $ | indent 2 }}
users:
{{- include "cluster.internal.kubeadm.users" $ | indent 2 }}
files:
{{- include "cluster.internal.workers.kubeadm.files" $ | indent 2 }}
---
{{- end }}
{{- end }}

0 comments on commit 04090c7

Please sign in to comment.