Skip to content

Invalid helm chart when extraConfigmapMounts specified #4496

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

Closed
jlandowner opened this issue Nov 11, 2021 · 3 comments · Fixed by #4497
Closed

Invalid helm chart when extraConfigmapMounts specified #4496

jlandowner opened this issue Nov 11, 2021 · 3 comments · Fixed by #4497
Labels
bug Something isn't working

Comments

@jlandowner
Copy link
Contributor

When extraConfigmapMounts specified, generated Kubernetes yaml will be invalid.

values.yaml

extraConfigmapMounts:
  - name: certs-configmap
    mountPath: /etc/code-server/ssl/
    subPath: certificates.crt
    configMap: certs-configmap
    readOnly: true

extraSecretMounts:
  - name: secret-files
    mountPath: /etc/secrets
    secretName: code-server-secret-files
    readOnly: true
$ helm install -n default code-server ./ci/helm-chart/ -f values.yaml 
Error: INSTALLATION FAILED: Deployment.apps "code-server" is invalid: spec.template.spec.containers[0].volumeMounts[1].name: Not found: "certs-configmap"

Actual

$ helm template code-server ./ci/helm-chart/ -f values.yaml 
...
---
# Source: code-server/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: code-server
  labels:
    app.kubernetes.io/name: code-server
    helm.sh/chart: code-server-1.0.5
    app.kubernetes.io/instance: code-server
    app.kubernetes.io/managed-by: Helm
spec:
  replicas: 1
  strategy:
    type: Recreate
  selector:
    matchLabels:
      app.kubernetes.io/name: code-server
      app.kubernetes.io/instance: code-server
  template:
    metadata:
      labels:
        app.kubernetes.io/name: code-server
        app.kubernetes.io/instance: code-server
    spec:
      securityContext:
        fsGroup: 1000
      initContainers:
      - name: init-chmod-data
        image: busybox:latest
        imagePullPolicy: IfNotPresent
        command:
          - sh
          - -c
          - |
            chown -R 1000:1000 /home/coder
        securityContext:
          runAsUser: 0
        volumeMounts:
        - name: data
          mountPath: /home/coder
      containers:
        - name: code-server
          image: "codercom/code-server:3.12.0"
          imagePullPolicy: Always
          securityContext:
            runAsUser: 1000
          env:
          - name: PASSWORD
            valueFrom:
              secretKeyRef:
                name: code-server
                key: password
          volumeMounts:
          - name: data
            mountPath: /home/coder
          - name: certs-configmap
            mountPath: /etc/code-server/ssl/
            subPath: certificates.crt
            readOnly: true
          - name: secret-files
            mountPath: /etc/secrets
            readOnly: true
          ports:
            - name: http
              containerPort: 8080
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {}
      serviceAccountName: code-server
      volumes:
      - name: data
        persistentVolumeClaim:
          claimName: code-server
      - name: secret-files
        secret:
          secretName: code-server-secret-files
          defaultMode:
# ↑ configMap is missing in volumes.
---
...

Expected

...
     volumes:
      - name: data
        persistentVolumeClaim:
          claimName: code-server
     - name: certs-configmap
        configMap:
          name: code-server-certs-configmap
          defaultMode:
      - name: secret-files
        secret:
          secretName: code-server-secret-files
          defaultMode:
...
@jsjoeio jsjoeio added the bug Something isn't working label Nov 12, 2021
@jsjoeio
Copy link
Contributor

jsjoeio commented Nov 12, 2021

Nice catch and thanks for opening a PR!

@jsjoeio jsjoeio added this to the 4.0.0 milestone Nov 12, 2021
@weiyentan
Copy link

weiyentan commented Mar 26, 2024

which helm chart repo is this added to? I m experiencing the same issue of a release that was added in June 2021....

here
https://code-server-boilerplates.github.io/charts

@code-asher
Copy link
Member

This was for the Helm chart in this repo, I am not sure what the deal is with code-server-boilerplates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants