Uploaded image for project: 'Red Hat Internal Developer Platform'
  1. Red Hat Internal Developer Platform
  2. RHIDP-3260

Renamed optional secret dynamic-plugins-npmrc in helm chart

Prepare for Y ReleasePrepare for Z ReleaseRemove QuarterXMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • 1.3
    • 1.2
    • Helm Chart
    • 1
    • False
    • Hide

      None

      Show
      None
    • False
    • Hide
      Before this update, the Helm Chart was using an unversioned name for the dynamic-plugins-npmrc secret.
      Therefore subsequent Helm deployments of the RHDH Helm Chart version 1.2.1 failed after the first deployment with an error that a secret named dynamic-plugins-npmrc exists and is not owned by the current release.

      With this update, the Helm Chart creates and uses a dynamic-plugins-npmrc secret that is named in line with the other resources managed by the Helm Chart: `_<release-name>_-dynamic-plugins-npmrc`.
      As a result, the Helm Chart does not fail on the previous error.
      Show
      Before this update, the Helm Chart was using an unversioned name for the dynamic-plugins-npmrc secret. Therefore subsequent Helm deployments of the RHDH Helm Chart version 1.2.1 failed after the first deployment with an error that a secret named dynamic-plugins-npmrc exists and is not owned by the current release. With this update, the Helm Chart creates and uses a dynamic-plugins-npmrc secret that is named in line with the other resources managed by the Helm Chart: `_<release-name>_-dynamic-plugins-npmrc`. As a result, the Helm Chart does not fail on the previous error.
    • Bug Fix
    • Done
    • RHDH Core Team 3260, RHDH Core Team 3261, RHDH Core Team 3262, RHDH Core Team 3263
    • Low

      Description of problem:

      We have a need to deploy a number of instances of RHDH in a single namespace and use the dynamic-plugins-npmrc "secret".
      The dynamic-plugins-npmrc "secret" is created using the backstage/templates/extra-list.yaml mechanism so that all objects needed for the deployment are created by the Helm chart.

      Subsequent Helm deployments of the RHDH Helm Chart version 1.2.1 fail after the first deployment with an error that a secret named dynamic-plugins-npmrc  exists and is not owned by the current release.

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

      1.  

      Actual results:

       

      Expected results:

      As a best practice when writing Helm charts, all object created by the chart are generally prefixed with the Helm '.Release.Name' built-in value to allow for more than one Helm "release" in a single namespace.

      RHDH Helm Chart version 1.2.1 does not follow this convention for the "dynamic-plugins-npmrc" secret as it uses a hardcoded name.

      Reproducibility (Always/Intermittent/Only Once):

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

       
      The issue is with the extraVolumes code block in Red Hat's RHDH Helm Chart version 1.2.1 values.yaml file:

       

          extraVolumes:
            # -- Ephemeral volume that will contain the dynamic plugins installed by the initContainer below at start.
            - name: dynamic-plugins-root
              ephemeral:
                volumeClaimTemplate:
                  spec:
                    accessModes:
                      - ReadWriteOnce
                    resources:
                      requests:
                        # -- Size of the volume that will contain the dynamic plugins. It should be large enough to contain all the plugins.
                        storage: 2Gi
            - name: audit-log-data
              persistentVolumeClaim:
                claimName: '{{ printf "%s-audit-log" .Release.Name }}'
            # Volume that will expose the `dynamic-plugins.yaml` file from the `dynamic-plugins` config map.
            # The `dynamic-plugins` config map is created by the helm chart from the content of the `global.dynamic` field.
            - name: dynamic-plugins
              configMap:
                defaultMode: 420
                name: '{{ printf "%s-dynamic-plugins" .Release.Name }}'
                optional: true
            # Optional volume that allows exposing the `.npmrc` file (through a `dynamic-plugins-npmrc` secret)
            # to be used when running `npm pack` during the dynamic plugins installation by the initContainer.
            - name: dynamic-plugins-npmrc
              secret:
                defaultMode: 420
                optional: true
                secretName: dynamic-plugins-npmrc
            - name: npmcacache
              emptyDir: {}
      

       
      In version 1.2.1 of the RHDH Helm Chart, the last "secretName" (above) is hardcoded as "dynamic-plugins-npmrc".
      My colleague and I are developing two sets of features at a customer and we both need to work in the same assigned Kubernetes namespace using two different Helm "releases" of RHDH and each has a dynamic-plugins-npmrc secret specified under "extraDeploy" in our own values.yaml file.  This works when installing the first Helm release, however when installing the second Helm release, it fails due to the existence of a secret named "dynamic-plugins-npmrc" that it does not own.
      The workaround that we currenly use is to change the dynamic-plugins-npmrc secret name in our values.yaml files. However, because "extraVolumes" is an array, and Helm does not support appending to or overwritting an array in a values.yaml file, the entire "extraVolumes" block needs to be copied to each of our values files. This is inconvenient and should not be necessary.

       

      Ideally the hardcoded dynamic-plugins-npmrc secret name should appear as:

      secretName: '{{.Release.Name}}-dynamic-plugins-npmrc'

            cdaley Corey Daley
            cdaley Corey Daley
            RHIDP - Install
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: