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(account-app) correct default values for 'resources' to avoid YAML parsing error #780

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
2 changes: 1 addition & 1 deletion charts/accountapp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ description: A Helm chart for accounts.jenkins.io
maintainers:
- name: timja
name: accountapp
version: 0.7.0
version: 0.7.1
4 changes: 3 additions & 1 deletion charts/accountapp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,10 @@ spec:
path: /login
port: http
scheme: HTTP
{{- with .Values.resources }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
Expand Down
24 changes: 24 additions & 0 deletions charts/accountapp/tests/custom_values_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,27 @@ tests:
- equal:
path: data.smtpPassword
value: c210cC1wYXNzd29yZA==
- it: should create a Deployment with the customized values
set:
image:
pullPolicy: Always
resources:
limits:
memory: 1024Mi
requests:
cpu: 500m
template: deployment.yaml
asserts:
- hasDocuments:
count: 1
- isKind:
of: Deployment
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
- equal:
path: spec.template.spec.containers[0].resources.limits.memory
value: 1024Mi
- equal:
path: spec.template.spec.containers[0].resources.requests.cpu
value: 500m
2 changes: 2 additions & 0 deletions charts/accountapp/tests/defaults_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ tests:
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: IfNotPresent
- notExists:
path: spec.template.spec.containers[0].resources
4 changes: 2 additions & 2 deletions charts/accountapp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ ingress:
# - secretName: accounts-tls
# hosts:
# - accounts.jenkins.io
resources: # We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
# We usually recommend not to specify default resources and to leave this as a conscious: null # choice for the user. This also increases chances charts run on environments with little

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

null or empty object? The comment seems to imply one should change the defaut {} value to null

Also, should this be splited to two lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. The fix with with helm control flow element does not care as the resulting template pipeline is false wether the value is null, empty or undefined.

PR to update the comment?

resources: {}
# resources, such as Minikube. If you do want to specify resources, uncomment the following
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
# limits:
Expand Down