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

10.12.2 has a bug due to the recent addition of a migration hook file and a missing value #1757

Closed
act-mreeves opened this issue May 3, 2023 · 6 comments
Labels
question Further information is requested

Comments

@act-mreeves
Copy link

Is this a request for help?:
No, just trying to help other users. I found an easy workaround by tweaking my values file.

Is this a BUG REPORT or FEATURE REQUEST? (choose one):
BUG REPORT

Version of Helm and Kubernetes:
helm 3.11 and k8s 1.23

Which chart:
10.12.2

Which product license (Enterprise/Pro/oss):
Doesn't matter

JFrog support reference (if already raised with support team):
n/a

What happened:

This command surfaced an error to the recent addition of a migration hook file.

Executing helm template af2 jfrog/jfrog-platform --version 10.12.2 --namespace artifactory --values values.yaml --validate --is-upgrade
Error: Failed to render chart: exit status 1: install.go:194: [debug] Original chart version: "10.12.2"
install.go:211: [debug] CHART PATH: /Users/my_user/Library/Caches/helm/repository/jfrog-platform-10.12.2.tgz

Error: template: jfrog-platform/templates/migration-hook.yaml:80:16: executing "jfrog-platform/templates/migration-hook.yaml" at <.Values.rabbitmq.podSecurityContext.enabled>: nil pointer evaluating interface {}.enabled
helm.go:84: [debug] template: jfrog-platform/templates/migration-hook.yaml:80:16: executing "jfrog-platform/templates/migration-hook.yaml" at <.Values.rabbitmq.podSecurityContext.enabled>: nil pointer evaluating interface {}.enabled

Error: plugin "diff" exited with error
helm.go:84: [debug] plugin "diff" exited with error

This commit: bf993a1 added this file: stable/jfrog-platform/templates/migration-hook.yaml has a bug in this line:
{{- if .Values.rabbitmq.podSecurityContext.enabled }} because https://github.com/jfrog/charts/blob/master/stable/jfrog-platform/values.yaml does not have a rabbitmq.podSecurityContext.enabled setting. Probably all the functionality in that file should be gated by a check to see if rabbitmq.enabled is true.

What you expected to happen:
The diff to succeed.

How to reproduce it (as minimally and precisely as possible):
Run helm template af2 jfrog/jfrog-platform --version 10.12.2 --namespace artifactory --values values.yaml --validate --is-upgrade

Anything else we need to know:
I'd fix this myself as described but not sure of your preferred approach. I'd probably add a default value for rabbitmq.podSecurityContext.enabled but as I mentioned you may want to gate the whole thing.
I tested a fix by adding this to my values file and it worked.

rabbitmq:
  enabled: false
  podSecurityContext:
    enabled: false
@act-mreeves act-mreeves changed the title 10.12.2 a bug due to 10.12.2 a bug due to the recent addition of a migration hook file and a missing value May 3, 2023
@act-mreeves act-mreeves changed the title 10.12.2 a bug due to the recent addition of a migration hook file and a missing value 10.12.2 has a bug due to the recent addition of a migration hook file and a missing value May 3, 2023
@chukka
Copy link
Collaborator

chukka commented May 4, 2023

@act-mreeves Thanks for reporting ! However, when I tried this below command , it was able to get full template without any issues , any other information that can help us to debug further ?

helm template af2 jfrog/jfrog-platform --version 10.12.2 --namespace artifactory --values values.yaml --validate --is-upgrade

@chukka chukka added the question Further information is requested label May 4, 2023
@act-mreeves
Copy link
Author

act-mreeves commented May 4, 2023

Hi @chukka, thanks for your quick response!

I copied the current values file at https://github.com/jfrog/charts/blob/master/stable/jfrog-platform/values.yaml to values-test.yaml and then ran:
helm template af2 jfrog/jfrog-platform --version 10.12.2 --namespace artifactory --values values-test.yaml --validate --is-upgrade and it worked.

However, if I change this one bit in values-test.yaml:

rabbitmq:                                                                       
  enabled: false

it will fail as explained.

helm template af2 jfrog/jfrog-platform --version 10.12.2 --namespace artifactory --values values-test.yaml --validate --is-upgrade                   
Error: template: jfrog-platform/templates/migration-hook.yaml:80:16: executing "jfrog-platform/templates/migration-hook.yaml" at <.Values.rabbitmq.podSecurityContext.enabled>: nil pointer evaluating interface {}.enabled

Use --debug flag to render out invalid YAML

The helm chart should ideally be made a little bit more defensive.

@chukka
Copy link
Collaborator

chukka commented May 19, 2023

Noted, we will fix in it in next release adding additional check

@chukka
Copy link
Collaborator

chukka commented Jun 4, 2023

closed via #1777

@chukka chukka closed this as completed Jun 4, 2023
@act-mreeves
Copy link
Author

Thanks!

@act-mreeves
Copy link
Author

Still not working. Same example as above.

Create values-test.yaml like this:

rabbitmq:                                                                       
  enabled: false

and run helm and you get same error:

helm template af2 jfrog/jfrog-platform --version 10.13.1 --namespace artifactory --values values-test.yaml --validate --is-upgrade
Error: template: jfrog-platform/templates/migration-hook.yaml:80:16: executing "jfrog-platform/templates/migration-hook.yaml" at <.Values.rabbitmq.podSecurityContext.enabled>: nil pointer evaluating interface {}.enabled

Use --debug flag to render out invalid YAML

Create values-test.yaml like this:

rabbitmq:                                                                       
  enabled: false
  podSecurityContext:
    enabled: false

and run this and it works:

helm template af2 jfrog/jfrog-platform --version 10.13.1 --namespace artifactory --values values-test.yaml --validate --is-upgrade
---
# Source: jfrog-platform/charts/pipelines/templates/pipelines-networkpolicy.yaml
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy

...SNIP ENTIRE REST OF HELM CHART...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants