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

feat: error handling for http #960

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emirot
Copy link
Contributor

@emirot emirot commented Dec 6, 2022

Signed-off-by: emirot [email protected]

What

Add error handling when getting http value files.

Why

Fails silently and renders without interpolating or notifying.

Tests

Didn't find test files, so I tested manually.

docker build -t helmtest  --build-arg BUILDER_IMAGE=golang:1.18-alpine3.15    --build-arg  BASE_IMAGE=alpine:3.15 .

Then

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization


secretGenerator:
  - name: mysecret
    files:
      - username
      - password
    options:
      disableNameSuffixHash: true
      annotations:
        config.kubernetes.io/local-config: "true"

transformers:
  - |-
    apiVersion: fn.kpt.dev/v1alpha1
    kind: RenderHelmChart
    metadata:
      name: demo
      annotations:
        config.kubernetes.io/function: |
          container:
            network: true
            image: helmtest
    helmCharts:
    - chartArgs:
        name: mychart
        version: v2.4
        registry: myregistry
        auth:
          kind: Secret
          name: mysecret
      templateOptions:
        namespace: argocd
        releaseName: argocd
        values:
          valuesFiles:
            - https://gist.github.com/emirot/1234567

Testing

kustomize build --enable-alpha-plugins --network . 
failed to evaluate function: failed to run function: failed to run generator: non-ok http status: 404 returnedError: couldn't execute function: exit status 1 

@yuwenma
Copy link
Contributor

yuwenma commented Dec 6, 2022

The change looks good and thanks for the contribution again, @emirot! Just curious, why do you use the custom transformer rather than the kustomize builtin helmcharts?

@yuwenma
Copy link
Contributor

yuwenma commented Dec 6, 2022

CC @natasha41575

@emirot
Copy link
Contributor Author

emirot commented Dec 6, 2022

The change looks good and thanks for the contribution again, @emirot! Just curious, why do you use the custom transformer rather than the kustomize builtin helmcharts?

@yuwenma
Is that what you mean by kustomize builtin helmcharts ?
From my understanding currently Kustomize do not support helm inflate with private repositories , kubernetes-sigs/kustomize#4335 and won't be developed as said in the long term support. By having this it will bring us more flexibility as we could have any functions we want.

@yuwenma
Copy link
Contributor

yuwenma commented Dec 6, 2022

The change looks good and thanks for the contribution again, @emirot! Just curious, why do you use the custom transformer rather than the kustomize builtin helmcharts?

@yuwenma Is that what you mean by kustomize builtin helmcharts ? From my understanding currently Kustomize do not support helm inflate with private repositories , kubernetes-sigs/kustomize#4335 and won't be developed as said in the long term support. By having this it will bring us more flexibility as we could have any functions we want.

Gotcha, thanks for the reply.

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

Successfully merging this pull request may close these issues.

2 participants