Home > database >  How to solve this helm error "Error: UPGRADE FAILED: error validating "": error valid
How to solve this helm error "Error: UPGRADE FAILED: error validating "": error valid

Time:11-18

This is a follow-up question to my former question on chart validation here While trying to deploy a helm chart, I have an error that shows thus:

Error: UPGRADE FAILED: error validating "": error validating data: ValidationError(Deployment.spec.template.spec.initContainers[1]): unknown field "mountPath" in io.k8s.api.core.v1.Container
make: *** [upgrade] Error 1

FWIW, this is the initcontainer spec details below:

spec:
      initContainers:
      {{- if .Values.libp2p.staticKeypair.enabled}}
      - name: libp2p-init-my-service
        image: busybox:1.28
        command: ['sh', '-c', '/bin/cp /libp2p-keys/* /root/libp2p-keys && /bin/chmod -R 0700 /root/libp2p-keys/']
        volumeMounts:
        - mountPath: /libp2p-keys
          name: source-libp2p-keys 
        - mountPath: /root/libp2p-keys
          name: destination-libp2p
      {{- end }}
      - name: config-dir
        mountPath: /root/.mina-config
      - name: fix-perms
        image: busybox:1.28
        command: [ 'sh', '-c', 'for dir in keys echo-keys faucet-keys; do [ -d /$dir ] && /bin/cp /$dir/* /wallet-keys; done; /bin/chmod 0700 /wallet-keys']
        volumeMounts:
        - mountPath: "/keys/"
          name: private-keys
          readOnly: true
        - mountPath: /wallet-keys
          name: wallet-keys
      containers:

What could be the possible causes and how can I handle them?

CodePudding user response:

You're working with YAML so take care about the indentation since it's really important.

Since you're declaring initContainers, on the first level you define Containers; but you included the following on that level:

- name: config-dir
  mountPath: /root/.mina-config

Since name is actually an attribute of Container, it complains about mountPath.

I don't know where you want to mount .mina-config, but it should be nested inside of the volumeMounts attribute within a Container and not at the same level than the containers.

  • Related