Skip to content

Commit

Permalink
feat(t8s-cluster/workload-cluster): latch onto legacy cni when used (#…
Browse files Browse the repository at this point in the history
…1039)

This should allow us to adopt the legacy clusters into our customer
portal
  • Loading branch information
cwrau authored Jul 18, 2024
1 parent 139ac22 commit 3513061
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 7 deletions.
12 changes: 12 additions & 0 deletions charts/t8s-cluster/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,15 @@
{{- end -}}
{{- $hasGPUFlavor | ternary true "" -}}
{{- end -}}

{{- define "t8s-cluster.cni" -}}
{{- if eq .Values.cni "auto" -}}
{{- if lookup "kustomize.toolkit.fluxcd.io/v1" "Kustomization" .Release.Namespace (printf "%s-cni" .Release.Name) -}}
calico
{{- else -}}
cilium
{{- end -}}
{{- else -}}
{{- .Values.cni -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.cni "calico" }}
{{- if eq (include "t8s-cluster.cni" .) "calico" }}
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
interval: 1h
driftDetection:
mode: enabled
{{- if eq .Values.cni "cilium" }}
{{- if eq (include "t8s-cluster.cni" .) "cilium" }}
dependsOn:
- name: {{ printf "%s-cni" .Release.Name }}
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
interval: 1h
driftDetection:
mode: enabled
{{- if eq .Values.cni "cilium" }}
{{- if eq (include "t8s-cluster.cni" .) "cilium" }}
dependsOn:
- name: {{ printf "%s-cni" .Release.Name }}
namespace: {{ .Release.Namespace }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.cni "calico" }}
{{- if eq (include "t8s-cluster.cni" .) "calico" }}
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if eq .Values.cni "cilium" }}
{{- if eq (include "t8s-cluster.cni" .) "cilium" }}
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{- if eq .Values.cni "cilium" -}}
{{- if eq (include "t8s-cluster.cni" .) "cilium" -}}
{{ include "t8s-cluster.workload.uninstall-job" (dict "name" "cni" "context" . "clusterResourceSet" "cni") }}
{{- end -}}
2 changes: 2 additions & 0 deletions charts/t8s-cluster/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,10 @@
},
"cni": {
"type": "string",
"description": "The CNI plugin to use. `auto` means to keep the current one or use cilium for a new cluster.",
"enum": [
"cilium",
"auto",
"calico"
]
},
Expand Down
2 changes: 1 addition & 1 deletion charts/t8s-cluster/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@ containerRegistryMirror:

sshKeyName: null

cni: cilium
cni: auto

openstackImageNamePrefix: ""

0 comments on commit 3513061

Please sign in to comment.