Uploaded image for project: 'Multicloud'
  1. Multicloud
  2. MULTICLOUD-1295

Bug in Multicloud K8S Plugin Detemplating

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Medium
    • Resolution: Done
    • Guilin Release
    • Honolulu Release
    • MULTICLOUD-K8S

    Description

      *Bug in Multicloud K8S Plugin Detemplating
      *
      K8S Plugin is unable to detemplate Helm Charts (apiVersion v1) which otherwise get installed without error using Helm 2 on the CLI.

      The Helm chart snippet is –
      spec:

      {{- if (.Values.global) and (.Values.global.nodeSelector) }}

      Helm without change:

      • Helm 3.3.4 CLI - Error 1
      • Helm 2.17.0 CLI - Error 1
      • ONAP K8s - Error 1

      Helm with change 1:

      • Helm 3.3.4 CLI - No error
      • Helm 2.17.0 CLI - No error
      • ONAP K8S - Error 2

      Helm with change 2:

      • Helm 3.3.4 CLI - No error
      • Helm 2.17.0 CLI - No error
      • ONAP K8S - Error 2

      Error 1: render error in "cucp/charts/xx/templates/deployment.yaml": template: cucp/charts/xx/templates/deployment.yaml:22:13: executing "cucp/charts/xx/templates/deployment.yaml" at <(.Values.global) and (.Values.global.nodeSelector)>: can't give argument to non-function .Values.global

      Error 2: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Create': was expecting ('true', 'false' or 'null')

      at [Source: (String)"Create Kubernetes Resources: Error creating kind: /v1, Kind=ConfigMap: Error in plugin ConfigMap plugin: Create object error: configmaps "xx-1.0-static-cfg" already exists"; line: 1, column: 7]

      Change 1: different "if" statements instead of one "if" with multiple conditions. Check this example as discussed here github.com/rook/rook/issues/5378

      Change 2: Rewrite the "if" in this manner: {{- if and (.Values.global) (.Values.global.nodeSelector) }}

      Regarding Error 2, this error is often thrown by K8S Plugin for unrelated issues. In this case, all the K8S resources are being created in their own namespace, and it occurred on the first run also. We have earlier successfully installed K8S resources from a single Helm Chart package repeatedly through K8S Plugin in their own namespaces.

      Earlier in another case, this error has been encountered for a syntax error in the Helm chart, which means that K8S Plugin shows unrelated incorrect error messages.

      There is no syntax error in the Helm charts after Change 1 and Change 2, since they are installed in the Helm 2 and Helm 3 CLIs without errors. The bug therefore lies in the K8S detemplating mechanism.

      Update:
      We observed another issue:

      1. When any resource in the Helm chart is being conditionally created, and the condition for its creation evaluates to false, the resource should not be created, but K8S is trying to create the resource as a Null object.

      This issue is fixed with the Helm-3 patch, and K8S plugin could also successfully process the Helm Charts after we changed the IF statements as per Change 1 / 2.

      Hence the status now is:
      Helm without change:

      • Helm 3.3.4 CLI - Error 1
      • Helm 2.17.0 CLI - Error 1
      • ONAP K8s - Error 1

      Helm with change 1:

      • Helm 3.3.4 CLI - No error
      • Helm 2.17.0 CLI - No error
      • ONAP K8S - No error

      Helm with change 2:

      • Helm 3.3.4 CLI - No error
      • Helm 2.17.0 CLI - No error
      • ONAP K8S - No error

      Attachments

        # Subject Branch Project Status CR V

        Activity

          People

            kbanka Konrad Bańka
            sangeetabellara Sangeeta Nitin Bellara
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: