feat: Let flux manage cilium after bootstrap
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
root=$(git rev-parse --show-toplevel)
|
||||||
|
|
||||||
tools=(talosctl cilium-cli yq helm)
|
tools=(talosctl cilium-cli yq helm)
|
||||||
cilium_version=1.18.4
|
cilium_version=1.18.4
|
||||||
@@ -101,6 +102,7 @@ elif [ ! $count -eq 0 ]; then
|
|||||||
echo " [Success]"
|
echo " [Success]"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
cluster_env=$(kubectl get configmaps -n flux-system cluster-variables -o jsonpath={.data.cluster_env})
|
||||||
if ! helm status -n kube-system cilium &> /dev/null; then
|
if ! helm status -n kube-system cilium &> /dev/null; then
|
||||||
echo "Installing cilium..."
|
echo "Installing cilium..."
|
||||||
helm repo add cilium https://helm.cilium.io/ > /dev/null
|
helm repo add cilium https://helm.cilium.io/ > /dev/null
|
||||||
@@ -110,7 +112,8 @@ if ! helm status -n kube-system cilium &> /dev/null; then
|
|||||||
cilium/cilium \
|
cilium/cilium \
|
||||||
--version ${cilium_version} \
|
--version ${cilium_version} \
|
||||||
--namespace kube-system \
|
--namespace kube-system \
|
||||||
--values cilium.yaml
|
--values ${root}/controllers/cilium/base/values.yaml \
|
||||||
|
--values ${root}/controllers/cilium/${cluster_env}/values.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cilium-cli status --wait
|
cilium-cli status --wait
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ kind: Kustomization
|
|||||||
resources:
|
resources:
|
||||||
- flux-system/
|
- flux-system/
|
||||||
- ../../controllers/artifacts.yaml
|
- ../../controllers/artifacts.yaml
|
||||||
|
- ../../controllers/cilium/cilium.yaml
|
||||||
- ../../controllers/cert-manager/cert-manager.yaml
|
- ../../controllers/cert-manager/cert-manager.yaml
|
||||||
- ../../configs/artifacts.yaml
|
- ../../configs/artifacts.yaml
|
||||||
- ../../configs/letsencrypt/letsencrypt.yaml
|
- ../../configs/letsencrypt/letsencrypt.yaml
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ spec:
|
|||||||
kind: GitRepository
|
kind: GitRepository
|
||||||
name: flux-system
|
name: flux-system
|
||||||
artifacts:
|
artifacts:
|
||||||
|
- name: cilium
|
||||||
|
originRevision: "@foundation"
|
||||||
|
copy:
|
||||||
|
- from: "@foundation/controllers/cilium/**"
|
||||||
|
to: "@artifact/"
|
||||||
- name: cert-manager
|
- name: cert-manager
|
||||||
originRevision: "@foundation"
|
originRevision: "@foundation"
|
||||||
copy:
|
copy:
|
||||||
|
|||||||
30
controllers/cilium/base/helm-release.yaml
Normal file
30
controllers/cilium/base/helm-release.yaml
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
apiVersion: helm.toolkit.fluxcd.io/v2
|
||||||
|
kind: HelmRelease
|
||||||
|
metadata:
|
||||||
|
name: cilium
|
||||||
|
namespace: cilium
|
||||||
|
spec:
|
||||||
|
interval: 12h
|
||||||
|
targetNamespace: kube-system
|
||||||
|
install:
|
||||||
|
strategy:
|
||||||
|
name: RetryOnFailure
|
||||||
|
retryInterval: 2m
|
||||||
|
upgrade:
|
||||||
|
strategy:
|
||||||
|
name: RetryOnFailure
|
||||||
|
retryInterval: 3m
|
||||||
|
chart:
|
||||||
|
spec:
|
||||||
|
chart: cilium
|
||||||
|
version: "1.x"
|
||||||
|
sourceRef:
|
||||||
|
kind: HelmRepository
|
||||||
|
name: cilium
|
||||||
|
interval: 24h
|
||||||
|
valuesFrom:
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: values-base
|
||||||
|
- kind: ConfigMap
|
||||||
|
name: values-overlay
|
||||||
|
optional: true
|
||||||
8
controllers/cilium/base/helm-repository.yaml
Normal file
8
controllers/cilium/base/helm-repository.yaml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
apiVersion: source.toolkit.fluxcd.io/v1
|
||||||
|
kind: HelmRepository
|
||||||
|
metadata:
|
||||||
|
name: cilium
|
||||||
|
namespace: cilium
|
||||||
|
spec:
|
||||||
|
interval: 24h
|
||||||
|
url: https://helm.cilium.io
|
||||||
15
controllers/cilium/base/kustomization.yaml
Normal file
15
controllers/cilium/base/kustomization.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- namespace.yaml
|
||||||
|
- helm-repository.yaml
|
||||||
|
- helm-release.yaml
|
||||||
|
|
||||||
|
configurations:
|
||||||
|
- name-reference.yaml
|
||||||
|
|
||||||
|
configMapGenerator:
|
||||||
|
- name: values-base
|
||||||
|
namespace: cilium
|
||||||
|
files:
|
||||||
|
- values.yaml
|
||||||
6
controllers/cilium/base/name-reference.yaml
Normal file
6
controllers/cilium/base/name-reference.yaml
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
nameReference:
|
||||||
|
- kind: ConfigMap
|
||||||
|
version: v1
|
||||||
|
fieldSpecs:
|
||||||
|
- path: spec/valuesFrom/name
|
||||||
|
kind: HelmRelease
|
||||||
4
controllers/cilium/base/namespace.yaml
Normal file
4
controllers/cilium/base/namespace.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: cilium
|
||||||
@@ -29,8 +29,3 @@ gatewayAPI:
|
|||||||
enabled: true
|
enabled: true
|
||||||
enableAlpn: true
|
enableAlpn: true
|
||||||
enableAppProtocol: true
|
enableAppProtocol: true
|
||||||
operator:
|
|
||||||
replicas: 1
|
|
||||||
hubble:
|
|
||||||
relay:
|
|
||||||
enabled: true
|
|
||||||
15
controllers/cilium/cilium.yaml
Normal file
15
controllers/cilium/cilium.yaml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
apiVersion: kustomize.toolkit.fluxcd.io/v1
|
||||||
|
kind: Kustomization
|
||||||
|
metadata:
|
||||||
|
name: cilium
|
||||||
|
namespace: flux-system
|
||||||
|
spec:
|
||||||
|
interval: 1h
|
||||||
|
retryInterval: 2m
|
||||||
|
timeout: 5m
|
||||||
|
sourceRef:
|
||||||
|
kind: ExternalArtifact
|
||||||
|
name: cilium
|
||||||
|
path: ./${cluster_env}
|
||||||
|
prune: true
|
||||||
|
wait: true
|
||||||
4
controllers/cilium/production/kustomization.yaml
Normal file
4
controllers/cilium/production/kustomization.yaml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
10
controllers/cilium/staging/kustomization.yaml
Normal file
10
controllers/cilium/staging/kustomization.yaml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||||
|
kind: Kustomization
|
||||||
|
resources:
|
||||||
|
- ../base
|
||||||
|
|
||||||
|
configMapGenerator:
|
||||||
|
- name: values-overlay
|
||||||
|
namespace: cilium
|
||||||
|
files:
|
||||||
|
- values.yaml
|
||||||
2
controllers/cilium/staging/values.yaml
Normal file
2
controllers/cilium/staging/values.yaml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
operator:
|
||||||
|
replicas: 1
|
||||||
Reference in New Issue
Block a user