feat(common)!: Migrate library chart

This commit is contained in:
Bᴇʀɴᴅ Sᴄʜᴏʀɢᴇʀs 2022-08-07 11:45:41 +02:00
parent 49ebc2bb2f
commit a1a80f5ff5
No known key found for this signature in database
GPG key ID: BC5E2BD907F9A8EC
59 changed files with 499 additions and 885 deletions

View 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

View 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

View 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

View file

@ -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

View 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