mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 17:07:04 +02:00
feat(common): Release common library 3.7.1 (#383)
Co-authored-by: Aisling McGinn <me@aisling.dev>
This commit is contained in:
parent
c94a28baa3
commit
433f6d132b
146 changed files with 232 additions and 222 deletions
|
@ -0,0 +1,94 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: networkPolicy metadata
|
||||
|
||||
set:
|
||||
networkpolicies.main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
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:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
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:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
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,85 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: networkPolicy names
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME
|
||||
|
||||
- it: custom name suffix should pass
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
nameOverride: block-ingress
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-block-ingress
|
||||
|
||||
- it: multiple networkpolicies can be enabled
|
||||
set:
|
||||
networkpolicies:
|
||||
primary:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
secondary:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 3
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: &firstNetworkPolicyDocument 1
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *firstNetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-primary
|
||||
- documentIndex: 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: &secondNetworkPolicyDocument 2
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *secondNetworkPolicyDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-secondary
|
|
@ -0,0 +1,40 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: NetworkPolicy validations
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: networkpolicy requires either controller reference or podSelector
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: ""
|
||||
rules: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "controller reference or podSelector is required for NetworkPolicy. (NetworkPolicy main)"
|
||||
|
||||
- it: policyTypes is required
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes: []
|
||||
rules: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "policyTypes is required for NetworkPolicy. (NetworkPolicy main)"
|
||||
|
||||
- it: policyTypes values check
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- test
|
||||
rules: {}
|
||||
asserts:
|
||||
- failedTemplate:
|
||||
errorMessage: "Not a valid policyType for NetworkPolicy. (NetworkPolicy main, value test)"
|
|
@ -0,0 +1,103 @@
|
|||
---
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/helm-unittest/helm-unittest/main/schema/helm-testsuite.json
|
||||
suite: NetworkPolicy values
|
||||
templates:
|
||||
- common.yaml
|
||||
values:
|
||||
- ../_values/controllers_main_default_container.yaml
|
||||
tests:
|
||||
- it: main networkpolicy is disabled by default
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 1
|
||||
- documentIndex: 0
|
||||
not: true
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
|
||||
- it: main networkpolicy can be enabled
|
||||
set:
|
||||
networkpolicies.main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: 0
|
||||
isKind:
|
||||
of: Deployment
|
||||
- documentIndex: 1
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
|
||||
- it: networkpolicy targets the correct controller
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules: {}
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
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:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
podSelector: {}
|
||||
rules: {}
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
isKind:
|
||||
of: NetworkPolicy
|
||||
- documentIndex: *NetworkPolicyDocument
|
||||
equal:
|
||||
path: spec.podSelector
|
||||
value: {}
|
||||
|
||||
- it: networkpolicy rules are passed through
|
||||
set:
|
||||
networkpolicies:
|
||||
main:
|
||||
controller: main
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
rules:
|
||||
ingress:
|
||||
- {}
|
||||
egress:
|
||||
- {}
|
||||
asserts:
|
||||
- documentIndex: &NetworkPolicyDocument 1
|
||||
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