From 4d8dbb306a1c48fd1c373a57cd53114212653ba3 Mon Sep 17 00:00:00 2001 From: Sheogorath <sheogorath@shivering-isles.com> Date: Sun, 10 Oct 2021 00:58:14 +0200 Subject: [PATCH] Refactor: Introduce new bootstrap directory to manage calico dependency --- .../calico/kustomization.yaml | 0 .../calico/release.yaml | 0 .../calico/repository.yaml | 0 .../sources => bootstrap}/kustomization.yaml | 4 ++-- bootstrap/kyverno/kustomization.yaml | 7 +++++++ .../kyverno/namespace.yaml | 0 bootstrap/kyverno/release.yaml | 19 ++++++++++++++++++ .../kyverno/repository.yaml | 0 clusters/k8s01/infrastructure.yaml | 2 ++ infrastructure/README.md | 4 ++++ infrastructure/kustomization.yaml | 4 ++-- infrastructure/kyverno/kustomization.yaml | 2 -- infrastructure/kyverno/release.yaml | 20 ------------------- 13 files changed, 36 insertions(+), 26 deletions(-) rename {infrastructure => bootstrap}/calico/kustomization.yaml (100%) rename {infrastructure => bootstrap}/calico/release.yaml (100%) rename {infrastructure => bootstrap}/calico/repository.yaml (100%) rename {infrastructure/sources => bootstrap}/kustomization.yaml (60%) create mode 100644 bootstrap/kyverno/kustomization.yaml rename {infrastructure => bootstrap}/kyverno/namespace.yaml (100%) create mode 100644 bootstrap/kyverno/release.yaml rename {infrastructure => bootstrap}/kyverno/repository.yaml (100%) create mode 100644 infrastructure/README.md diff --git a/infrastructure/calico/kustomization.yaml b/bootstrap/calico/kustomization.yaml similarity index 100% rename from infrastructure/calico/kustomization.yaml rename to bootstrap/calico/kustomization.yaml diff --git a/infrastructure/calico/release.yaml b/bootstrap/calico/release.yaml similarity index 100% rename from infrastructure/calico/release.yaml rename to bootstrap/calico/release.yaml diff --git a/infrastructure/calico/repository.yaml b/bootstrap/calico/repository.yaml similarity index 100% rename from infrastructure/calico/repository.yaml rename to bootstrap/calico/repository.yaml diff --git a/infrastructure/sources/kustomization.yaml b/bootstrap/kustomization.yaml similarity index 60% rename from infrastructure/sources/kustomization.yaml rename to bootstrap/kustomization.yaml index 32a9aa060..473377f9e 100644 --- a/infrastructure/sources/kustomization.yaml +++ b/bootstrap/kustomization.yaml @@ -1,5 +1,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -namespace: flux-system resources: - - zalando-postgres.yaml + - calico + - kyverno diff --git a/bootstrap/kyverno/kustomization.yaml b/bootstrap/kyverno/kustomization.yaml new file mode 100644 index 000000000..2f4dcc1d2 --- /dev/null +++ b/bootstrap/kyverno/kustomization.yaml @@ -0,0 +1,7 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +namespace: kyverno +resources: + - namespace.yaml + - repository.yaml + - release.yaml diff --git a/infrastructure/kyverno/namespace.yaml b/bootstrap/kyverno/namespace.yaml similarity index 100% rename from infrastructure/kyverno/namespace.yaml rename to bootstrap/kyverno/namespace.yaml diff --git a/bootstrap/kyverno/release.yaml b/bootstrap/kyverno/release.yaml new file mode 100644 index 000000000..bd79c6a99 --- /dev/null +++ b/bootstrap/kyverno/release.yaml @@ -0,0 +1,19 @@ +apiVersion: helm.toolkit.fluxcd.io/v2beta1 +kind: HelmRelease +metadata: + name: kyverno-crds + namespace: kyverno +spec: + releaseName: kyverno-crds + chart: + spec: + chart: kyverno-crds + sourceRef: + kind: HelmRepository + name: kyverno + version: v2.0.3 + interval: 5m + install: + crds: CreateReplace + upgrade: + crds: CreateReplace diff --git a/infrastructure/kyverno/repository.yaml b/bootstrap/kyverno/repository.yaml similarity index 100% rename from infrastructure/kyverno/repository.yaml rename to bootstrap/kyverno/repository.yaml diff --git a/clusters/k8s01/infrastructure.yaml b/clusters/k8s01/infrastructure.yaml index 46249239f..ce431e9a2 100644 --- a/clusters/k8s01/infrastructure.yaml +++ b/clusters/k8s01/infrastructure.yaml @@ -4,6 +4,8 @@ metadata: name: infrastructure namespace: flux-system spec: + dependsOn: + - name: bootstrap interval: 10m0s sourceRef: kind: GitRepository diff --git a/infrastructure/README.md b/infrastructure/README.md new file mode 100644 index 000000000..f42941ff0 --- /dev/null +++ b/infrastructure/README.md @@ -0,0 +1,4 @@ +Infrastructure +=== + +Basic building blocks shared across Kubernetes clusters. diff --git a/infrastructure/kustomization.yaml b/infrastructure/kustomization.yaml index cd68e04ae..e6c03593c 100644 --- a/infrastructure/kustomization.yaml +++ b/infrastructure/kustomization.yaml @@ -1,8 +1,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - - calico - # kyverno + - kyverno - hcloud-csi - rook - cert-manager + - prometheus diff --git a/infrastructure/kyverno/kustomization.yaml b/infrastructure/kyverno/kustomization.yaml index 3e80f71e0..18b52f1df 100644 --- a/infrastructure/kyverno/kustomization.yaml +++ b/infrastructure/kyverno/kustomization.yaml @@ -2,8 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization namespace: kyverno resources: - - namespace.yaml - - repository.yaml - release.yaml - deny-system-namespaces.yaml - deny-network-policies.yaml diff --git a/infrastructure/kyverno/release.yaml b/infrastructure/kyverno/release.yaml index 6c8a94928..c7bdb5352 100644 --- a/infrastructure/kyverno/release.yaml +++ b/infrastructure/kyverno/release.yaml @@ -1,25 +1,5 @@ apiVersion: helm.toolkit.fluxcd.io/v2beta1 kind: HelmRelease -metadata: - name: kyverno-crds - namespace: kyverno -spec: - releaseName: kyverno-crds - chart: - spec: - chart: kyverno-crds - sourceRef: - kind: HelmRepository - name: kyverno - version: v2.0.3 - interval: 5m - install: - crds: CreateReplace - upgrade: - crds: CreateReplace ---- -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease metadata: name: kyverno namespace: kyverno -- GitLab