-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly handle kustomization namespace for flux test (#247)
Issue #245 ``` $ flux-local test -v --path tests/testdata/cluster5/ ======================================= test session starts ======================================== collected 1 item tests/testdata/cluster5/clusters/prod::flux-system::kustomization PASSED [100%] ======================================== 1 passed in 0.10s ========================================= ``` ``` $ flux-local test -v -A --path tests/testdata/cluster5/ ======================================= test session starts ======================================== collected 3 items tests/testdata/cluster5/clusters/prod::infra-configs::kustomization PASSED [ 33%] tests/testdata/cluster5/clusters/prod::infra-controllers::kustomization PASSED [ 66%] tests/testdata/cluster5/clusters/prod::flux-system::kustomization PASSED [100%] ======================================== 3 passed in 0.30s =========================================
- Loading branch information
1 parent
e823bb3
commit 4fe641b
Showing
11 changed files
with
177 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
This repo has kustomizations that are not in the flux-system namespace. |
26 changes: 26 additions & 0 deletions
26
tests/testdata/cluster5/clusters/prod/flux-system/gotk-sync.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta1 | ||
kind: GitRepository | ||
metadata: | ||
name: flux-system | ||
namespace: flux-system | ||
spec: | ||
interval: 1m0s | ||
ref: | ||
branch: main | ||
secretRef: | ||
name: flux-system | ||
url: ssh://[email protected]/allenporter/flux-local | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: flux-system | ||
namespace: flux-system | ||
spec: | ||
interval: 10m0s | ||
path: ./tests/testdata/cluster5/clusters/prod | ||
prune: true | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system |
5 changes: 5 additions & 0 deletions
5
tests/testdata/cluster5/clusters/prod/flux-system/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- gotk-sync.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: infra-controllers | ||
namespace: controllers | ||
spec: | ||
interval: 1h | ||
retryInterval: 1m | ||
timeout: 5m | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system | ||
path: ./tests/testdata/cluster5/infrastructure/controllers | ||
prune: true | ||
wait: true | ||
--- | ||
apiVersion: kustomize.toolkit.fluxcd.io/v1beta2 | ||
kind: Kustomization | ||
metadata: | ||
name: infra-configs | ||
namespace: configs | ||
spec: | ||
dependsOn: | ||
- name: infra-controllers | ||
interval: 1h | ||
retryInterval: 1m | ||
timeout: 5m | ||
sourceRef: | ||
kind: GitRepository | ||
name: flux-system | ||
path: ./tests/testdata/cluster5/infrastructure/configs | ||
prune: true |
25 changes: 25 additions & 0 deletions
25
tests/testdata/cluster5/infrastructure/configs/cluster-policies.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: test-allow-policy | ||
annotations: | ||
policies.kyverno.io/title: Test Allow Policy | ||
policies.kyverno.io/description: >- | ||
Policy that is expected to allow resources under test through since no | ||
resources should have this annotation. | ||
spec: | ||
validationFailureAction: audit | ||
background: true | ||
rules: | ||
- name: forbid-test-annotation | ||
match: | ||
resources: | ||
kinds: | ||
- ConfigMap | ||
validate: | ||
message: "Found test-annotation" | ||
pattern: | ||
metadata: | ||
=(annotations): | ||
X(flux-local/test-annotation): "null" |
31 changes: 31 additions & 0 deletions
31
tests/testdata/cluster5/infrastructure/configs/helm-repositories.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta2 | ||
kind: HelmRepository | ||
metadata: | ||
name: bitnami | ||
namespace: flux-system | ||
spec: | ||
interval: 30m | ||
provider: generic | ||
timeout: 1m0s | ||
url: https://charts.bitnami.com/bitnami | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta2 | ||
kind: HelmRepository | ||
metadata: | ||
name: podinfo | ||
namespace: flux-system | ||
spec: | ||
interval: 5m | ||
type: oci | ||
url: oci://ghcr.io/stefanprodan/charts | ||
--- | ||
apiVersion: source.toolkit.fluxcd.io/v1beta2 | ||
kind: HelmRepository | ||
metadata: | ||
name: weave-charts | ||
namespace: flux-system | ||
spec: | ||
interval: 120m | ||
type: oci | ||
url: oci://ghcr.io/weaveworks/charts |
6 changes: 6 additions & 0 deletions
6
tests/testdata/cluster5/infrastructure/configs/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- cluster-policies.yaml | ||
- helm-repositories.yaml |
6 changes: 6 additions & 0 deletions
6
tests/testdata/cluster5/infrastructure/controllers/kustomization.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
apiVersion: kustomize.config.k8s.io/v1beta1 | ||
kind: Kustomization | ||
resources: | ||
- metallb-release.yaml | ||
- weave-gitops-release.yaml |
27 changes: 27 additions & 0 deletions
27
tests/testdata/cluster5/infrastructure/controllers/metallb-release.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: metallb | ||
namespace: metallb | ||
spec: | ||
chart: | ||
spec: | ||
chart: metallb | ||
reconcileStrategy: ChartVersion | ||
sourceRef: | ||
kind: HelmRepository | ||
name: bitnami | ||
namespace: flux-system | ||
version: 4.1.14 | ||
install: | ||
crds: CreateReplace | ||
remediation: | ||
retries: 3 | ||
interval: 5m | ||
releaseName: metallb | ||
upgrade: | ||
crds: CreateReplace | ||
values: | ||
speaker: | ||
secretName: "metallb-secret" |
16 changes: 16 additions & 0 deletions
16
tests/testdata/cluster5/infrastructure/controllers/weave-gitops-release.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: weave-gitops | ||
namespace: flux-system | ||
spec: | ||
interval: 60m | ||
chart: | ||
spec: | ||
chart: weave-gitops | ||
version: "4.0.22" | ||
sourceRef: | ||
kind: HelmRepository | ||
name: weave-charts | ||
interval: 12h |