-
Notifications
You must be signed in to change notification settings - Fork 920
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
Kubectl does not support secret creation from .env
files with multiline values
#1610
Comments
This issue is currently awaiting triage. If a SIG or subproject determines this is a relevant issue, they will accept it by applying the The 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-sigs/prow repository. |
/sig cli |
Currently there is no support for parsing multi-line entries. We parse the .env file line by line. I think you can get this to work by simply replacing the actual line breaks in the file with a E.g:
I'd consider this as a feature request, the |
/sig support |
@mauri870: The label(s) In response to this:
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-sigs/prow repository. |
Oops, mispelling /kind support |
Looking at the code, it seems that supporting multiline values would require a rewrite of the rather simple parser we have in |
Noticed that we also rely on a rather unique behavior that is not supported on the majority of dotenv libraries. If we have only the name but no value and no equal sign, the variable name assumes the value from the environment (os.Getenv("B") in the example bellow:
Since this is not a dotenv standard we cannot simply migrate to a library without introducing breaking changes. |
Hi @mauri870 ! Thanks for your reply and intention to help, I was reviewing the code behind, what about just checking prefixes and suffixes of each value (in this case |
Yes, it looks rather simple. Given that you can use |
I think this use case is useful, but I'd like to hear from the kubectl maintainers. |
@mauri870 @HirazawaUi Hi guys! The PR kubernetes/kubernetes#125430 could help! |
/assign plusiv |
/remove-kind bug Early .env implementations didn't support multiline values with line breaks, so this feels like a feature request. |
The Kubernetes project currently lacks enough contributors to adequately respond to all issues. This bot triages un-triaged issues according to the following rules:
You can:
Please send feedback to sig-contributor-experience at kubernetes/community. /lifecycle stale |
/remove-lifecycle stale |
/triage accepted We could also implement the mentioned godotenv library as a separate flag. If someone would like to take that on, we could implement that via the KEP process with a scheduled deprecation of the old behavior. |
Personally I am very pro doing things the way that people will expect them behave and would love to see the KEP process for migrating from the old behavior to the standard behavior done. |
Hi @mpuckett159 , As mentioned in the comment below, I created a PR that solves this issue without using the
|
What happened?
kubectl
currently does not support the creation of Kubernetes secrets from .env files containing multiline values. This limitation poses a challenge for users who need to store multiline environment variables as secrets, such as certificates or private keys.Assuming the following
.env
file:And running
kubectl create secret generic test-secret --from-env-file=.env
the following output is given by kubectl:What did you expect to happen?
The secret should be created successfully with the multiline value stored.
How can we reproduce it (as minimally and precisely as possible)?
.env
file with multiline values:Anything else we need to know?
No response
Kubernetes version
Cloud provider
OS version
Install tools
Container runtime (CRI) and version (if applicable)
Related plugins (CNI, CSI, ...) and versions (if applicable)
The text was updated successfully, but these errors were encountered: