mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 17:07:04 +02:00
feat(common): Release 2.0.0-beta.2 (#176)
This commit is contained in:
parent
ed407c00df
commit
9928235b84
80 changed files with 1306 additions and 161 deletions
|
@ -0,0 +1,89 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: networkPolicy metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
notExists:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
|
||||
- it: custom metadata should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
||||
|
||||
- it: custom metadata with global metadata should pass
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
global_label: test
|
||||
annotations:
|
||||
global_annotation: test
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
global_label: test
|
||||
helm.sh/chart: common-test-1.0.0
|
||||
test_label: test
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: networkPolicy names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: custom name suffix should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
nameOverride: block-ingress
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-block-ingress
|
|
@ -0,0 +1,36 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: NetworkPolicy validations
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: networkpolicy requires either controller reference or podSelector
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
controller: ""
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "controller reference or podSelector is required for NetworkPolicy. (NetworkPolicy main)"
|
||||
|
||||
- it: policyTypes is required
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
policyTypes: []
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "policyTypes is required for NetworkPolicy. (NetworkPolicy main)"
|
||||
|
||||
- it: policyTypes values check
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
policyTypes:
|
||||
- test
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "Not a valid policyType for NetworkPolicy. (NetworkPolicy main, value test)"
|
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: NetworkPolicy values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: main networkpolicy is disabled by default
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Service
|
||||
|
||||
- it: main networkpolicy can be enabled
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
|
||||
- it: networkpolicy targets the correct controller
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
controller: main
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: spec.podSelector
|
||||
value:
|
||||
matchLabels:
|
||||
app.kubernetes.io/component: main
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/name: RELEASE-NAME
|
||||
|
||||
- it: networkpolicy targets supports custom podSelector
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
controller: main
|
||||
podSelector: {}
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: spec.podSelector
|
||||
value: {}
|
||||
|
||||
- it: networkpolicy rules are passed through
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
enabled: true
|
||||
controller: main
|
||||
rules:
|
||||
ingress:
|
||||
- {}
|
||||
egress:
|
||||
- {}
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: spec.ingress
|
||||
value:
|
||||
- {}
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: spec.egress
|
||||
value:
|
||||
- {}
|
Loading…
Add table
Add a link
Reference in a new issue