dashboard icon indicating copy to clipboard operation
dashboard copied to clipboard

[Bug] Cannot create RKE2 cluster from yaml view

Open jordojordo opened this issue 9 months ago • 19 comments

Setup

  • Rancher version: v2.9-head (2b53406)
  • Rancher UI Extensions: N/A
  • Browser type & version: FF 125.0.3

Describe the bug

When attempting to provision an RKE2 cluster from the YAML view, the formatting of the generated yaml is incorrect, causing the creation to fail.

To Reproduce

  • Install Rancher v2.9-head
  • Create RKE2 cluster
  • Select "Edit as YAML"
  • Attempt to create the cluster

Result An error banner shows:

bad indentation of a mapping entry (13:56)

10 | ...
11 | ... t
12 | ...
13 | ... ustomization: overrideAffinity: {}
-----------------------------------------^
14 | ...
15 | ... ments: {}

Screenshots

rke2-yaml

Additional context

It appears that the schema returned is broken, there are a few instances with incorrect spacing and two duplicate entries.

  • Incorrect spacing:
    • clusterAgentDeploymentCustomization: overrideAffinity: {}
    • fleetAgentDeploymentCustomization: overrideAffinity: {}
    • rkeConfig: chartValues:
  • duplicate entries:
    • appendTolerations: []
    • overrideResourceRequirements: {}
Yaml returned for rke2 config
apiVersion: provisioning.cattle.io/v1
kind: Cluster
metadata:
  name: #string
  annotations:
    {}
    #  key: string
  labels:
    {}
    #  key: string
  namespace: fleet-default
spec:
  clusterAgentDeploymentCustomization: overrideAffinity: {}
  appendTolerations: []
  overrideResourceRequirements: {}
  defaultPodSecurityAdmissionConfigurationTemplateName: ''
  fleetAgentDeploymentCustomization: overrideAffinity: {}
  appendTolerations: []
  overrideResourceRequirements: {}
  kubernetesVersion: v1.28.9+rke2r1
  localClusterAuthEndpoint:
    caCerts: ''
    enabled: false
    fqdn: ''
  rkeConfig: chartValues:
    rke2-calico: {}
  upgradeStrategy:
    controlPlaneConcurrency: '1'
    controlPlaneDrainOptions:
      deleteEmptyDirData: true
      disableEviction: false
      enabled: false
      force: false
      gracePeriod: -1
      ignoreDaemonSets: true
      skipWaitForDeleteTimeoutSeconds: 0
      timeout: 120
    workerConcurrency: '1'
    workerDrainOptions:
      deleteEmptyDirData: true
      disableEviction: false
      enabled: false
      force: false
      gracePeriod: -1
      ignoreDaemonSets: true
      skipWaitForDeleteTimeoutSeconds: 0
      timeout: 120
  machineGlobalConfig:
    cni: calico
    disable-kube-proxy: false
    etcd-expose-metrics: false
    profile: null
  machineSelectorConfig:
    - config:
        protect-kernel-defaults: false
  etcd:
    disableSnapshots: false
    s3: null
    snapshotRetention: 5
    snapshotScheduleCron: 0 */5 * * *
  registries:
    configs: {}
    mirrors: {}
  machinePools: []
  machineSelectorConfig:
    - config: {}
#  agentEnvVars: string
#  cloudCredentialSecretName: string
#  clusterAPIConfig: string
#  defaultClusterRoleForProjectMembers: string
#  defaultPodSecurityPolicyTemplateName: string
#  enableNetworkPolicy: string
#  redeploySystemAgentGeneration: int
__clone: true

jordojordo avatar May 13 '24 14:05 jordojordo

It looks like a lot of the spec props have lost their hierarchy

image

The schema looks ok, we should check value that goes into the yaml converter

richard-cox avatar May 13 '24 15:05 richard-cox

This could be impacted by https://github.com/rancher/rancher/issues/45157, @MbolotSuse & @tomleb might be able to provide a debug image to validate that fix against this bug.

In the mean time we should still confirm the json object we convert to yaml is correct.

richard-cox avatar May 15 '24 08:05 richard-cox

Taking blocker off for now though this is important to fix before we release 2.9.0

gaktive avatar May 15 '24 15:05 gaktive

@richard-cox I'm working on https://github.com/rancher/rancher/issues/45157 now. I need to rebase my changes on top of @MbolotSuse 's fix, which was also affecting the schema definitions. Once that's done (by EOD) I'll ping you.

EDIT: To clarify, I don't know if the issue I'm working on causes what you see here.

tomleb avatar May 15 '24 16:05 tomleb

Tom has kindly got an image ready for us to test with, check in with him for details

richard-cox avatar May 16 '24 08:05 richard-cox