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

testkube regression: helm chart fails to install with flux due to duplicate yaml keys #453

Closed
gberche-orange opened this issue Apr 5, 2023 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@gberche-orange
Copy link
Contributor

gberche-orange commented Apr 5, 2023

Describe the bug

#449 introduced a regression with duplicate yaml key between the template and default values

readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
httpGet:
path: /health
port: {{ .Values.service.port }}
resources:

## Testkube API Liveness probe
livenessProbe:
httpGet:
path: /health
scheme: HTTP

As a result, installation from fluxcd fails with message

      Helm upgrade failed: error while running post render on files: map[string[]interface {}(nil): yaml: unmarshal errors:
        line 107: mapping key "httpGet" already defined at line 100
        line 118: mapping key "httpGet" already defined at line 112

See related fluxcd/helm-controller#283 (comment)

While duplicate keys are mostly ignored by some tools but not others, this problem is unfortunately not detected by helm lint (once #452 gets included)

$ helm lint
==> Linting .
[INFO] Chart.yaml: icon is recommended

1 chart(s) linted, 0 chart(s) failed

More background explaining why fluxcd fails with duplicated yaml keys can be found at kubernetes-sigs/kustomize#3480

I searched a while how to automatically detect such regressions in the future in the kubeshop/helm-charts github workflows:

  • some python libraries can detect duplicated yaml keys
  • the sigs.k8s.io/kustomize/kyaml cli is likely to detect such errors

https://github.com/kubernetes-sigs/kustomize/blob/2fa944b1cdc1f9ad4f72b3df8e67553e0b97d37d/cmd/kyaml/README.md

This package exists to expose kyaml filters directly as cli commands for the purposes of development of the kyaml package and as a reference implementation for using the libraries.

I for now failed to install kyaml (likely by lack of skills related go build environment)

go install -v sigs.k8s.io/kustomize/cmd/kyaml@latest
go: sigs.k8s.io/kustomize/cmd/kyaml@latest: module sigs.k8s.io/kustomize@latest found (v2.0.3+incompatible), but does not contain package sigs.k8s.io/kustomize/cmd/kyaml

To Reproduce

Steps to reproduce the behavior:

helm install --dry-run testkube-manual kubeshop/testkube --version 1.10.272  | tail -n +7 ../testkube.yaml | head -n -3 > testkube.yaml

Find duplicate keys

          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /health
            initialDelaySeconds: 30
            periodSeconds: 15
            successThreshold: 1
            timeoutSeconds: 10
            httpGet:
              path: /health
              port: 8088

** workaround **

Revert to 1.10.256

Expected behavior
A clear and concise description of what you expected to happen.

Version / Cluster

  • Which testkube version? helm chart 1.10.257 to 1.10.272
  • What Kubernetes cluster? (e.g. GKE, EKS, Openshift etc, local KinD, local Minikube)
  • What Kubernetes version?

Screenshots
If applicable, add CLI commands/output to help explain your problem.

Additional context
Add any other context about the problem here.

@ypoplavs
Copy link
Contributor

ypoplavs commented Apr 7, 2023

This issue was fixed in our new release version. Please upgrade to the latest version and let us know in case of anything.

@gberche-orange
Copy link
Contributor Author

thanks @ypoplavs for the fix in a21af64 ! This indeed solves the reported issue.

@github-project-automation github-project-automation bot moved this from 🆕 New to ✅ Done in Testkube Apr 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

3 participants