Skip to content

Commit

Permalink
fix 2
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesfrey committed May 8, 2024
1 parent ade5bbd commit 6ad1417
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/cli/create_helm.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,16 @@ func CreateHelm(ctx context.Context, options *CreateOptions, globalFlags *flags.

// parse config
cfg := &config.Config{}
err = cfg.UnmarshalYAMLStrict(data)
if errors.Is(err, config.ErrInvalidConfig) {
if err := cfg.UnmarshalYAMLStrict(data); err != nil {
// TODO Delete after vCluster 0.19.x resp. the old config format is out of support.
// It also might be a legacy config, so we try to parse it as such.
// We cannot discriminate between k0s/k3s and eks/k8s. So we cannot prompt the actual values to convert, as this would cause false positives,
// because users are free to e.g. pass a k0s values file to a currently running k3s virtual cluster.
if isLegacyConfig(data) {
return fmt.Errorf("it appears you are using a vCluster configuration using pre-v0.20 formatting. Please run %q to convert the values to the latest format", "vcluster convert config")
}
// TODO end
return err
} else if err != nil {
return err
}

// TODO(johannesfrey): Here, we need to validate the current config (possibly migrated) against the given config regarding a potential distro/backingstore change.
Expand Down Expand Up @@ -315,6 +313,7 @@ func isVClusterDeployed(release *helm.Release) bool {
release.Secret.Labels["status"] == "deployed"
}

// TODO Delete after vCluster 0.19.x resp. the old config format is out of support.
func isLegacyVCluster(version string) bool {
if version == upgrade.DevelopmentVersion {
return false
Expand All @@ -334,6 +333,8 @@ func isLegacyConfig(values []byte) bool {
return true
}

// TODO end

func getBase64DecodedString(values string) (string, error) {
strDecoded, err := base64.StdEncoding.DecodeString(values)
if err != nil {
Expand Down

0 comments on commit 6ad1417

Please sign in to comment.