Skip to content

Commit

Permalink
Add exclude config to chart
Browse files Browse the repository at this point in the history
  • Loading branch information
phillebaba committed Nov 16, 2020
1 parent a777187 commit c049399
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 4 deletions.
4 changes: 2 additions & 2 deletions charts/gatekeeper-library-constraints/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: gatekeeper-library-constraints
description: Library of gateeper constraints
home: https://github.com/xenitab/gatekeeper-library
type: application
version: v0.3.0
appVersion: v0.3.0
version: v0.4.0
appVersion: v0.4.0
7 changes: 7 additions & 0 deletions charts/gatekeeper-library-constraints/templates/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: config.gatekeeper.sh/v1alpha1
kind: Config
metadata:
name: config
spec:
match:
{{- toYaml .Values.exclude | nindent 4 }}
16 changes: 16 additions & 0 deletions charts/gatekeeper-library-constraints/tests/basic_test.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
suite: basic
templates:
- constraint.yaml
- config.yaml
tests:
- it: should work
set:
Expand All @@ -11,8 +12,23 @@ tests:
annotations:
- key: "foo"
allowedRegex: "bar"
exclude:
- excludedNamespaces: ["kube-system", "gatekeeper-system"]
processes: ["*"]
asserts:
- equal:
path: metadata.name
value: foobar
template: constraint.yaml
- equal:
path: metadata.name
value: config
template: config.yaml
- equal:
path: spec.match[0].excludedNamespaces
value: ["kube-system", "gatekeeper-system"]
template: config.yaml
- equal:
path: spec.match[0].processes
value: ["*"]
template: config.yaml
4 changes: 4 additions & 0 deletions charts/gatekeeper-library-constraints/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@ constraints: []
# annotations:
# - key: "foo"
# allowedRegex: "bar"

exclude:
- excludedNamespaces: ["kube-system", "gatekeeper-system"]
processes: ["*"]
4 changes: 2 additions & 2 deletions charts/gatekeeper-library-templates/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ name: gatekeeper-library-templates
description: Library of gateeper constraints
home: https://github.com/xenitab/gatekeeper-library
type: application
version: v0.3.0
appVersion: v0.3.0
version: v0.4.0
appVersion: v0.4.0

0 comments on commit c049399

Please sign in to comment.