From 39193067d34888ac970cd9ad20dde1f24e866635 Mon Sep 17 00:00:00 2001 From: devantler Date: Mon, 17 Jul 2023 02:32:52 +0200 Subject: [PATCH 01/15] test --- .../controllers/ingress-traefik/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml b/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml index abf6261c..13d98201 100644 --- a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml +++ b/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml @@ -4,5 +4,5 @@ namespace: ingress-traefik resources: - namespace.yaml - repository.yaml - - release.yaml + # - release.yaml From 325765cd6ad3b242d974cc03d2b44bf98e8aaf97 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 01:46:05 +0200 Subject: [PATCH 02/15] fix end-to-end-test --- .github/workflows/{end-to-end-test.yaml => e2e-test.yaml} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename .github/workflows/{end-to-end-test.yaml => e2e-test.yaml} (91%) diff --git a/.github/workflows/end-to-end-test.yaml b/.github/workflows/e2e-test.yaml similarity index 91% rename from .github/workflows/end-to-end-test.yaml rename to .github/workflows/e2e-test.yaml index 44be972d..f6923f9a 100644 --- a/.github/workflows/end-to-end-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -1,4 +1,4 @@ -name: End-to-end test of cluster reconciliation +name: End-to-end test on: workflow_dispatch: @@ -32,7 +32,8 @@ jobs: flux create source git flux-system \ --url=${{ github.event.repository.html_url }} \ --branch=${{ steps.extract_branch.outputs.branch }} \ - --ignore-paths="./k8s/clusters/**/flux-system/" + --ignore-paths="./k8s/clusters/development/flux-system/" \ + --ignore-paths="./k8s/clusters/production/flux-system/" flux create kustomization flux-system \ --source=flux-system \ --path=./k8s/clusters/development From db477f40ed747003b7837aca67a5ad768cd5414b Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 01:54:16 +0200 Subject: [PATCH 03/15] test --- .../controllers/ingress-traefik/kustomization.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml b/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml index 13d98201..abf6261c 100644 --- a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml +++ b/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml @@ -4,5 +4,5 @@ namespace: ingress-traefik resources: - namespace.yaml - repository.yaml - # - release.yaml + - release.yaml From 6c1ddfa583059ba6cb9146871475451cde9bea70 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 02:07:34 +0200 Subject: [PATCH 04/15] Moved complex code to scripts folder in .github folder. --- .github/scripts/e2e-debug-failure.sh | 5 ++++ .../e2e-setup-cluster-reconciliation.sh | 8 ++++++ .../e2e-verify-cluster-reconcilitation.sh | 2 ++ .../e2e-verify-helm-reconcilitation copy.sh | 1 + .github/workflows/e2e-test.yaml | 27 ++++--------------- 5 files changed, 21 insertions(+), 22 deletions(-) create mode 100644 .github/scripts/e2e-debug-failure.sh create mode 100644 .github/scripts/e2e-setup-cluster-reconciliation.sh create mode 100644 .github/scripts/e2e-verify-cluster-reconcilitation.sh create mode 100644 .github/scripts/e2e-verify-helm-reconcilitation copy.sh diff --git a/.github/scripts/e2e-debug-failure.sh b/.github/scripts/e2e-debug-failure.sh new file mode 100644 index 00000000..9bf6af23 --- /dev/null +++ b/.github/scripts/e2e-debug-failure.sh @@ -0,0 +1,5 @@ +kubectl -n flux-system get all +kubectl -n flux-system logs deploy/source-controller +kubectl -n flux-system logs deploy/kustomize-controller +kubectl -n flux-system logs deploy/helm-controller +flux get all --all-namespaces \ No newline at end of file diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh new file mode 100644 index 00000000..688b7dca --- /dev/null +++ b/.github/scripts/e2e-setup-cluster-reconciliation.sh @@ -0,0 +1,8 @@ +flux create source git flux-system \ +--url=${{ github.event.repository.html_url }} \ +--branch=${{ steps.extract_branch.outputs.branch }} \ +--ignore-paths="./k8s/clusters/development/flux-system/" \ +--ignore-paths="./k8s/clusters/production/flux-system/" +flux create kustomization flux-system \ +--source=flux-system \ +--path=./k8s/clusters/development \ No newline at end of file diff --git a/.github/scripts/e2e-verify-cluster-reconcilitation.sh b/.github/scripts/e2e-verify-cluster-reconcilitation.sh new file mode 100644 index 00000000..424c7753 --- /dev/null +++ b/.github/scripts/e2e-verify-cluster-reconcilitation.sh @@ -0,0 +1,2 @@ +kubectl -n flux-system wait kustomization/infra-controllers --for=condition=ready --timeout=5m +kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=5m diff --git a/.github/scripts/e2e-verify-helm-reconcilitation copy.sh b/.github/scripts/e2e-verify-helm-reconcilitation copy.sh new file mode 100644 index 00000000..14fb0f58 --- /dev/null +++ b/.github/scripts/e2e-verify-helm-reconcilitation copy.sh @@ -0,0 +1 @@ +kubectl -n ingress-traefik wait helmrelease/ingress-traefik --for=condition=ready --timeout=5m \ No newline at end of file diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index f6923f9a..0fa06fcb 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -25,30 +25,13 @@ jobs: k3d-name: cluster-test github-token: ${{ secrets.GITHUB_TOKEN }} - name: Install Flux - run: | - flux install + run: flux install - name: Setup cluster reconciliation - run: | - flux create source git flux-system \ - --url=${{ github.event.repository.html_url }} \ - --branch=${{ steps.extract_branch.outputs.branch }} \ - --ignore-paths="./k8s/clusters/development/flux-system/" \ - --ignore-paths="./k8s/clusters/production/flux-system/" - flux create kustomization flux-system \ - --source=flux-system \ - --path=./k8s/clusters/development + run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh - name: Verify cluster reconciliation - run: | - kubectl -n flux-system wait kustomization/infra-controllers --for=condition=ready --timeout=5m - kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=5m + run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh - name: Verify helm reconciliation - run: | - kubectl -n ingress-traefik wait helmrelease/ingress-traefik --for=condition=ready --timeout=5m + run: ./.github/scripts/e2e-verify-helm-reconciliation.sh - name: Debug failure if: failure() - run: | - kubectl -n flux-system get all - kubectl -n flux-system logs deploy/source-controller - kubectl -n flux-system logs deploy/kustomize-controller - kubectl -n flux-system logs deploy/helm-controller - flux get all --all-namespaces \ No newline at end of file + run: ./.github/scripts/e2e-debug-failure.sh From 4efc36774ffb7477bfa24b0b1717ec9a4820487c Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 02:09:55 +0200 Subject: [PATCH 05/15] fix --- .github/workflows/e2e-test.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 0fa06fcb..bc6e01ba 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -28,10 +28,14 @@ jobs: run: flux install - name: Setup cluster reconciliation run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh + shell: bash - name: Verify cluster reconciliation run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh + shell: bash - name: Verify helm reconciliation run: ./.github/scripts/e2e-verify-helm-reconciliation.sh + shell: bash - name: Debug failure if: failure() run: ./.github/scripts/e2e-debug-failure.sh + shell: bash From 884391623bbde264f1de6661dff646aa6f1fdb5e Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 02:16:46 +0200 Subject: [PATCH 06/15] Fix permissions --- .github/scripts/e2e-debug-failure.sh | 0 .github/scripts/e2e-setup-cluster-reconciliation.sh | 0 .github/scripts/e2e-verify-cluster-reconcilitation.sh | 0 ...reconcilitation copy.sh => e2e-verify-helm-reconcilitation.sh} | 0 4 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 .github/scripts/e2e-debug-failure.sh mode change 100644 => 100755 .github/scripts/e2e-setup-cluster-reconciliation.sh mode change 100644 => 100755 .github/scripts/e2e-verify-cluster-reconcilitation.sh rename .github/scripts/{e2e-verify-helm-reconcilitation copy.sh => e2e-verify-helm-reconcilitation.sh} (100%) mode change 100644 => 100755 diff --git a/.github/scripts/e2e-debug-failure.sh b/.github/scripts/e2e-debug-failure.sh old mode 100644 new mode 100755 diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh old mode 100644 new mode 100755 diff --git a/.github/scripts/e2e-verify-cluster-reconcilitation.sh b/.github/scripts/e2e-verify-cluster-reconcilitation.sh old mode 100644 new mode 100755 diff --git a/.github/scripts/e2e-verify-helm-reconcilitation copy.sh b/.github/scripts/e2e-verify-helm-reconcilitation.sh old mode 100644 new mode 100755 similarity index 100% rename from .github/scripts/e2e-verify-helm-reconcilitation copy.sh rename to .github/scripts/e2e-verify-helm-reconcilitation.sh From ecff048a417601ec59de56096262db82c8e8c27d Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 03:44:49 +0200 Subject: [PATCH 07/15] Fix scripts --- .github/scripts/e2e-setup-cluster-reconciliation.sh | 7 +++++-- .github/workflows/e2e-test.yaml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh index 688b7dca..77b1851c 100755 --- a/.github/scripts/e2e-setup-cluster-reconciliation.sh +++ b/.github/scripts/e2e-setup-cluster-reconciliation.sh @@ -1,6 +1,9 @@ +repository_url=$1 +branch_name=$2 + flux create source git flux-system \ ---url=${{ github.event.repository.html_url }} \ ---branch=${{ steps.extract_branch.outputs.branch }} \ +--url=$repository_url \ +--branch=$branch_name \ --ignore-paths="./k8s/clusters/development/flux-system/" \ --ignore-paths="./k8s/clusters/production/flux-system/" flux create kustomization flux-system \ diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index bc6e01ba..ce29728f 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -27,7 +27,7 @@ jobs: - name: Install Flux run: flux install - name: Setup cluster reconciliation - run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh + run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh ${{ github.event.repository.html_url }} ${{ steps.extract_branch.outputs.branch }} shell: bash - name: Verify cluster reconciliation run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh From 094e176469d424d73260e150d51d898c0edf3c6e Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:04:36 +0200 Subject: [PATCH 08/15] Fix git-ignore paths --- .github/scripts/e2e-setup-cluster-reconciliation.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh index 77b1851c..76990f8d 100755 --- a/.github/scripts/e2e-setup-cluster-reconciliation.sh +++ b/.github/scripts/e2e-setup-cluster-reconciliation.sh @@ -2,10 +2,9 @@ repository_url=$1 branch_name=$2 flux create source git flux-system \ ---url=$repository_url \ ---branch=$branch_name \ ---ignore-paths="./k8s/clusters/development/flux-system/" \ ---ignore-paths="./k8s/clusters/production/flux-system/" -flux create kustomization flux-system \ ---source=flux-system \ ---path=./k8s/clusters/development \ No newline at end of file + --url=$repository_url \ + --branch=$branch_name \ + --ignore-paths="k8s/clusters/**/flux-system/" \ + flux create kustomization flux-system \ + --source=flux-system \ + --path=./k8s/clusters/development From aadc0e45ad1d48dac60c89e2d82990a423f0edaf Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:06:47 +0200 Subject: [PATCH 09/15] Added error handling to arguments for e2e-setup-cluster-reconciliation.sh --- .../e2e-setup-cluster-reconciliation.sh | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh index 76990f8d..6acf3cee 100755 --- a/.github/scripts/e2e-setup-cluster-reconciliation.sh +++ b/.github/scripts/e2e-setup-cluster-reconciliation.sh @@ -1,10 +1,22 @@ +if [ -z "$1" ] + then + echo "Error: 'repository_url' argument not set" + exit 1 +fi + +if [ -z "$2" ] + then + echo "Error: 'branch_name' argument not set" + exit 1 +fi + repository_url=$1 branch_name=$2 flux create source git flux-system \ - --url=$repository_url \ - --branch=$branch_name \ - --ignore-paths="k8s/clusters/**/flux-system/" \ - flux create kustomization flux-system \ - --source=flux-system \ - --path=./k8s/clusters/development + --url=$repository_url \ + --branch=$branch_name \ + --ignore-paths="k8s/clusters/**/flux-system/" \ + flux create kustomization flux-system \ + --source=flux-system \ + --path=./k8s/clusters/development From 68fe7866562be27c18f81d61f977b886934e0be9 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:11:22 +0200 Subject: [PATCH 10/15] fix --- .../e2e-setup-cluster-reconciliation.sh | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/scripts/e2e-setup-cluster-reconciliation.sh b/.github/scripts/e2e-setup-cluster-reconciliation.sh index 6acf3cee..ae9d70e7 100755 --- a/.github/scripts/e2e-setup-cluster-reconciliation.sh +++ b/.github/scripts/e2e-setup-cluster-reconciliation.sh @@ -1,22 +1,20 @@ -if [ -z "$1" ] - then - echo "Error: 'repository_url' argument not set" - exit 1 +if [ -z "$1" ]; then + echo "Error: 'repository_url' argument not set" + exit 1 fi -if [ -z "$2" ] - then - echo "Error: 'branch_name' argument not set" - exit 1 +if [ -z "$2" ]; then + echo "Error: 'branch_name' argument not set" + exit 1 fi repository_url=$1 branch_name=$2 flux create source git flux-system \ - --url=$repository_url \ - --branch=$branch_name \ - --ignore-paths="k8s/clusters/**/flux-system/" \ - flux create kustomization flux-system \ - --source=flux-system \ - --path=./k8s/clusters/development + --url=$repository_url \ + --branch=$branch_name \ + --ignore-paths="k8s/clusters/**/flux-system/" +flux create kustomization flux-system \ + --source=flux-system \ + --path=./k8s/clusters/development From a2ea74e2a63fecde461a7d1102e6247a42655cf6 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:12:44 +0200 Subject: [PATCH 11/15] remove unnecessary shell keys --- .github/workflows/e2e-test.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index ce29728f..62d8b668 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -16,7 +16,6 @@ jobs: - name: Setup Flux uses: fluxcd/flux2/action@main - name: Extract branch name - shell: bash run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT id: extract_branch - name: Setup Kubernetes @@ -28,14 +27,10 @@ jobs: run: flux install - name: Setup cluster reconciliation run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh ${{ github.event.repository.html_url }} ${{ steps.extract_branch.outputs.branch }} - shell: bash - name: Verify cluster reconciliation run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh - shell: bash - name: Verify helm reconciliation run: ./.github/scripts/e2e-verify-helm-reconciliation.sh - shell: bash - name: Debug failure if: failure() run: ./.github/scripts/e2e-debug-failure.sh - shell: bash From 87c2ddc8faf41e884eba36c7883cddfca17b9918 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:24:24 +0200 Subject: [PATCH 12/15] fix --- .github/workflows/e2e-test.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 62d8b668..0532e5ba 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -27,10 +27,14 @@ jobs: run: flux install - name: Setup cluster reconciliation run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh ${{ github.event.repository.html_url }} ${{ steps.extract_branch.outputs.branch }} + shell: bash - name: Verify cluster reconciliation run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh + shell: bash - name: Verify helm reconciliation run: ./.github/scripts/e2e-verify-helm-reconciliation.sh + shell: bash - name: Debug failure if: failure() run: ./.github/scripts/e2e-debug-failure.sh + shell: bash From fb6006be80a9c30ff27fddb0d2b46b43eaf9d223 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:27:42 +0200 Subject: [PATCH 13/15] fix names --- ...econcilitation.sh => e2e-verify-cluster-reconciliation.sh} | 0 ...m-reconcilitation.sh => e2e-verify-helm-reconciliation.sh} | 0 .github/workflows/e2e-test.yaml | 4 ---- 3 files changed, 4 deletions(-) rename .github/scripts/{e2e-verify-cluster-reconcilitation.sh => e2e-verify-cluster-reconciliation.sh} (100%) rename .github/scripts/{e2e-verify-helm-reconcilitation.sh => e2e-verify-helm-reconciliation.sh} (100%) diff --git a/.github/scripts/e2e-verify-cluster-reconcilitation.sh b/.github/scripts/e2e-verify-cluster-reconciliation.sh similarity index 100% rename from .github/scripts/e2e-verify-cluster-reconcilitation.sh rename to .github/scripts/e2e-verify-cluster-reconciliation.sh diff --git a/.github/scripts/e2e-verify-helm-reconcilitation.sh b/.github/scripts/e2e-verify-helm-reconciliation.sh similarity index 100% rename from .github/scripts/e2e-verify-helm-reconcilitation.sh rename to .github/scripts/e2e-verify-helm-reconciliation.sh diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml index 0532e5ba..62d8b668 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e-test.yaml @@ -27,14 +27,10 @@ jobs: run: flux install - name: Setup cluster reconciliation run: ./.github/scripts/e2e-setup-cluster-reconciliation.sh ${{ github.event.repository.html_url }} ${{ steps.extract_branch.outputs.branch }} - shell: bash - name: Verify cluster reconciliation run: ./.github/scripts/e2e-verify-cluster-reconciliation.sh - shell: bash - name: Verify helm reconciliation run: ./.github/scripts/e2e-verify-helm-reconciliation.sh - shell: bash - name: Debug failure if: failure() run: ./.github/scripts/e2e-debug-failure.sh - shell: bash From b07da69ea0fd6a85b09f08f1eb0be8f4c352ff43 Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 12:35:41 +0200 Subject: [PATCH 14/15] rename github action file --- .github/workflows/{e2e-test.yaml => e2e.yaml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{e2e-test.yaml => e2e.yaml} (97%) diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e.yaml similarity index 97% rename from .github/workflows/e2e-test.yaml rename to .github/workflows/e2e.yaml index 62d8b668..1b1bb9bd 100644 --- a/.github/workflows/e2e-test.yaml +++ b/.github/workflows/e2e.yaml @@ -11,7 +11,7 @@ jobs: end-to-end-test: runs-on: ubuntu-latest steps: - - name: Checkout + - name: Checkout repository uses: actions/checkout@v3 - name: Setup Flux uses: fluxcd/flux2/action@main From cd3da2936caae14ac3d773a35f08449e72aa7e0f Mon Sep 17 00:00:00 2001 From: devantler Date: Tue, 25 Jul 2023 16:37:50 +0200 Subject: [PATCH 15/15] Removed everything but the base setup that I like --- .../e2e-verify-cluster-reconciliation.sh | 2 +- .../scripts/e2e-verify-helm-reconciliation.sh | 2 +- k8s/clusters/development/apps.yaml | 2 +- k8s/clusters/development/infrastructure.yaml | 29 ++----------------- k8s/clusters/production/apps.yaml | 15 ++++++++++ k8s/clusters/production/infrastructure.yaml | 15 ++++++++++ k8s/infrastructure/base/.gitkeep | 0 .../configs/cluster-issuers.yaml | 16 ---------- .../configs/network-policies.yaml | 14 --------- .../ingress-traefik/kustomization.yaml | 8 ----- .../ingress-traefik/namespace.yaml | 4 --- .../controllers/ingress-traefik/release.yaml | 14 --------- .../ingress-traefik/repository.yaml | 7 ----- .../{controllers => }/kustomization.yaml | 3 +- .../development}/kustomization.yaml | 4 +-- .../overlays/production/kustomization.yaml | 3 ++ 16 files changed, 41 insertions(+), 97 deletions(-) create mode 100644 k8s/clusters/production/apps.yaml create mode 100644 k8s/clusters/production/infrastructure.yaml create mode 100644 k8s/infrastructure/base/.gitkeep delete mode 100644 k8s/infrastructure/configs/cluster-issuers.yaml delete mode 100644 k8s/infrastructure/configs/network-policies.yaml delete mode 100644 k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml delete mode 100644 k8s/infrastructure/controllers/ingress-traefik/namespace.yaml delete mode 100644 k8s/infrastructure/controllers/ingress-traefik/release.yaml delete mode 100644 k8s/infrastructure/controllers/ingress-traefik/repository.yaml rename k8s/infrastructure/{controllers => }/kustomization.yaml (68%) rename k8s/infrastructure/{configs => overlays/development}/kustomization.yaml (50%) create mode 100644 k8s/infrastructure/overlays/production/kustomization.yaml diff --git a/.github/scripts/e2e-verify-cluster-reconciliation.sh b/.github/scripts/e2e-verify-cluster-reconciliation.sh index 424c7753..f0a5cf97 100755 --- a/.github/scripts/e2e-verify-cluster-reconciliation.sh +++ b/.github/scripts/e2e-verify-cluster-reconciliation.sh @@ -1,2 +1,2 @@ -kubectl -n flux-system wait kustomization/infra-controllers --for=condition=ready --timeout=5m +kubectl -n flux-system wait kustomization/infrastructure --for=condition=ready --timeout=5m kubectl -n flux-system wait kustomization/apps --for=condition=ready --timeout=5m diff --git a/.github/scripts/e2e-verify-helm-reconciliation.sh b/.github/scripts/e2e-verify-helm-reconciliation.sh index 14fb0f58..2118dcf9 100755 --- a/.github/scripts/e2e-verify-helm-reconciliation.sh +++ b/.github/scripts/e2e-verify-helm-reconciliation.sh @@ -1 +1 @@ -kubectl -n ingress-traefik wait helmrelease/ingress-traefik --for=condition=ready --timeout=5m \ No newline at end of file +# kubectl -n ingress-traefik wait helmrelease/ingress-traefik --for=condition=ready --timeout=5m diff --git a/k8s/clusters/development/apps.yaml b/k8s/clusters/development/apps.yaml index 6117afab..2feb6415 100644 --- a/k8s/clusters/development/apps.yaml +++ b/k8s/clusters/development/apps.yaml @@ -6,7 +6,7 @@ metadata: spec: interval: 10m dependsOn: - - name: infra-configs + - name: infrastructure sourceRef: kind: GitRepository name: flux-system diff --git a/k8s/clusters/development/infrastructure.yaml b/k8s/clusters/development/infrastructure.yaml index 2dc38c98..ae00383c 100644 --- a/k8s/clusters/development/infrastructure.yaml +++ b/k8s/clusters/development/infrastructure.yaml @@ -1,7 +1,7 @@ apiVersion: kustomize.toolkit.fluxcd.io/v1 kind: Kustomization metadata: - name: infra-controllers + name: infrastructure namespace: flux-system spec: interval: 1h @@ -9,30 +9,7 @@ spec: sourceRef: kind: GitRepository name: flux-system - path: ./k8s/infrastructure/controllers + path: ./k8s/infrastructure/overlays/development prune: true wait: true ---- -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - name: infra-configs - namespace: flux-system -spec: - dependsOn: - - name: infra-controllers - interval: 1h - retryInterval: 1m - sourceRef: - kind: GitRepository - name: flux-system - path: ./k8s/infrastructure/configs - prune: true - patches: - - patch: | - - op: replace - path: /spec/acme/server - value: https://acme-staging-v02.api.letsencrypt.org/directory - target: - kind: ClusterIssuer - name: letsencrypt + diff --git a/k8s/clusters/production/apps.yaml b/k8s/clusters/production/apps.yaml new file mode 100644 index 00000000..a3d2e396 --- /dev/null +++ b/k8s/clusters/production/apps.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: apps + namespace: flux-system +spec: + interval: 10m + dependsOn: + - name: infrastructure + sourceRef: + kind: GitRepository + name: flux-system + path: ./k8s/apps/overlays/production + prune: true + wait: true diff --git a/k8s/clusters/production/infrastructure.yaml b/k8s/clusters/production/infrastructure.yaml new file mode 100644 index 00000000..9e448421 --- /dev/null +++ b/k8s/clusters/production/infrastructure.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: infrastructure + namespace: flux-system +spec: + interval: 1h + retryInterval: 1m + sourceRef: + kind: GitRepository + name: flux-system + path: ./k8s/infrastructure/overlays/production + prune: true + wait: true + diff --git a/k8s/infrastructure/base/.gitkeep b/k8s/infrastructure/base/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/k8s/infrastructure/configs/cluster-issuers.yaml b/k8s/infrastructure/configs/cluster-issuers.yaml deleted file mode 100644 index a6ea00ff..00000000 --- a/k8s/infrastructure/configs/cluster-issuers.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: cert-manager.io/v1 -kind: ClusterIssuer -metadata: - name: letsencrypt -spec: - acme: - # Replace the email address with your own contact email - email: cluster@devantler.com - # The server is replaced in /clusters/production/infrastructure.yaml - server: https://acme-staging-v02.api.letsencrypt.org/directory - privateKeySecretRef: - name: letsencrypt-traefik - solvers: - - http01: - ingress: - class: traefik \ No newline at end of file diff --git a/k8s/infrastructure/configs/network-policies.yaml b/k8s/infrastructure/configs/network-policies.yaml deleted file mode 100644 index 26acf412..00000000 --- a/k8s/infrastructure/configs/network-policies.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: weave-gitops-ingress - namespace: flux-system -spec: - policyTypes: - - Ingress - ingress: - - from: - - namespaceSelector: {} - podSelector: - matchLabels: - app.kubernetes.io/name: weave-gitops \ No newline at end of file diff --git a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml b/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml deleted file mode 100644 index abf6261c..00000000 --- a/k8s/infrastructure/controllers/ingress-traefik/kustomization.yaml +++ /dev/null @@ -1,8 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization -namespace: ingress-traefik -resources: - - namespace.yaml - - repository.yaml - - release.yaml - diff --git a/k8s/infrastructure/controllers/ingress-traefik/namespace.yaml b/k8s/infrastructure/controllers/ingress-traefik/namespace.yaml deleted file mode 100644 index aedf6c4e..00000000 --- a/k8s/infrastructure/controllers/ingress-traefik/namespace.yaml +++ /dev/null @@ -1,4 +0,0 @@ -apiVersion: v1 -kind: Namespace -metadata: - name: ingress-traefik \ No newline at end of file diff --git a/k8s/infrastructure/controllers/ingress-traefik/release.yaml b/k8s/infrastructure/controllers/ingress-traefik/release.yaml deleted file mode 100644 index 9da9dca1..00000000 --- a/k8s/infrastructure/controllers/ingress-traefik/release.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease -metadata: - name: ingress-traefik -spec: - interval: 30m - chart: - spec: - chart: traefik - version: "*" - sourceRef: - kind: HelmRepository - name: ingress-traefik - interval: 12h diff --git a/k8s/infrastructure/controllers/ingress-traefik/repository.yaml b/k8s/infrastructure/controllers/ingress-traefik/repository.yaml deleted file mode 100644 index 1c42b2c4..00000000 --- a/k8s/infrastructure/controllers/ingress-traefik/repository.yaml +++ /dev/null @@ -1,7 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmRepository -metadata: - name: ingress-traefik -spec: - interval: 24h - url: https://traefik.github.io/charts \ No newline at end of file diff --git a/k8s/infrastructure/controllers/kustomization.yaml b/k8s/infrastructure/kustomization.yaml similarity index 68% rename from k8s/infrastructure/controllers/kustomization.yaml rename to k8s/infrastructure/kustomization.yaml index 3dd73a9c..419dcad1 100644 --- a/k8s/infrastructure/controllers/kustomization.yaml +++ b/k8s/infrastructure/kustomization.yaml @@ -1,4 +1,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -resources: - - ingress-traefik \ No newline at end of file +resources: [] \ No newline at end of file diff --git a/k8s/infrastructure/configs/kustomization.yaml b/k8s/infrastructure/overlays/development/kustomization.yaml similarity index 50% rename from k8s/infrastructure/configs/kustomization.yaml rename to k8s/infrastructure/overlays/development/kustomization.yaml index 19f36876..419dcad1 100644 --- a/k8s/infrastructure/configs/kustomization.yaml +++ b/k8s/infrastructure/overlays/development/kustomization.yaml @@ -1,5 +1,3 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization -resources: - # - cluster-issuers.yaml - - network-policies.yaml \ No newline at end of file +resources: [] \ No newline at end of file diff --git a/k8s/infrastructure/overlays/production/kustomization.yaml b/k8s/infrastructure/overlays/production/kustomization.yaml new file mode 100644 index 00000000..419dcad1 --- /dev/null +++ b/k8s/infrastructure/overlays/production/kustomization.yaml @@ -0,0 +1,3 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: [] \ No newline at end of file