-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #840 from smerle33/PDB/plugin-site/frontend
feat(plugin-site-frontend): add PDB and unittest
- Loading branch information
Showing
7 changed files
with
150 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ maintainers: | |
- name: timja | ||
- name: halkeye | ||
name: plugin-site | ||
version: 0.2.0 | ||
version: 0.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{{- if (gt (int .Values.frontend.replicaCount) 1) }} | ||
apiVersion: policy/v1 | ||
kind: PodDisruptionBudget | ||
metadata: | ||
name: {{ include "plugin-site.fullname" . }}-frontend | ||
labels: | ||
{{- include "plugin-site.labels" . | nindent 4 }} | ||
spec: | ||
{{- with .Values.frontend.poddisruptionbudget.minAvailable }} | ||
minAvailable: {{ . }} | ||
{{- end }} | ||
{{- with .Values.frontend.poddisruptionbudget.maxUnavailable }} | ||
maxUnavailable: {{ . }} | ||
{{- end }} | ||
selector: | ||
matchLabels: | ||
{{- include "plugin-site-frontend.selectorLabels" . | nindent 6 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
suite: Test with custom values | ||
templates: | ||
- deployment-frontend.yaml | ||
- ingress.yaml | ||
- pdb-frontend.yaml | ||
- nginx-configmap.yaml # Direct dependency of deployment.yaml | ||
tests: | ||
- it: should create an ingress when ingress.enabled is true | ||
set: | ||
ingress: | ||
enabled: true | ||
template: ingress.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- it: should mount the html volume when htmlVolume is set | ||
template: deployment-frontend.yaml | ||
set: | ||
htmlVolume: | ||
hostPath: /host | ||
frontend: | ||
resources: | ||
limits: | ||
cpu: 300ms | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Deployment | ||
- equal: | ||
path: spec.template.spec.volumes[0].name | ||
value: html | ||
- equal: | ||
path: spec.template.spec.volumes[0].hostPath | ||
value: /host | ||
- equal: | ||
path: spec.template.spec.containers[0].resources.limits.cpu | ||
value: 300ms | ||
- it: should create a customized PDB with the provided spec | ||
template: pdb-frontend.yaml | ||
set: | ||
frontend: | ||
replicaCount: 3 | ||
poddisruptionbudget: | ||
minAvailable: 2 | ||
maxUnavailable: 3 | ||
asserts: | ||
- isKind: | ||
of: PodDisruptionBudget | ||
- equal: | ||
path: spec.minAvailable | ||
value: 2 | ||
- equal: | ||
path: spec.maxUnavailable | ||
value: 3 | ||
- equal: | ||
path: spec.selector.matchLabels['app.kubernetes.io/name'] | ||
value: "plugin-site-frontend" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
suite: Test with default values | ||
templates: | ||
- deployment-frontend.yaml | ||
- ingress.yaml | ||
- pdb-frontend.yaml | ||
- nginx-configmap.yaml | ||
tests: | ||
- it: should not create an ingress by default | ||
template: ingress.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 0 | ||
- it: should define the default deployment with default imagePullPolicy | ||
template: deployment-frontend.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: Deployment | ||
- equal: | ||
path: spec.template.spec.containers[0].imagePullPolicy | ||
value: IfNotPresent | ||
- equal: | ||
path: metadata.labels["app.kubernetes.io/name"] | ||
value: plugin-site | ||
- equal: | ||
path: metadata.labels["app.kubernetes.io/managed-by"] | ||
value: Helm | ||
- equal: | ||
path: spec.template.spec.volumes[0].name | ||
value: html | ||
- equal: | ||
path: spec.template.spec.volumes[0].emptyDir | ||
value: {} | ||
- equal: | ||
path: spec.template.spec.containers[0].resources.limits.cpu | ||
value: 100m | ||
- it: should create a pdb with default values as the frontend service is replicated to 2 by default | ||
template: pdb-frontend.yaml | ||
asserts: | ||
- hasDocuments: | ||
count: 1 | ||
- isKind: | ||
of: PodDisruptionBudget | ||
- equal: | ||
path: spec.minAvailable | ||
value: 1 | ||
- equal: | ||
path: spec.selector.matchLabels['app.kubernetes.io/name'] | ||
value: "plugin-site-frontend" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters