Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(mirrorbit-lite) only create secrets when needed #836

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/mirrorbits-lite/.helmignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
Expand Down
2 changes: 1 addition & 1 deletion charts/mirrorbits-lite/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
description: Mirrobits lite helm chart for Kubernetes
name: mirrorbits-lite
version: 0.4.0
version: 0.4.1
appVersion: "v0.5.1"
maintainers:
- email: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion charts/mirrorbits-lite/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
labels:
app.kubernetes.io/name: {{ include "mirrorbits-lite.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
checksum/config: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum | trunc 63 }}
checksum/config: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum | trunc 63 }}
spec:
automountServiceAccountToken: false
{{- with .Values.imagePullSecrets }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
type: Opaque
data:
mirrorbits.conf: {{ .Values.conf | b64enc }}

{{- if and .Values.geoipupdate.account_id .Values.geoipupdate.license_key }}
---
apiVersion: v1
kind: Secret
Expand All @@ -16,8 +16,8 @@ type: Opaque
data:
GEOIPUPDATE_ACCOUNT_ID: {{ .Values.geoipupdate.account_id | b64enc }}
GEOIPUPDATE_LICENSE_KEY: {{ .Values.geoipupdate.license_key | b64enc }}

{{ if .Values.repository.secrets.enabled -}}
{{- end }}
{{- if and .Values.repository.secrets.enabled (not (dig "global" "storage" "enabled" false .Values.AsMap)) }}
---
apiVersion: v1
kind: Secret
Expand Down
33 changes: 32 additions & 1 deletion charts/mirrorbits-lite/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ suite: Tests with custom values
templates:
- deployment.yaml
- ingress.yaml
- secret.yaml # Direct dependency of deployment.yaml
- secrets.yaml
- service.yaml
- pdb.yaml
- persistentVolume.yaml
Expand Down Expand Up @@ -58,6 +58,11 @@ set:
namespace: mirrorbits
mountOptions:
- dir_mode=0755
secrets:
enabled: true
data:
azurestorageaccountkey: 'SuperSecretKey!'
azurestorageaccountname: storage-account-in-az
tests:
- it: Should set the correct service selector labels when a fullNameOverride is specified
template: service.yaml
Expand Down Expand Up @@ -170,3 +175,29 @@ tests:
- equal:
path: spec.selector.matchLabels['app.kubernetes.io/name']
value: mirrorbits-lite
- it: should create all secrets
template: secrets.yaml
asserts:
- hasDocuments:
count: 3
- documentIndex: 0
isKind:
of: Secret
- documentIndex: 0
equal:
path: metadata.name
value: RELEASE-NAME-mirrorbits-lite
- documentIndex: 1
isKind:
of: Secret
- documentIndex: 1
equal:
path: metadata.name
value: RELEASE-NAME-mirrorbits-lite-geoipupdate
- documentIndex: 2
isKind:
of: Secret
- documentIndex: 2
equal:
path: metadata.name
value: RELEASE-NAME-mirrorbits-lite-binary
12 changes: 11 additions & 1 deletion charts/mirrorbits-lite/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ suite: default tests
templates:
- deployment.yaml
- ingress.yaml
- secret.yaml # Direct dependency of deployment(.*).yaml
- secrets.yaml
- service.yaml
- pdb.yaml
- persistentVolume.yaml
Expand Down Expand Up @@ -73,3 +73,13 @@ tests:
asserts:
- hasDocuments:
count: 0
- it: should only create the mirrorbits conf secret by default
template: secrets.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: metadata.name
value: RELEASE-NAME-mirrorbits-lite
17 changes: 16 additions & 1 deletion charts/mirrorbits-lite/tests/parent_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ suite: Tests with values from parent (umbrella ingress and umbrella PVC)
templates:
- deployment.yaml
- ingress.yaml
- secret.yaml # Direct dependency of deployment.yaml
- secrets.yaml
- persistentVolume.yaml
- persistentVolumeClaim.yaml
set:
Expand Down Expand Up @@ -55,6 +55,11 @@ set:
namespace: mirrorbits
mountOptions:
- dir_mode=0755
secrets:
enabled: true
data:
azurestorageaccountkey: 'SuperSecretKey!'
azurestorageaccountname: storage-account-in-az
tests:
- it: should define a customized "mirrorbits-lite" deployment
template: deployment.yaml
Expand Down Expand Up @@ -91,3 +96,13 @@ tests:
asserts:
- hasDocuments:
count: 0
- it: should only create the mirrorbits conf secret (global storage overrides local PVC secrets)
template: secrets.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Secret
- equal:
path: metadata.name
value: RELEASE-NAME-mirrorbits-lite