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

Write Keptn Tasks: Secret text is misleading #755

Closed
agardnerIT opened this issue Feb 3, 2023 · 2 comments
Closed

Write Keptn Tasks: Secret text is misleading #755

agardnerIT opened this issue Feb 3, 2023 · 2 comments

Comments

@agardnerIT
Copy link
Contributor

Kubernetes secrets can also be passed to the function using the secureParameters field. Here, the secret value is the K8s secret name that will be mounted into the runtime and made available to the function via the environment variable SECURE_DATA.

This leads me to believe I can do:

kubectl -n default create secret generic test-secret \
--from-literal=foo=bar \
--from-literal=foo2=bar2

apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnTaskDefinition
metadata:
  name: dummy-task
  namespace: "default"
spec:
  function:
    secureParameters:
      secret: test-secret
    inline:
      code: |
		let secret_values = Deno.env.get('SECURE_DATA');
                // Somehow get `foo` and `bar` from `secret_values`

But I cannot. In reality, my secret must take a certain form with SECURE_DATA as the key:

kubectl -n default create secret generic test-secret \
--from-literal=SECURE_DATA=foo

Which is fine, but then:

a) Keptn is forcing me to change the way I handle secrets
b) I need 2 secrets now, not one

For b) I cannot reference multiple secrets in a KeptnTaskDefinition. The following is not possible:

# assume 2x secrets: foo-secret and bar-secret exist

apiVersion: lifecycle.keptn.sh/v1alpha2
kind: KeptnTaskDefinition
metadata:
  name: dummy-task
  namespace: "default"
spec:
  function:
    secureParameters:
      secret: foo-secret
      secret2: bar-secret

So I try to use a file:

# secret_file.json
# {
#    "foo": "bar",
#    "foo2": "bar2"
# }

kubectl -n default create secret generic file-secret --from-file ~/temp/secret_file.json

Yet I still get the SECURE_DATA error.

@agardnerIT
Copy link
Contributor Author

Please assign to me. I will work on this.

@agardnerIT
Copy link
Contributor Author

#781 closes this. It has been merged and I can see it in the (currently upcoming) 0.6.0 release so I will close this: #592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant