charts icon indicating copy to clipboard operation
charts copied to clipboard

[WIP] POC PR for merging `extra*` fields

Open rm3l opened this issue 6 months ago • 26 comments

Description of the change

This is a draft POC PR to illustrate the proposal in #269

Existing or Associated Issue(s)

Fixes #269

Additional Information

helm template
$ helm template charts/backstage --values charts/backstage/ci/test-merge-extraEnvVars-values.yaml
---
[...]
---
# Source: backstage/charts/upstream/templates/backstage-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: release-name-developer-hub
  namespace: "my-ns"
  labels: 
    app.kubernetes.io/name: developer-hub
    helm.sh/chart: upstream-2.5.3
    app.kubernetes.io/instance: release-name
    app.kubernetes.io/managed-by: Helm
    app.kubernetes.io/component: backstage
  annotations:
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app.kubernetes.io/name: developer-hub
      app.kubernetes.io/instance: release-name
      app.kubernetes.io/component: backstage
  template:
    metadata:
      labels:
        app.kubernetes.io/name: developer-hub
        helm.sh/chart: upstream-2.5.3
        app.kubernetes.io/instance: release-name
        app.kubernetes.io/managed-by: Helm
        app.kubernetes.io/component: backstage
      annotations:
        checksum/app-config: a51552987cdb96e1fb3edccca2150e003a888839c9ff5894826e4771b17fdd3c
        checksum/dynamic-plugins: 'f1f9a92f14a31362d7eb30e67ac1458faf1c685765610f93a8967194d8bc1a5f'
    spec:
      serviceAccountName: default
      volumes:
        - ephemeral:
            volumeClaimTemplate:
              spec:
                accessModes:
                - ReadWriteOnce
                resources:
                  requests:
                    storage: 5Gi
          name: dynamic-plugins-root
        - configMap:
            defaultMode: 420
            name: 'release-name-dynamic-plugins'
            optional: true
          name: dynamic-plugins
        - name: dynamic-plugins-npmrc
          secret:
            defaultMode: 420
            optional: true
            secretName: 'release-name-dynamic-plugins-npmrc'
        - name: dynamic-plugins-registry-auth
          secret:
            defaultMode: 416
            optional: true
            secretName: 'release-name-dynamic-plugins-registry-auth'
        - emptyDir: {}
          name: npmcacache
        - emptyDir: {}
          name: temp
        - name: backstage-app-config
          configMap:
            name: release-name-developer-hub-app-config
      
      initContainers:
        - command:
          - ./install-dynamic-plugins.sh
          - /dynamic-plugins-root
          env:
          - name: NPM_CONFIG_USERCONFIG
            value: /opt/app-root/src/.npmrc.dynamic-plugins
          - name: MAX_ENTRY_SIZE
            value: "30000000"
          image: 'quay.io/rhdh/rhdh-hub-rhel9:latest'
          imagePullPolicy: Always
          name: install-dynamic-plugins
          resources:
            limits:
              cpu: 1000m
              ephemeral-storage: 5Gi
              memory: 2.5Gi
            requests:
              cpu: 250m
              memory: 256Mi
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
          volumeMounts:
          - mountPath: /dynamic-plugins-root
            name: dynamic-plugins-root
          - mountPath: /opt/app-root/src/dynamic-plugins.yaml
            name: dynamic-plugins
            readOnly: true
            subPath: dynamic-plugins.yaml
          - mountPath: /opt/app-root/src/.npmrc.dynamic-plugins
            name: dynamic-plugins-npmrc
            readOnly: true
            subPath: .npmrc
          - mountPath: /opt/app-root/src/.config/containers
            name: dynamic-plugins-registry-auth
            readOnly: true
          - mountPath: /opt/app-root/src/.npm/_cacache
            name: npmcacache
          - mountPath: /tmp
            name: temp
          workingDir: /opt/app-root/src
      containers:
        - name: backstage-backend
          image: quay.io/rhdh/rhdh-hub-rhel9:latest
          imagePullPolicy: "Always"
          securityContext:
            allowPrivilegeEscalation: false
            capabilities:
              drop:
              - ALL
            readOnlyRootFilesystem: true
            runAsNonRoot: true
            seccompProfile:
              type: RuntimeDefault
          args:
            - "--config"
            - "dynamic-plugins-root/app-config.dynamic-plugins.yaml"
            - "--config"
            - "/opt/app-root/src/app-config-from-configmap.yaml"
          resources:
            limits:
              cpu: 1000m
              ephemeral-storage: 5Gi
              memory: 2.5Gi
            requests:
              cpu: 250m
              memory: 1Gi
          readinessProbe:
            failureThreshold: 3
            httpGet:
              path: /.backstage/health/v1/readiness
              port: backend
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 2
            timeoutSeconds: 4
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /.backstage/health/v1/liveness
              port: backend
              scheme: HTTP
            periodSeconds: 10
            successThreshold: 1
            timeoutSeconds: 4
          startupProbe:
            failureThreshold: 3
            httpGet:
              path: /.backstage/health/v1/liveness
              port: backend
              scheme: HTTP
            initialDelaySeconds: 30
            periodSeconds: 20
            successThreshold: 1
            timeoutSeconds: 4
          env:
            - name: APP_CONFIG_backend_listen_port
              value: "7007"
            - name: POSTGRES_HOST
              value: release-name-postgresql
            - name: POSTGRES_PORT
              value: "5432"
            - name: POSTGRES_USER
              value: bn_backstage
            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: release-name-postgresql
                  key: password
            -
              name: BACKEND_SECRET
              valueFrom:
                secretKeyRef:
                  key: backend-secret
                  name: 'release-name-auth'
            -
              name: HTTP_PROXY
              valueFrom:
                secretKeyRef:
                  key: http-proxy
                  name: my-super-secret
            -
              name: POSTGRESQL_ADMIN_PASSWORD
              valueFrom:
                secretKeyRef:
                  key: postgres-password
                  name: 'release-name-postgresql'
            -
              name: LOG_LEVEL
              value: debug
          ports:
            - name: backend
              containerPort: 7007
              protocol: TCP
          volumeMounts:
            - name: backstage-app-config
              mountPath: "/opt/app-root/src/app-config-from-configmap.yaml"
              subPath: app-config.yaml
            - mountPath: /opt/app-root/src/dynamic-plugins-root
              name: dynamic-plugins-root
            - mountPath: /tmp
              name: temp
---
[...]
  • This other branch illustrates how the changes here remain 100% backward compatible when extraEnvVars is an array. See the test values file highlighting the current behavior where we need to replicate all the chart default elements.

Checklist

  • [ ] Chart version bumped in Chart.yaml according to semver.
  • [ ] Variables are documented in the values.yaml and added to the README.md. The helm-docs utility can be used to generate the necessary content. Use helm-docs --dry-run to preview the content.
  • [ ] JSON Schema generated.
  • [ ] List tests pass for Chart using the Chart Testing tool and the ct lint command.

rm3l avatar Jul 08 '25 21:07 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Jul 16 '25 06:07 github-actions[bot]

not stale

rm3l avatar Jul 16 '25 09:07 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Jul 24 '25 06:07 github-actions[bot]

not stale

rm3l avatar Jul 25 '25 07:07 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Aug 03 '25 06:08 github-actions[bot]

@rm3l Did you want me to reopen this? I noticed the stalebot won the stale/not-stale battle 😄

ChrisJBurns avatar Aug 13 '25 23:08 ChrisJBurns

@ChrisJBurns I'm just back from vacation and noticed your ping. Yes, please if you can reopen this. And any feedback on #269 would be much appreciated. Thanks.

rm3l avatar Aug 21 '25 20:08 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Aug 31 '25 06:08 github-actions[bot]

not stale

rm3l avatar Aug 31 '25 12:08 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Sep 08 '25 06:09 github-actions[bot]

not stale

rm3l avatar Sep 08 '25 18:09 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Sep 17 '25 06:09 github-actions[bot]

not stale

rm3l avatar Sep 21 '25 12:09 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Sep 30 '25 06:09 github-actions[bot]

not stale

rm3l avatar Oct 03 '25 16:10 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Oct 12 '25 06:10 github-actions[bot]

not stale

rm3l avatar Oct 12 '25 20:10 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Oct 21 '25 06:10 github-actions[bot]

not stale

rm3l avatar Oct 21 '25 06:10 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Oct 30 '25 06:10 github-actions[bot]

not stale

rm3l avatar Oct 30 '25 09:10 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Nov 08 '25 06:11 github-actions[bot]

not stale

rm3l avatar Nov 08 '25 07:11 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Nov 17 '25 06:11 github-actions[bot]

not stale

rm3l avatar Nov 17 '25 06:11 rm3l

This PR has been automatically marked as stale because it has not had recent activity from the author. It will be closed if no further activity occurs. If the PR was closed and you want it re-opened, let us know and we'll re-open the PR so that you can continue the contribution!

github-actions[bot] avatar Nov 26 '25 06:11 github-actions[bot]