From 99734efe1af6686077205b650e0922bcd8ac21e9 Mon Sep 17 00:00:00 2001 From: Tanguy Herbron Date: Fri, 30 Dec 2022 23:48:09 +0100 Subject: [PATCH] feat(kustomization): Add kustomization for deployment When deploying anything on the cluster, a `kustomization.yaml` is to be used to allow for on-the-fly patches, and autonomous cluster configuration through native k8s file configuration. This commit adds the first iteration for such implementation, essentially fixing the issue of setting up the cluster from a clean base. Now everything is consolidated into one single file, which later applies desired resources. This also fixes having to copy and paste URLs into the console, as Kustomize allows one to put those URLs into the kustomization file. --- README.md | 13 ++----------- kustomization.yaml | 10 ++++++++++ longhorn/kustomization.yaml | 5 +++++ metallb/ipaddresspool.yaml | 2 +- metallb/kustomization.yaml | 6 ++++++ res/kustomization.yaml | 6 ++++++ 6 files changed, 30 insertions(+), 12 deletions(-) create mode 100644 kustomization.yaml create mode 100644 longhorn/kustomization.yaml create mode 100644 metallb/kustomization.yaml create mode 100644 res/kustomization.yaml diff --git a/README.md b/README.md index 3e48374..560601f 100644 --- a/README.md +++ b/README.md @@ -74,19 +74,10 @@ Add node to the list of available load balancer `kubectl label node svccontroller.k3s.cattle.io/enablelb=true` NOTE: For development, don't forget to also add the `cp` to the LB list, in order to access local only services - -Setup OVH configuration -`kubectl apply -f ovh-config.yaml` - -Install longhorn +Setup the cluster's backbone ``` -kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml +kubectl apply -k . ``` -Remove `local-path` from default StorageClass -`kubectl patch storageclass standard -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'` - -Add longhorn storage classes -`kubectl apply -f res` ### Convert helm chart to k3s manifest `helm template chart stable/chart --output-dir ./chart` diff --git a/kustomization.yaml b/kustomization.yaml new file mode 100644 index 0000000..70a8162 --- /dev/null +++ b/kustomization.yaml @@ -0,0 +1,10 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - https://raw.githubusercontent.com/metallb/metallb/v0.13.7/config/manifests/metallb-native.yaml + - metallb + - ovh-config.yaml + - res + - https://raw.githubusercontent.com/longhorn/longhorn/master/deploy/longhorn.yaml + - longhorn diff --git a/longhorn/kustomization.yaml b/longhorn/kustomization.yaml new file mode 100644 index 0000000..14d8f3a --- /dev/null +++ b/longhorn/kustomization.yaml @@ -0,0 +1,5 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - ingress.yaml diff --git a/metallb/ipaddresspool.yaml b/metallb/ipaddresspool.yaml index e9f6d29..1a475f2 100644 --- a/metallb/ipaddresspool.yaml +++ b/metallb/ipaddresspool.yaml @@ -6,4 +6,4 @@ metadata: spec: addresses: - 10.19.66.247/32 - - 10.10.0.64-10.10.0.69 + - 10.10.0.0/24 diff --git a/metallb/kustomization.yaml b/metallb/kustomization.yaml new file mode 100644 index 0000000..8f84499 --- /dev/null +++ b/metallb/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - configmap.yaml + - ipaddresspool.yaml diff --git a/res/kustomization.yaml b/res/kustomization.yaml new file mode 100644 index 0000000..65bb3a8 --- /dev/null +++ b/res/kustomization.yaml @@ -0,0 +1,6 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization + +resources: + - flat-sc.yaml + - redundant-sc.yaml