Skip to content

Commit

Permalink
e2e: Add Flux appliers tests
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Prodan <[email protected]>
  • Loading branch information
stefanprodan committed Feb 3, 2024
1 parent cb7cbbe commit a43ef8b
Show file tree
Hide file tree
Showing 5 changed files with 113 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
kubernetes:
- v1.29.0
flux:
- v2.2
- v2.2.2
runs-on: ubuntu-latest
permissions:
contents: read
Expand All @@ -32,6 +32,8 @@ jobs:
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup Flux
uses: fluxcd/flux2/action@5c5c15ea212b8f029a110f9975851d25c8272695 #v2.2.2
with:
version: ${{ matrix.flux }}
- name: Setup Kubernetes
uses: helm/kind-action@dda0770415bac9fc20092cacbc54aa298604d140 # v1.8.0
with:
Expand All @@ -53,6 +55,9 @@ jobs:
- name: Verify images
run: kubectl -n flux-system get deployments.apps -o yaml | grep ${{ matrix.variant }}
- name: Setup cluster reconciliation
env:
FLUX_VERSION: ${{ matrix.flux }}
shell: bash
run: |
flux create source git flux-system \
--url=${{ github.event.repository.html_url }} \
Expand All @@ -62,10 +67,11 @@ jobs:
--ignore-paths="clusters/**/flux-system/"
flux create kustomization flux-system \
--source=flux-system \
--path=./tests/${{ matrix.flux }}/clusters/kind
--path=./tests/${FLUX_VERSION:0:4}/clusters/kind
- name: Verify cluster reconciliation
run: |
kubectl -n flux-system wait kustomization/sources --for=condition=ready --timeout=2m
kubectl -n flux-system wait kustomization/appliers --for=condition=ready --timeout=2m
- name: Verify managed resources
run: |
flux tree kustomization flux-system
Expand Down
45 changes: 45 additions & 0 deletions tests/v2.2/appliers/helm-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: podinfo
namespace: appliers
spec:
type: oci
interval: 10m
url: oci://ghcr.io/stefanprodan/charts
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: podinfo
namespace: appliers
spec:
interval: 10m
timeout: 2m
chart:
spec:
chart: podinfo
version: ">1.0.0"
sourceRef:
kind: HelmRepository
name: podinfo
interval: 50m
releaseName: podinfo-helm
install:
crds: CreateReplace
remediation:
retries: 3
upgrade:
remediation:
retries: 3
test:
enable: false
driftDetection:
mode: enabled
ignore:
- paths: ["/spec/replicas"]
target:
kind: Deployment
values:
replicaCount: 2
36 changes: 36 additions & 0 deletions tests/v2.2/appliers/kustomize-sync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: OCIRepository
metadata:
name: podinfo
namespace: appliers
spec:
interval: 10m
url: oci://ghcr.io/stefanprodan/manifests/podinfo
ref:
semver: ">1.0.0"
ignore: |
# exclude all
/*
# include deployment and service
!deployment.yaml
!service.yaml
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: podinfo
namespace: appliers
spec:
interval: 10m
wait: true
timeout: 2m
retryInterval: 5m
prune: true
force: false
targetNamespace: appliers
sourceRef:
kind: OCIRepository
name: podinfo
namespace: appliers
path: "./"
6 changes: 6 additions & 0 deletions tests/v2.2/appliers/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: appliers

18 changes: 18 additions & 0 deletions tests/v2.2/clusters/kind/appliers.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: appliers
namespace: flux-system
spec:
dependsOn:
- name: sources
serviceAccountName: kustomize-controller
interval: 10m
sourceRef:
kind: GitRepository
name: flux-system
path: ./tests/v2.2/appliers
prune: true
wait: true
timeout: 5m

0 comments on commit a43ef8b

Please sign in to comment.