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

Add support for "fieldRef" environment variables #150

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Add support for "fieldRef" environment variables #150

merged 2 commits into from
Nov 15, 2024

Conversation

mhutter
Copy link
Member

@mhutter mhutter commented Nov 13, 2024

Sometimes it's necessary to expose certain pod metadata (e.g. its IP) as
environment variables. To achieve this, Kubernetes provides the
so-called "downward API" 1.

This commit allows users to make use of this API in a similar way we
implemented references to existing secrets.

Checklist

  • Categorize the PR by setting a good title and adding one of the labels:
    bug, enhancement, documentation, change, breaking, dependency
    as they show up in the changelog
  • Update tests.

Sometimes it's necessary to expose certain pod metadata (e.g. its IP) as
environment variables. To achieve this, Kubernetes provides the
so-called "downward API" [1].

This commit allows users to make use of this API in a similar way we
implemented references to existing secrets.

[1]: https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/

Signed-off-by: Manuel Hutter <manuel@hutter.io>
@mhutter mhutter added the enhancement New feature or request label Nov 13, 2024
@mhutter mhutter requested a review from davidgubler November 13, 2024 13:46
@davidgubler
Copy link
Member

davidgubler commented Nov 14, 2024

Looks reasonable, however one thing I would do is to also add $_secretRef_ as a replacement for $_ref_ and remove all references for $_ref_ from the documentation, but keep $_ref_ working as it does now. That way we can remove support for $_ref_ at some point in the future. I think just from a usability perspective it's better to have "secretRef" and "fieldRef" instead of "ref" and "fieldRef".

`_ref_` will keep working as is; for now there also is no way to
differentiate between usages of _ref_ and _secretRef_

Signed-off-by: Manuel Hutter <manuel@hutter.io>
@mhutter
Copy link
Member Author

mhutter commented Nov 14, 2024

Yes that makes sense, implemented in 98f3ed1

@mhutter mhutter merged commit 7d6ef91 into master Nov 15, 2024
4 checks passed
@mhutter mhutter deleted the fieldRef branch November 15, 2024 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants