-
Bug
-
Resolution: Unresolved
-
Minor
-
None
Agent declaration with yaml template:
inheritFrom 'k8s-dind' yamlMergeStrategy merge() yaml """ apiVersion: v1 kind: Pod spec: containers: - name: apaasdevops image: <repo_URL>/apaas/apaas-devops:1.20 workingDir: /home/jenkins command: ['cat'] tty: true """
Agent declaration with container template:
inheritFrom 'k8s-dind' containerTemplate { name 'apaasdevops' image '<repo_name>/apaas/apaas-devops:1.20' workingDir '/home/jenkins' ttyEnabled true command 'cat' args '' }
Container templates inherit the env and volume mounts from parent pod as shown below
spec: containers: - command: - "cat" env: - name: "DOCKER_HOST" value: "tcp://<IP_ADDRESS>" image: "*****/apaas/apaas-devops:1.20" imagePullPolicy: "IfNotPresent" name: "apaasdevops" resources: limits: {} requests: {} securityContext: privileged: false tty: true volumeMounts: - mountPath: "/var/lib/docker" name: "volume-0" readOnly: false - mountPath: "/home/jenkins" name: "workspace-volume" readOnly: false workingDir: "/home/jenkins" - args: - "-disableHttpsCertValidation" - "********"
But yaml template is not not inheriting volume mounts and env even though yamlMergeStrategy merge() is used while defining agent
spec: containers: - command: - "cat" image: "*****/apaas/apaas-devops:1.20" name: "apaasdevops" tty: true volumeMounts: - mountPath: "/home/jenkins" name: "workspace-volume" readOnly: false workingDir: "/home/jenkins" - args: - "-disableHttpsCertValidation" - "********"
kubernetes plugin used is 1.25.4 version
Below volume mount is configured in parent pod 'k8s-dind' which is not getting inherited in yaml template but gets inherited in container template
- mountPath: "/var/lib/docker" name: "volume-0" readOnly: false
Team, any update on this ticket please ?