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

Kptfile pipelines should support mount and network flags #3924

Open
uv-Ic opened this issue Apr 19, 2023 · 4 comments
Open

Kptfile pipelines should support mount and network flags #3924

uv-Ic opened this issue Apr 19, 2023 · 4 comments
Labels
area/hydrate enhancement New feature or request triaged Issue has been triaged by adding an `area/` label

Comments

@uv-Ic
Copy link

uv-Ic commented Apr 19, 2023

Describe your problem

I'm trying to use kpt pipeline with render-helm-chart function as mutator.
In order to use local or remote chart we need to pass one of the following flags to docker which the Kptfile doesn't support:

  • mount
  • network

(In some cases the as-current-user flag is required as well.)

Current mitigation is to use exec mutator and run a script with the required flags, for example:
snippet from kptfile

pipeline:
  mutators:
    - exec: ./render_command.sh
  validators:
    - image: gcr.io/kpt-fn/kubeval:v0.1

render_command.sh

#!/bin/bash
kpt  fn eval  \
  --image gcr.io/kpt-fn/render-helm-chart:unstable \
  --mount type=bind,src=$(pwd),dst=/tmp/charts \
  --as-current-user \
  --truncate-output=false \
  --results-dir /tmp/result \
  -- name=spanner-chart releaseName=test

It would be useful if we can pass these flags in the Kptfile like that:

pipeline:
  mutators:
    - image: gcr.io/kpt-fn/render-helm-chart:unstable
      mount: 
         type: bind
         src: .
         dst: /tmp/charts
      as-current-user: true
      configMap:
         name: spanner-chart
         releaseName: test
@uv-Ic uv-Ic added the enhancement New feature or request label Apr 19, 2023
@github-project-automation github-project-automation bot moved this to Backlog in kpt Apr 19, 2023
@droot
Copy link
Contributor

droot commented Apr 20, 2023

Thanks for sharing the use-case details. I must say that's a very clever use of exec mode.

Typically, we think of fn render as an operation that will be performed whenever there are changes to package manifests. It's expected that package manifests will be generated on demand (first time with default values.yaml or when helm chart's version changes) instead frequently. So on-demand generation, it is recommended to use fn eval that supports network and storage.

Regarding the enhancements requests, we are open to support network access in fn render and it has been in our backlog for some time. However, there are concerns related to portability of a package in supporting storage in fn render.

@droot droot added the triaged Issue has been triaged by adding an `area/` label label Apr 20, 2023
@michaelvl
Copy link
Contributor

An alternative take on rendering Helm charts in declarative pipelines can be found here: https://github.com/michaelvl/krm-functions/blob/main/docs/render-helm-chart.md

@johnbelamaric
Copy link
Contributor

johnbelamaric commented Jul 6, 2023

@michaelvl thanks, that declarative version is much better, it's inline with some of what I was discussing in #3847

@tliron FYI with regard to the Nephio Helm support discussion.

@iuliancristea
Copy link

@droot @johnbelamaric are there any further plans here? I think that a solution to this would probably solve the problem of being able to fetch values dynamically from any remote data source as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/hydrate enhancement New feature or request triaged Issue has been triaged by adding an `area/` label
Projects
None yet
Development

No branches or pull requests

5 participants