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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Environment Variables for Containerized KRM Functions #4394

Closed
devstein opened this issue Jan 18, 2022 · 9 comments
Closed

[Question] Environment Variables for Containerized KRM Functions #4394

devstein opened this issue Jan 18, 2022 · 9 comments
Labels
kind/support Categorizes issue or PR as a support question. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/not-an-issue

Comments

@devstein
Copy link
Contributor

devstein commented Jan 18, 2022

Hi 馃憢 I maintain KSOPS a popular kustomize plugin. I'd like to migrate it to the new KRM style plugins, ideally as a containerized KRM function. In order to do so, the container needs access to credentials to decrypt the SOPS encrypted resources.

Is it possible to configure environment variable or volume mounts for Containerized KRM functions?

Related Issue: #4290

@k8s-ci-robot k8s-ci-robot added the needs-kind Indicates a PR lacks a `kind/foo` label and requires one. label Jan 18, 2022
@k8s-ci-robot
Copy link
Contributor

@devstein: This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 18, 2022
@devstein
Copy link
Contributor Author

One option seems to be to pursue KRM exec functions and rely on the fix proposed in this PR. Would this approach make sense?

@natasha41575
Copy link
Contributor

From the plugin graduation KEP (which we are currently working towards):

The env field for container plugins will be deprecated. In line with Kustomize's principles, plugin configuration should be passed in the KRM object and should not be affected by the execution environment. The network and storage mount options will be retained, as they are needed to support some common generator plugin use cases. Guidance on their appropriate use will be added to the plugin developer documentation.

To answer your question, storage mounts are currently supported (via the mount option) and we plan to keep them around. Let me know if you'd like an example of how to do this, I can dig one up.

Env vars however are somewhat misaligned with kustomize principles. In general we believe that everything should be available declaratively in the plugin configuration file, and checked into version control. However, I do empathize with the case of wanting to pass in credentials - that's not something you would want to put directly into your config files. @mengqiy @KnVerey WDYT?

One option seems to be to pursue KRM exec functions and rely on the fix proposed in this PR. Would this approach make sense?

Yes, using KRM exec functions will allow you to use env vars and files on your filesystem without needing to pass them along into a container.

@devstein
Copy link
Contributor Author

Hi @natasha41575 thanks for getting back to me!

Is the example in this issue a valid example of the mount option?

Environment variables are preferable, but for the KSOPS use-case, we could also mount the credentials as volume (i.e ~/.aws/credentials in the KMS case).

KRM exec function is appealing because it will be the simplest migration for KSOPS users.

@natasha41575
Copy link
Contributor

@devstein Yes, that is an example of how to use mounts for containerized functions. If mounting the credentials as a volume works for you then that would be the way to go. Evidently mounting does not always work as detailed in the issue you linked, but we will fix it when we can. That issue would be a good place to look for updates.

I confirmed that we are planning to deprecate and remove passing along environment variables into functions. This aligns with our principles of maintaining all configuration explicitly in files that can be checked into version control.

/kind support
/triage not-an-issue

/unlabel needs-kind
/unlabel needs-triage

@k8s-ci-robot k8s-ci-robot added kind/support Categorizes issue or PR as a support question. triage/not-an-issue and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Jan 21, 2022
@natasha41575 natasha41575 removed the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 21, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 21, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 21, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closing this issue.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Reopen this issue or PR with /reopen
  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. triage/not-an-issue
Projects
None yet
Development

No branches or pull requests

4 participants