-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
feat: make environment variables, variables from secrets and configmaps configurable #7
base: master
Are you sure you want to change the base?
Conversation
…ps configurable Signed-off-by: Maria Kotlyarevskaya <[email protected]>
@alexellis hello! This PR is ready for the review. I think that we need to add some section in README to list all of the supported options (I guess more can come, e.g. volumes and scheduling options). What do you think? |
There is probably going to be a need for a namespace too, because sometime the secret you want, or multiple secrets may be in other namespaces. |
hi @alexellis. pod can't use configmap/secret from another namespace.
|
I thought I'd seen a secretRef that took a namespace |
There is no namespace in the envFrom in the Kubernetes API reference |
@alexellis hi. do you have any unanswered questions/concerns in mind? |
@alexellis ping 🙈 |
Hi, I'm on vacation so the ping isn't necessary. I was going to take a look when back. I'm not sure that the design is intuitive perhaps we can make it match the k8s app more closely instead of having a bunch of different envX sections? |
Hey. Sorry for the ping - I thought you missed my message. Regarding your feedback, I was trying to simplify it but faced an issue with underlying structure of K8S API. Under the hood it has few structs inside |
I would suggest that we own/parse our own format with our own structs, then convert it to the K8s objects at deploy time. Like we're doing for the other fields too. Let's have a bit more of a think about how this could work. Do we have a test user or someone who wants this feature that can help design it before we commit to a config format that will be hard to change? This is what I see in the docs env:
- name: SECRET_USERNAME
valueFrom:
secretKeyRef:
name: mysecret
key: username Looks like
We did something similar in the openfaas-cloud bootstrap project: https://github.com/openfaas/ofc-bootstrap/blob/master/example.init.yaml#L39 ## Use DigitalOcean
### Create a Personal Access Token and save it into a file, with no new-lines
- name: "digitalocean-dns"
files:
- name: "access-token"
value_from: "~/Downloads/do-access-token"
filters:
- "do_dns01"
namespace: "cert-manager"
- name: "jwt-public-key"
files:
- name: "key.pub"
value_from: "./tmp/key.pub"
value_command: "openssl ec -in ./tmp/key -pubout -out ./tmp/key.pub"
filters:
- "auth"
namespace: "openfaas" So, there could be a My concern would be that the YAML spec is quite complex, perhaps we should also support files? Files require a list of volumes and volumeMounts and things start to get worse from a UX perspective. apiVersion: v1
kind: Pod
metadata:
name: secret-test-pod
labels:
name: secret-test
spec:
volumes:
- name: secret-volume
secret:
secretName: ssh-key-secret
containers:
- name: ssh-test-container
image: mySshImage
volumeMounts:
- name: secret-volume
readOnly: true
mountPath: "/etc/secret-volume" With OpenFaaS, we really make the spec a lot simpler, for instance, assuming that functions:
fn_name:
secrets:
- aws_access_key Then any secret mentioned is mounted under Alex |
Signed-off-by: Maria Kotlyarevskaya [email protected]
fixes #5
Scope of changes:
If configmap / secret doesn't exist in the specified namespace (if it isn't specified then in default), it throws an error like this:
Tested the following configuration: