rancher / dashboard

The Rancher UI
https://rancher.com
Apache License 2.0
432 stars 239 forks source link

[Bug] Cannot create RKE2 cluster from yaml view #11020

Open jordojordo opened 2 weeks ago

jordojordo commented 2 weeks ago

Setup

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

Result An error banner shows:

```console 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.

Yaml returned for rke2 config ```yaml 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 ```
richard-cox commented 2 weeks ago

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 commented 1 week ago

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.

gaktive commented 1 week ago

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

tomleb commented 1 week ago

@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.

richard-cox commented 1 week ago

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

nwmac commented 20 hours ago

@aalves08 This is one you could pick up if you have capacity - check with @richard-cox - first step is to validate if this is still an issue with the test backend provided