rancher / capi-ui-extension

Rancher Extension used in rancher/dashboard for Rancher Turtles CAPI Provisioning UI.
Apache License 2.0
8 stars 7 forks source link

[BUG] Variables value getting encoded while creating provider #49

Closed cpinjani closed 2 months ago

cpinjani commented 2 months ago

Setup Rancher version: v2.8-head Rancher Turtles: v0.6.0 Rancher UI Extensions: CAPI UI Extension v0.4.0 Browser type & version: Chrome Latest

To Reproduce

Expected Result Variables value must remain as string while creating provider. For AWS example, CAPA_LOGLEVEL:4 get encoded and provider does not come up due to error, invalid argument "NA==" for "-v, --v" flag: strconv.ParseUint: parsing "NA==": invalid syntax

Payload

{
  "type": "turtles-capi.cattle.io.capiprovider",
  "metadata": {
    "namespace": "capa-system",
    "annotations": {

    },
    "labels": {

    },
    "name": "aws"
  },
  "spec": {
    "name": "aws",
    "type": "infrastructure",
    "configSecret": {
      "name": "aws-credentials-zg1xz"
    },
    "credentials": {
      "rancherCloudCredentialNamespaceName": "cattle-global-data:cc-8g9pk"
    },
    "features": {
      "clusterResourceSet": true,
      "clusterTopology": true,
      "machinePool": true
    },
    "variables": {
      "CAPA_LOGLEVEL": "NA=="
    }
  }
}

Screenshots image

image

cc: @richardcase

richardcase commented 2 months ago

@Danil-Grigorev - what do you think to this?

Danil-Grigorev commented 2 months ago

We don’t do any pre-processing to the variables provided in the field. I checked:

apiversion: turtles-capi.cattle.io/v1alpha1
kind: CAPIProvider
metadata:
  name: cluster-api
  namespace: capi-system
spec:
  additionalManifests:
    name: capi-additional-rbac-roles
    namespace: capi-system
  configSecret:
    name: capi-env-variables
  name: cluster-api
  type: core
  variables:
    IT_IS_VAR: "4"

This is stored in the secret.

apiversion: v1
data:
  CLUSTER_TOPOLOGY: dHJ1ZQ==
  EXP_CLUSTER_RESOURCE_SET: dHJ1ZQ==
  EXP_MACHINE_POOL: dHJ1ZQ==
  IT_IS_VAR: NA==

It means that UI is encoding value somehow.