agent kubernetes yaml expects one document, but I'd like to specify more than one

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Because the kubernetes plugin has a work around to specify a runAsUser when using multiple containers, this has led to an inability to copy files as needed (due to permission denied).  To get around this I have been mounting volumes.  This works if I add a secret or configmap to the Jenkins namespace manually.  But, if I want this to be part of a pipeline I would need to include these someone in the pipeline.

      Like so:
      pipeline {
        agent {
          kubernetes {
            yaml '''

              apiVersion: v1
              kind: ConfigMap
              metadata:
                name: values
              data:
                ldap.conf: |
                  TLS_CACERT      /etc/ssl/certs/ca-certificates.crt
              —
              apiVersion: v1
              kind: Pod
              spec:
                securityContext:
                  runAsUser: 1001
                volumes:
                - name: ca-bundle
                  secret:
                    secretName: ca-bundle
                    items:
                    - key: ca-bundle.crt
                      path: ca-certificates.crt
                - name: ldap.conf
                  configMap:
                    name: values
                    items:
                    - key: ldap.conf
                      path: ldap.conf

                containers:
                - name: openldap
                  image: bitnami/openldap
                  tty: true
                  securityContext:
                    privileged: true
                  volumeMounts:
                  - name: ca-bundle
                    mountPath: /etc/ssl/certs
                    readOnly: true
                  - name: values
                    mountPath: /etc/openldap/ldap.conf
                    readOnly: true

      If there is some other way that I can add in additional objects such as a secret or configmap as part of the pipeline please let me know, I am still fairly new to working with Jenkins.

            Assignee:
            Unassigned
            Reporter:
            leland knight
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: