Using Secrets as "environment variables" in containerTemplate of jenkins-kubernetes-plugin

300 views
Skip to first unread message

YAN-HONG WANG

unread,
Aug 10, 2017, 3:15:09 PM8/10/17
to Jenkins Users
Hi,

In jenkins-kubernetes-plugin, is there any syntax that support using Secrets as environment variables in containerTemplate?

I just saw something from here.
https://kubernetes.io/docs/concepts/configuration/secret/#using-secrets-as-environment-variables

So some syntax like "secretKeyRef" could be indicated in containerTemplate?

apiVersion: v1
kind: Pod
metadata:
  name: secret-env-pod
spec:
  containers:
    - name: mycontainer
      image: redis
      env:
        - name: SECRET_USERNAME
          valueFrom:
            secretKeyRef:
              name: mysecret
              key: username
        - name: SECRET_PASSWORD
          valueFrom:
            secretKeyRef:
              name: mysecret
              key: password
  restartPolicy: Never


Thanks.

Best regards,
Hong

Carlos Sanchez

unread,
Aug 10, 2017, 3:27:49 PM8/10/17
to Jenkins Users

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/a4be1cee-cfd4-48d8-a97e-fa5c30d95ce6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

WANG, YAN-HONG

unread,
Aug 10, 2017, 4:42:22 PM8/10/17
to jenkins...@googlegroups.com
@Carlos, Thanks!!!

--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/vAZbO6gCgIY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CALHFn6Mht9PHnX7WNFMranPz-J6VvPaQkrx8ci_pDBQ1dGQXcA%40mail.gmail.com.

YAN-HONG WANG

unread,
Aug 16, 2017, 8:54:02 AM8/16/17
to Jenkins Users
Hello Carlos:

Is method "secretEnvVar" already in Kubernetes plugin 0.12? Or that will be released in nearly future 0.13?

Because I got the error message like this ...
java.lang.NoSuchMethodError: No such DSL method 'secretEnvVar' found among steps 

Thanks very much.

Best regards,
Hong

Am Donnerstag, 10. August 2017 22:42:22 UTC+2 schrieb YAN-HONG WANG:
@Carlos, Thanks!!!


--
You received this message because you are subscribed to a topic in the Google Groups "Jenkins Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/jenkinsci-users/vAZbO6gCgIY/unsubscribe.

Carlos Sanchez

unread,
Aug 16, 2017, 10:59:53 AM8/16/17
to Jenkins Users
will be in 0.13

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.

YAN-HONG WANG

unread,
Aug 16, 2017, 12:54:25 PM8/16/17
to Jenkins Users
@Carlos, thanks very much.
will be in 0.13

To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages