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

Support for env.valueFrom using configMapKeyRef and secretKeyRef #33

Closed
andyedwardsibm opened this issue Jan 9, 2019 · 5 comments
Closed
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@andyedwardsibm
Copy link
Contributor

This operator is exactly what we're looking for, but our use of secrets involves explicitly pulling in individual secrets to the deployment as separate envs. Wave only considers whole ConfigMap/Secret entries in the containers.envFrom and volumes.volumeSource sections though.

For example, for the deployment snippet below, changes to EXPLICIT_A in ConfigMap config-explicit, and SECRET_A in Secret secrets are not noticed.

...
          env:
            # Explicit config
            - name: EXPLICIT_A
              valueFrom:
                configMapKeyRef:
                  name: config-explicit
                  key: EXPLICIT_A
            # Explicit secrets
            - name: SECRET_A
              valueFrom:
                secretKeyRef:
                  name: secrets
                  key: SECRET_A
          # Global config
          envFrom:
            - configMapRef:
                name: config-global
...

I've been prototyping some changes in a fork that includes discovery of env entries, and only includes the data from the specified *KeyRef in the hash calculation. This has basically involved adding a new ConfigObject type and putting the Object inside (so Wave can still pass it to k8s), along with metadata on whether an individual field is specified, and what that field is (that can be used by the hashing code). I have something that seems to work in a minikube test environment. Would you be open to me submitting a PR?

@JoelSpeed
Copy link
Collaborator

You're right, Wave should definitely include support for these! I completely missed this when doing the original implementation

At present, when parsing we just hash the whole configmap/secret for simplicity's sake, so I'd be tempted to start with a PR to add the parsing of the envVar section and just adding the whole secret/configmap (as we do with other sources) and then follow up with a second PR which makes the changes to only hash the individual keys within the secrets and configmaps.

WDYT?

@JoelSpeed JoelSpeed added bug Something isn't working enhancement New feature or request labels Jan 9, 2019
@andyedwardsibm
Copy link
Contributor Author

That's a possibility, yes, and I might be able to whip up a quick PR, but for our use case we'd want the final behaviour of spotting individual key changes.

I'm really close to finishing the code that handles specific keyed items: I've just got to handle the optional field and those fields being potentially missing (and extend the unit tests for that situation).

@andyedwardsibm
Copy link
Contributor Author

PR submitted (#34) that includes the env section, only using the specified keys in the hash, and handling the optional flag as best I can.

@JoelSpeed
Copy link
Collaborator

@andyedwardsdfdl Can this issue be closed now #34 is merged?

@andyedwardsibm
Copy link
Contributor Author

Yep, I believe this is now resolved, and ready to go into the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants