Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added autogenerated PSK field and change type to Secret #199

Open
wants to merge 5 commits into
base: main-source
Choose a base branch
from
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
13 changes: 11 additions & 2 deletions packages/rke2-canal/charts/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
---
# Source: calico/templates/calico-config.yaml
# This ConfigMap is used to configure a self-hosted Canal installation.
kind: ConfigMap
kind: Secret
apiVersion: v1
metadata:
name: {{ .Release.Name }}-config
namespace: kube-system
data:
stringData:
{{- $secretName := print .Release.Name "-config"}}
{{- $config := (lookup "v1" "Secret" .Release.Namespace $secretName) | default dict }}
{{- $psk := (get $config "psk") | default (randAlphaNum 96) }}
{{- if eq .Values.flannel.backend "ipsec" }}
psk: {{ $psk | quote }}
{{- end }}
# Typha is disabled.
typha_service_name: {{ .Values.calico.typhaServiceName | quote }}
# The interface used by canal for host <-> host communication.
Expand Down Expand Up @@ -67,5 +73,8 @@ data:
{{- end }}
"Backend": {
"Type": {{ .Values.flannel.backend | quote }}
{{- if eq .Values.flannel.backend "ipsec" }}
"PSK": {{ $psk | quote }}
{{- end }}
}
}
12 changes: 6 additions & 6 deletions packages/rke2-canal/charts/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
# The CNI network config to install on each node.
- name: CNI_NETWORK_CONFIG
valueFrom:
configMapKeyRef:
secretKeyRef:
name: {{ .Release.Name }}-config
key: cni_network_config
# Set the hostname based on the k8s node name.
Expand All @@ -64,7 +64,7 @@ spec:
# CNI MTU Config variable
- name: CNI_MTU
valueFrom:
configMapKeyRef:
secretKeyRef:
name: {{ .Release.Name }}-config
key: veth_mtu
# Prevents the container from sleeping forever.
Expand Down Expand Up @@ -208,12 +208,12 @@ spec:
fieldPath: metadata.namespace
- name: FLANNELD_IFACE
valueFrom:
configMapKeyRef:
secretKeyRef:
name: {{ .Release.Name }}-config
key: canal_iface
- name: FLANNELD_IP_MASQ
valueFrom:
configMapKeyRef:
secretKeyRef:
name: {{ .Release.Name }}-config
key: masquerade
volumeMounts:
Expand All @@ -239,8 +239,8 @@ spec:
type: FileOrCreate
# Used by flannel.
- name: flannel-cfg
configMap:
name: {{ .Release.Name }}-config
secret:
secretName: {{ .Release.Name }}-config
# Used to install CNI.
- name: cni-bin-dir
hostPath:
Expand Down