Skip to content

Add missing chart properties #500

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

Merged
merged 1 commit into from
Nov 26, 2020
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
2 changes: 2 additions & 0 deletions charts/rabbitmq/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rabbitmq-*.tgz
template-output
10 changes: 5 additions & 5 deletions charts/rabbitmq/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
name: rabbitmq
description: RabbitMQ Cluster
apiVersion: v2
version: 0.8.0
version: 0.9.0
appVersion: 3.8.9
keywords:
- rabbitmq
- message queue
- AMQP
home: https://www.rabbitmq.com
- rabbitmq
- message queue
- AMQP
home: https://www.rabbitmq.com
icon: https://www.rabbitmq.com/img/rabbitmq_logo_strap.png
engine: gotpl
9 changes: 8 additions & 1 deletion charts/rabbitmq/example-configurations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ replicas: 3

image: "rabbitmq:3.8.9-management"

imagePullSecret: foo
imagePullSecrets:
- name: foo

service:
type: LoadBalancer
Expand Down Expand Up @@ -73,6 +74,12 @@ affinity:

tls:
secretName: tls-secret
caSecretName: tls-ca-secret
disableNonTLSListeners: true

terminationGracePeriodSeconds: 42

skipPostDeploySteps: true

override:
statefulSet:
Expand Down
7 changes: 6 additions & 1 deletion charts/rabbitmq/expected-template-output
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ metadata:

spec:
image: rabbitmq:3.8.9-management
imagePullSecret: foo
imagePullSecrets:
- name: foo
replicas: 3
service:
type: LoadBalancer
Expand Down Expand Up @@ -72,6 +73,8 @@ spec:
].
tls:
secretName: tls-secret
caSecretName: tls-ca-secret
disableNonTLSListeners: true
override:
statefulSet:
spec:
Expand All @@ -83,3 +86,5 @@ spec:
- containerPort: 12345
name: additional-port
protocol: TCP
skipPostDeploySteps: true
terminationGracePeriodSeconds: 42
19 changes: 17 additions & 2 deletions charts/rabbitmq/templates/rabbitmq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ spec:
image: {{ .Values.image }}
{{- end }}

{{- if .Values.imagePullSecret }}
imagePullSecret: {{ .Values.imagePullSecret }}
{{- if .Values.imagePullSecrets }}
imagePullSecrets:
{{ toYaml .Values.imagePullSecrets | indent 2 }}
{{- end }}

{{- if .Values.replicas }}
Expand Down Expand Up @@ -98,9 +99,23 @@ spec:
{{- if .Values.tls.secretName }}
secretName: {{ .Values.tls.secretName }}
{{- end }}
{{- if .Values.tls.caSecretName }}
caSecretName: {{ .Values.tls.caSecretName }}
{{- end }}
{{- if .Values.tls.disableNonTLSListeners }}
disableNonTLSListeners: {{ .Values.tls.disableNonTLSListeners }}
{{- end }}
{{- end }}

{{- if .Values.override }}
override:
{{ toYaml .Values.override | indent 4 }}
{{- end }}

{{- if .Values.skipPostDeploySteps }}
skipPostDeploySteps: {{ toYaml .Values.skipPostDeploySteps }}
{{- end }}

{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ toYaml .Values.terminationGracePeriodSeconds }}
{{- end }}
18 changes: 13 additions & 5 deletions charts/rabbitmq/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,20 @@
#
# This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.

set -ex
set -e

helm package .
for p in $(kubectl eg rabbitmqclusters.rabbitmq.com | yq d - spec.resources | yq d - spec.tolerations | yq d - spec.override | yq d - spec.affinity | yq r - spec | grep -v ' - ' | awk -F: '{ print $1 }'); do
grep -q "$p " templates/rabbitmq.yaml
if [[ $? != 0 ]]; then
echo "FAIL: Property $p not exposed in the helm chart"
exit 1
fi
done
echo "Seems like all CRD properties are exposed in the helm chart"

helm template rabbitmq-0.8.0.tgz -f example-configurations.yaml > template-output
chart=$(helm package . | helm package . | awk '{print $NF}')

helm template $chart -f example-configurations.yaml > template-output

# expected-template-output is generated by running helm template rabbitmq-0.1.tgz -f plans/example-configurations.yaml > expected-template-output
# it should be updated if we add any new configurations and when we modify plans/example-configurations.yaml
diff template-output expected-template-output
diff -u template-output expected-template-output && echo "Successfully rendered the template"