-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
User should be able to set/retrieve secrets and see them mounted and/or as env variables #14680
Comments
We should try to do something similar to https://docs.openshift.com/container-platform/4.3/builds/creating-build-inputs.html#builds-adding-input-secrets-configmaps_creating-build-inputs |
from #15518 (comment)
|
This is important for setting up Airgap, for instance injecting a Maven
See last lines of #15503 (comment) |
@tolusha I change that one to |
We should leverage labels on configmaps and secrets to automatically mount them in workspaces containers. For example: |
in my opinion for each container, somehow we need to specify where to mount. It can not be done automatically. Others secrets may need to be exposed as env variable,not mounted. |
@sunix right. I think annotations should be used to specify the behaviour. |
@skabashnyuk this issue is about being able to mount the secret as a file in a container or used as an environment variable. The default would be to mount as a file but we could control the behavior using an annotation ( ---
apiVersion: v1
kind: Secret
metadata:
name: mvn-settings-secret
labels:
app: che # <--- mandatory: all secrets labeled `app: che` will be mounted
targetContainer: maven # <--- optional, if omitted will be mounted on all containers
annotations:
mavenSettingsPath: /home/user/.m2/
useSecretAsEnv: true # <--- the default is false |
After we add API to add secrets to users k8s namespace we will need also some dashboard UI to use these APIs. |
The name of the environment variable should be set with annotation too? |
I thought we would be able to set the path where to mount from the container definition in the devfile: #15518 (comment) |
But I don't see how that could be generic setting an annotation name with |
Second thing is to allow bind multiple ENV variables by single secret. Proposal is following:
In case of single value, ENV name annotation can be either
|
hello @mshaposhnik this is looking nice. Would it be possible to make a first implementation as a preview feature? It means: that would be available for the user but we say that the api/format can change in the next releases: I would like to have that ASAP and test it in my flow to give you feedback. |
@mshaposhnik eventually, I would like that we replace the way we are dealing with ssh keys, and having them stored using that mechanism. WDYT? |
@sunix let's not mix everything into single wineglass :) good idea for separate issue |
yes,
:) but it really makes sense |
@mshaposhnik makes sense. For the naming I am not satisfied by |
@l0rd @sunix During testing, found an very annoying thing, not sure if you were aware of it... So it means, for example, if we create foder Dunno if it's acceptable for us now? The workaround can be pre-creating such forders in image. Or what i saw in K8S issue discussion, here is also some way with launching init containers which will create shared folders so the secret mount haven't to create them. |
We have to change the current m2 volume to |
@l0rd here #16895 (comment) #16895 (comment) #16895 (comment) @metlos have a few suggestions about annotation format. Can you take a look and tell us what do you think? |
@skabashnyuk @mshaposhnik I do like @metlos proposals |
So, with the all recent updates, here is how the secrets will looks like:
will result in
will result in
will result in |
@mshaposhnik re-reading k8s labels character set documentation and |
So i believe this issue should be closed after #17167 merge, since all initial requirements are covered. For further improvements, we will do separate ones (there is already some AFAIK) |
@mshaposhnik thanks a lot. |
@sunix Try secrets mount? Just write a right secret & try it :). Also my demo might help. PM if you have troubles with this. |
Is your enhancement related to a problem? Please describe.
There is already some implementation related to saving ssh keys into secrets and mount them. But the user should be able to customize and not be restricted to ssh keys. The user should be able to store as secrets github token, aws access token. The user should be able choose to mount these values to the place of his choice or make them available as environment variable from the devfile.
https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables
Describe the solution you'd like
It could be using k8s secrets but this is not necessary.
Ideally it would be good to have a UI to set the values
UPD: The scope of this issue will be ability to mount secret as an file or ENV variable, and ability to override some properties in devfile. Applying settings from a configmap will be in separate one.
UPD2: devfile overrides have separate issue #17079
The text was updated successfully, but these errors were encountered: