rancher-charts/charts/rancher-external-ip-webhook/0.1.601/tests/deployment_test.yaml

202 lines
5.9 KiB
YAML

suite: Test Deployments
templates:
- deployment.yaml
tests:
- it: should render Deployment with allowed-external-ip-cidrs arg if allowedExternalIPCidrs is set
release:
name: rancher-externalip-webhook
set:
allowedExternalIPCidrs: "1,2"
asserts:
- equal:
path: spec.template.spec.containers[0].args[1]
value: --allowed-external-ip-cidrs=1,2
- it: should render Deployment with default port, nodeSelector and tolerations if metrics.enabled = false and metrics.authProxy.enabled = false
release:
name: rancher-externalip-webhook
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 9443
name: webhook-server
protocol: TCP
- equal:
path: spec.template.spec.tolerations[0]
value:
key: "cattle.io/os"
value: "linux"
effect: "NoSchedule"
operator: "Equal"
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux
- it: should render Deployment with default port and custom nodeSelector and tolerations if metrics.enabled = false and metrics.authProxy.enabled = false
release:
name: rancher-externalip-webhook
set:
tolerations:
- key: "cattle.io/test"
value: "linux"
effect: "NoSchedule"
operator: "Equal"
nodeSelector:
kubernetes.io/test: linux
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 9443
name: webhook-server
protocol: TCP
- equal:
path: spec.template.spec.tolerations[0]
value:
key: "cattle.io/os"
value: "linux"
effect: "NoSchedule"
operator: "Equal"
- equal:
path: spec.template.spec.tolerations[1]
value:
key: "cattle.io/test"
value: "linux"
effect: "NoSchedule"
operator: "Equal"
- equal:
path: spec.template.spec.nodeSelector
value:
kubernetes.io/os: linux
kubernetes.io/test: linux
- it: should render Deployment with custom port and image if metrics.enabled = false and metrics.authProxy.enabled = false
release:
name: rancher-externalip-webhook
set:
webhookPort: 9000
image.repository: test
image.tag: dev-test
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[0].image
value: test:dev-test
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 9000
name: webhook-server
protocol: TCP
- it: should render Deployment with default metrics port if metrics.enabled = true and metrics.authProxy.enabled = false
release:
name: rancher-externalip-webhook
set:
metrics.enabled: true
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 9443
name: webhook-server
protocol: TCP
- equal:
path: spec.template.spec.containers[0].ports[1]
value:
containerPort: 8443
name: webhook-metrics
protocol: TCP
- it: should render Deployment with custom metrics port if metrics.enabled = true and metrics.authProxy.enabled = false
release:
name: rancher-externalip-webhook
set:
metrics.enabled: true
metrics.port: 8000
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 9443
name: webhook-server
protocol: TCP
- equal:
path: spec.template.spec.containers[0].ports[1]
value:
containerPort: 8000
name: webhook-metrics
protocol: TCP
- it: should render Deployment with default metrics port if metrics.enabled = true and metrics.authProxy.enabled = true
release:
name: rancher-externalip-webhook
set:
metrics.enabled: true
metrics.authProxy.enabled: true
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook-auth-proxy
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 8443
name: webhook-metrics
protocol: TCP
- equal:
path: spec.template.spec.containers[1].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[1].ports[0]
value:
containerPort: 9443
name: webhook-server
protocol: TCP
- it: should render Deployment with custom metrics port and image if metrics.enabled = true and metrics.authProxy.enabled = true
release:
name: rancher-externalip-webhook
set:
metrics.enabled: true
metrics.authProxy.enabled: true
metrics.port: 8000
webhookPort: 9000
image.repository: test
image.tag: dev-test
metrics.authProxy.image.repository: auth
metrics.authProxy.image.tag: auth-test
asserts:
- equal:
path: spec.template.spec.containers[0].name
value: rancher-externalip-webhook-auth-proxy
- equal:
path: spec.template.spec.containers[0].image
value: auth:auth-test
- equal:
path: spec.template.spec.containers[0].ports[0]
value:
containerPort: 8000
name: webhook-metrics
protocol: TCP
- equal:
path: spec.template.spec.containers[1].name
value: rancher-externalip-webhook
- equal:
path: spec.template.spec.containers[1].image
value: test:dev-test
- equal:
path: spec.template.spec.containers[1].ports[0]
value:
containerPort: 9000
name: webhook-server
protocol: TCP