Workloads may be generated by custom scripts and templates. In cases where there is logic to inject environment entries, such as spring.application.name, duplicate values may be injected into spec.template.spec.containers[0].env[]. This will result in failed application builds and an error shown below:
error 02-Apr-2025 02:32:03 Error waiting for ready condition: Failed to become ready: unable to apply object [####/####] for resource [config-provider] in supply chain [source-noscan-to-url]: create: PodIntent.conventions.carto.run "#####" is invalid: spec.template.spec.containers[0].env[11]: Duplicate value: map[string]interface {}{"name":"spring.application.name"} simple 02-Apr-2025 02:32:03 Failing task since return code of [/opt/********/********-mvn-config/tanzu-tools/build-scripts/tanzu-execute-workload.sh -k /opt/********/********-mvn-config/tanzu-tools/config/kubeconfig-production-tap-build.yml -t true -w 30m] was 1 while expected 0 simple 02-Apr-2025 02:32:03 Finished task 'Tanzu create workload' with result: Failed
Create workload: --- apiVersion: carto.run/v1alpha1 kind: Workload metadata: ... spec: env: - name: APP_NAME valueFrom: configMapKeyRef: key: APP_NAME name: #### - name: spring.application.name valueFrom: configMapKeyRef: key: spring.application.name name: #### ... - name: spring.application.name value: ####
TAP v1.12.2
In TAP v1.12.2, creatingPodIntent.conventions.carto.run on Kubernetes with duplicate entries at spec.template.spec.containers[0].env[] is not allowed any more.
CRD validation is catching the duplicate fields error. It is a built in validation from KEP-2876. Customer will need to manually remove all duplicate keys.
https://github.com/kubernetes/kubernetes/blob/b4d139094698687043b36f1c378dfeb1b654198a/staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/validation/validation.go#L66-L70