Skip to content

Commit

Permalink
feat!(mirrorbits-parent) use global values for umbrella storage and i…
Browse files Browse the repository at this point in the history
…ngress. Breaking Change.

Signed-off-by: Damien Duportal <[email protected]>
  • Loading branch information
dduportal committed Oct 1, 2023
1 parent 9b112a8 commit 954f8fa
Show file tree
Hide file tree
Showing 9 changed files with 185 additions and 172 deletions.
2 changes: 1 addition & 1 deletion charts/mirrorbits-parent/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: mirrorbits-parent
description: A mirrorbits parent chart for Kubernetes
type: application
version: 0.2.3
version: 1.0.0
dependencies:
- name: mirrorbits-lite
condition: mirrorbits-lite.enabled
Expand Down
14 changes: 7 additions & 7 deletions charts/mirrorbits-parent/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{{- if .Values.ingress.enabled -}}
{{- if .Values.global.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "mirrorbits-parent.name" . }}
labels:
{{ include "mirrorbits-parents.labels" . | indent 4 }}
{{- with .Values.ingress.annotations }}
{{- with .Values.global.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if .Values.ingress.className }}
ingressClassName: {{ .Values.ingress.className }}
{{- if .Values.global.ingress.className }}
ingressClassName: {{ .Values.global.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
{{- if .Values.global.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
{{- range .Values.global.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
Expand All @@ -24,7 +24,7 @@ spec:
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
{{- range .Values.global.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
Expand Down
12 changes: 6 additions & 6 deletions charts/mirrorbits-parent/templates/persistentvolume.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.storage.enabled }}
{{- if .Values.global.storage.enabled }}
---
apiVersion: v1
kind: PersistentVolume
Expand All @@ -8,11 +8,11 @@ metadata:
{{- include "mirrorbits-parents.labels" . | nindent 4 }}
spec:
accessModes:
{{- toYaml .Values.storage.accessModes | nindent 4 }}
{{- toYaml .Values.global.storage.accessModes | nindent 4 }}
capacity:
storage: {{ .Values.storage.storageSize }}
storageClassName: {{ .Values.storage.storageClassName }}
{{- with .Values.storage.persistentVolume.azureFile }}
storage: {{ .Values.global.storage.storageSize }}
storageClassName: {{ .Values.global.storage.storageClassName }}
{{- with .Values.global.storage.persistentVolume.azureFile }}
csi:
driver: file.csi.azure.com
nodeStageSecretRef:
Expand All @@ -24,7 +24,7 @@ spec:
volumeHandle: {{ include "mirrorbits-parent.name" $ }}
readOnly: {{ .readOnly | default false }}
{{- end }}
{{- with .Values.storage.persistentVolume.additionalSpec }}
{{- with .Values.global.storage.persistentVolume.additionalSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
10 changes: 5 additions & 5 deletions charts/mirrorbits-parent/templates/persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- if .Values.storage.enabled }}
{{- if .Values.global.storage.enabled }}
---
apiVersion: v1
kind: PersistentVolumeClaim
Expand All @@ -9,12 +9,12 @@ metadata:
spec:
volumeName: {{ include "mirrorbits-parent.name" . }}
accessModes:
{{- toYaml .Values.storage.accessModes | nindent 4 }}
{{- toYaml .Values.global.storage.accessModes | nindent 4 }}
resources:
requests:
storage: {{ .Values.storage.storageSize }}
storageClassName: {{ .Values.storage.storageClassName }}
{{- with .Values.storage.persistentVolumeClaim.additionalSpec }}
storage: {{ .Values.global.storage.storageSize }}
storageClassName: {{ .Values.global.storage.storageClassName }}
{{- with .Values.global.storage.persistentVolumeClaim.additionalSpec }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ with .Values.storage.persistentVolume.azureFile -}}
{{ with .Values.global.storage.persistentVolume.azureFile -}}
---
apiVersion: v1
kind: Secret
Expand Down
108 changes: 57 additions & 51 deletions charts/mirrorbits-parent/tests/custom_values_ingress_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@ set:
service:
port: 8080
## End of subchart mocked values
ingress:
enabled: true
hosts:
- host: company.org
paths:
- path: /
backendService: mirrorbits
global:
ingress:
enabled: true
hosts:
- host: company.org
paths:
- path: /
backendService: mirrorbits
templates:
- ingress.yaml
tests:
Expand Down Expand Up @@ -56,27 +57,28 @@ tests:
- it: should create ingress with multiple hosts and multiple paths with full customized values
template: ingress.yaml
set:
ingress:
className: my-ingress-class
annotations:
'app.kubernetes/whatever-with-chars': 'same/here-right'
hosts:
- host: company.org
paths:
- path: /.*[.](deb|hpi|war|rpm|msi|pkg|sha256|md5sum|zip|gz|pdf|json|svg|sh|jpeg|ico|png|html)$
backendService: httpd
- path: /
backendService: mirrorbits
pathType: ImplementationSpecific
- host: fallback.company.org
paths:
- path: /
backendService: httpd
tls:
- secretName: ingress-tls
hosts:
- company.org
- fallback.company.org
global:
ingress:
className: my-ingress-class
annotations:
'app.kubernetes/whatever-with-chars': 'same/here-right'
hosts:
- host: company.org
paths:
- path: /.*[.](deb|hpi|war|rpm|msi|pkg|sha256|md5sum|zip|gz|pdf|json|svg|sh|jpeg|ico|png|html)$
backendService: httpd
- path: /
backendService: mirrorbits
pathType: ImplementationSpecific
- host: fallback.company.org
paths:
- path: /
backendService: httpd
tls:
- secretName: ingress-tls
hosts:
- company.org
- fallback.company.org
asserts:
- hasDocuments:
count: 1
Expand Down Expand Up @@ -135,23 +137,25 @@ tests:
- it: should fail the ingress when a host's path does not have backendService
template: ingress.yaml
set:
ingress:
hosts:
- host: company.org
paths:
- path: /
global:
ingress:
hosts:
- host: company.org
paths:
- path: /
asserts:
- failedTemplate:
errorMessage: "Required key: backendService for ingress.hosts[].paths[] objects must have the value 'httpd' or 'mirrorbits'."
- it: should fail the ingress when a host's path has an unknown backendService
template: ingress.yaml
set:
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: yipikai
global:
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: yipikai
asserts:
- failedTemplate:
errorMessage: "Required key: backendService for ingress.hosts[].paths[] objects must have the value 'httpd' or 'mirrorbits'."
Expand All @@ -160,12 +164,13 @@ tests:
set:
httpd:
enabled: false
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: httpd
global:
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: httpd
asserts:
- failedTemplate:
errorMessage: "Cannot use httpd as backend if it is disabled."
Expand All @@ -174,12 +179,13 @@ tests:
set:
mirrorbits-lite:
enabled: false
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: mirrorbits
global:
ingress:
hosts:
- host: company.org
paths:
- path: /
backendService: mirrorbits
asserts:
- failedTemplate:
errorMessage: "Cannot use mirrorbits(-lite) as backend if it is disabled."
78 changes: 41 additions & 37 deletions charts/mirrorbits-parent/tests/custom_values_storage_test.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
suite: Tests with custom values
set:
storage:
enabled: true
storageClassName: super-fast-storage
storageSize: 510Gi
accessModes:
- ReadWriteMany
- ReadOnlyMany
- ReadWriteOnce
persistentVolume:
additionalSpec:
persistentVolumeReclaimPolicy: Retain
mountOptions:
- dir_mode=0755
persistentVolumeClaim:
additionalSpec:
volumeMode: Block
global:
storage:
enabled: true
storageClassName: super-fast-storage
storageSize: 510Gi
accessModes:
- ReadWriteMany
- ReadOnlyMany
- ReadWriteOnce
persistentVolume:
additionalSpec:
persistentVolumeReclaimPolicy: Retain
mountOptions:
- dir_mode=0755
persistentVolumeClaim:
additionalSpec:
volumeMode: Block
templates:
- persistentvolume.yaml
- persistentvolumeclaim.yaml
Expand Down Expand Up @@ -88,14 +89,15 @@ tests:
- it: should provide an azurefile CSI PV with customized values if specified
template: persistentvolume.yaml
set:
storage:
persistentVolume:
azureFile:
resourceGroup: storage-rg
storageAccountName: storage-account
shareName: storage-share
storageAccountKey: StorageAccountSuperSecretKey
readOnly: true
global:
storage:
persistentVolume:
azureFile:
resourceGroup: storage-rg
storageAccountName: storage-account
shareName: storage-share
storageAccountKey: StorageAccountSuperSecretKey
readOnly: true
asserts:
- hasDocuments:
count: 1
Expand Down Expand Up @@ -131,14 +133,15 @@ tests:
- it: should not create any persistent volume secret
template: persistentvolumesecret.yaml
set:
storage:
persistentVolume:
azureFile:
resourceGroup: storage-rg
storageAccountName: storage-account
shareName: storage-share
storageAccountKey: 'StorageAccountSuperSecretKey!2023'
readOnly: true
global:
storage:
persistentVolume:
azureFile:
resourceGroup: storage-rg
storageAccountName: storage-account
shareName: storage-share
storageAccountKey: 'StorageAccountSuperSecretKey!2023'
readOnly: true
asserts:
- hasDocuments:
count: 1
Expand All @@ -158,11 +161,12 @@ tests:
release:
name: rindfleischetikettierunguberwachungsaufgabenubertrags # 53 chars is the longest possible release name
set:
storage:
persistentVolume:
azureFile:
storageAccountName: storage-account
storageAccountKey: 'StorageAccountSuperSecretKey!2023'
global:
storage:
persistentVolume:
azureFile:
storageAccountName: storage-account
storageAccountKey: 'StorageAccountSuperSecretKey!2023'
asserts:
- hasDocuments:
count: 1
Expand Down
5 changes: 3 additions & 2 deletions charts/mirrorbits-parent/tests/defaults_storage_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ templates:
- persistentvolumesecret.yaml
## Only enable storage
set:
storage:
enabled: true
global:
storage:
enabled: true
tests:
- it: should not create any persistent volume secret
template: persistentvolumesecret.yaml
Expand Down
Loading

0 comments on commit 954f8fa

Please sign in to comment.