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

Kustomize fails to patch controller Deployment #1629

Closed
mvgmb opened this issue Jun 14, 2023 · 0 comments · Fixed by #1630
Closed

Kustomize fails to patch controller Deployment #1629

mvgmb opened this issue Jun 14, 2023 · 0 comments · Fixed by #1630
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@mvgmb
Copy link
Contributor

mvgmb commented Jun 14, 2023

/kind bug

What happened?

When applying multiple patches to the deploy manifests via Kustomize (v5.0.3+), it fails to build with the following error:

$ kustomize build ./deploy/kubernetes/overlays/stable 
Error: updating name reference in 'spec/template/spec/containers/envFrom/configMapRef/name' field of 'Deployment.v1.apps/ebs-csi-controller.kube-system': considering field 'spec/template/spec/containers/envFrom/configMapRef/name' of object Deployment.v1.apps/ebs-csi-controller.kube-system: visit traversal on path: [envFrom configMapRef name]: expected sequence or mapping node

It expects the spec/template/spec/containers/envFrom field to be a sequence or mapping node, however, it's null.

What you expected to happen?

I expected both patches to be applied.

How to reproduce it (as minimally and precisely as possible)?

Add the following patches to the deploy/kubernetes/overlays/stable/kustomization.yaml:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
  - ./ecr-public
patches:
  - patch: '[{"op": "add","path": "/spec/template/spec/containers/0/args/-","value": "--http-endpoint=:8080"}]'
    target:
      group: apps
      version: v1
      kind: Deployment
      name: ebs-csi-controller
  - patch: |-
      apiVersion: apps/v1
      kind: Deployment
      metadata:
        namespace: kube-system
        name: ebs-csi-controller
      spec:
        template:
          metadata:
            annotations:
              prometheus.io/port: '8080'
              prometheus.io/scrape: 'true'

Then run:

kustomize build ./deploy/kubernetes/overlays/stable 

Anything else we need to know?

This problem can be solved by avoiding generating empty envFrom fields from the Helm charts.


Environment

  • Kubernetes version (use kubectl version): N/A
  • kustomize version: v5.0.3
  • Driver version: v1.19.0
@k8s-ci-robot k8s-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants