mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 17:07:04 +02:00
feat(common)!: Migrate library chart
This commit is contained in:
parent
49ebc2bb2f
commit
a1a80f5ff5
59 changed files with 499 additions and 885 deletions
81
charts/other/common-chart/tests/service/metadata_test.yaml
Normal file
81
charts/other/common-chart/tests/service/metadata_test.yaml
Normal file
|
@ -0,0 +1,81 @@
|
|||
suite: service metadata
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default metadata should pass
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-chart
|
||||
helm.sh/chart: common-chart-0.1.0
|
||||
|
||||
- it: custom metadata should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
test_annotation: test
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-chart
|
||||
helm.sh/chart: common-chart-0.1.0
|
||||
test_label: test
|
||||
|
||||
- it: custom metadata with global metadata should pass
|
||||
set:
|
||||
global:
|
||||
labels:
|
||||
global_label: test
|
||||
annotations:
|
||||
global_annotation: test
|
||||
service:
|
||||
main:
|
||||
annotations:
|
||||
test_annotation: test
|
||||
labels:
|
||||
test_label: test
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
global_annotation: test
|
||||
test_annotation: test
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.labels
|
||||
value:
|
||||
app.kubernetes.io/instance: RELEASE-NAME
|
||||
app.kubernetes.io/managed-by: Helm
|
||||
app.kubernetes.io/name: common-chart
|
||||
global_label: test
|
||||
helm.sh/chart: common-chart-0.1.0
|
||||
test_label: test
|
29
charts/other/common-chart/tests/service/names_test.yaml
Normal file
29
charts/other/common-chart/tests/service/names_test.yaml
Normal file
|
@ -0,0 +1,29 @@
|
|||
suite: service names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-chart
|
||||
|
||||
- it: custom name suffix should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
nameOverride: http
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.name
|
||||
value: RELEASE-NAME-common-chart-http
|
63
charts/other/common-chart/tests/service/port_names_test.yaml
Normal file
63
charts/other/common-chart/tests/service/port_names_test.yaml
Normal file
|
@ -0,0 +1,63 @@
|
|||
suite: service port names
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: http
|
||||
port: null
|
||||
protocol: TCP
|
||||
targetPort: http
|
||||
|
||||
- it: custom name should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: false
|
||||
server:
|
||||
enabled: true
|
||||
port: 8080
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: server
|
||||
port: 8080
|
||||
protocol: TCP
|
||||
targetPort: server
|
||||
|
||||
- it: custom target port should pass
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
ports:
|
||||
http:
|
||||
enabled: true
|
||||
targetPort: 80
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0]
|
||||
value:
|
||||
name: http
|
||||
port: null
|
||||
protocol: TCP
|
||||
targetPort: 80
|
|
@ -0,0 +1,71 @@
|
|||
suite: service protocols
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: default should pass
|
||||
asserts:
|
||||
- hasDocuments:
|
||||
count: 2
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
|
||||
- it: explicit TCP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: TCP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
|
||||
- it: explicit UDP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: UDP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: UDP
|
||||
|
||||
- it: explicit HTTP should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: HTTP
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
- documentIndex: *ServiceDocument
|
||||
isNull:
|
||||
path: metadata.annotations
|
||||
|
||||
- it: explicit HTTPS should pass
|
||||
set:
|
||||
service.main.ports.http.protocol: HTTPS
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.ports[0].protocol
|
||||
value: TCP
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: metadata.annotations
|
||||
value:
|
||||
traefik.ingress.kubernetes.io/service.serversscheme: https
|
33
charts/other/common-chart/tests/service/values_test.yaml
Normal file
33
charts/other/common-chart/tests/service/values_test.yaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
suite: service values
|
||||
templates:
|
||||
- common.yaml
|
||||
tests:
|
||||
- it: externalTrafficPolicy should pass for NodePort service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: NodePort
|
||||
externalTrafficPolicy: Local
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.externalTrafficPolicy
|
||||
value: Local
|
||||
|
||||
- it: externalTrafficPolicy should pass for LoadBalancer service
|
||||
set:
|
||||
service:
|
||||
main:
|
||||
type: LoadBalancer
|
||||
externalTrafficPolicy: Local
|
||||
asserts:
|
||||
- documentIndex: &ServiceDocument 1
|
||||
isKind:
|
||||
of: Service
|
||||
- documentIndex: *ServiceDocument
|
||||
equal:
|
||||
path: spec.externalTrafficPolicy
|
||||
value: Local
|
Loading…
Add table
Add a link
Reference in a new issue