Skip to content

Commit d54259f

Browse files
José SilvaJosé Silva
authored andcommitted
fix: returning an error when vcluster config schema changed
1 parent 8d3daf7 commit d54259f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/cli/delete_helm.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ func DeleteHelm(ctx context.Context, platformClient platform.Client, options *De
130130
vclusterConfig := &config.Config{}
131131
err = yaml.Unmarshal(values, vclusterConfig)
132132
if err != nil {
133-
return err
133+
cmd.log.Warnf("Failed to parse vcluster config from Helm values: %v. ", err)
134+
cmd.log.Infof("Continuing with deletion...")
135+
vclusterConfig = nil
134136
}
135137

136138
// we have to delete the chart
@@ -203,7 +205,7 @@ func DeleteHelm(ctx context.Context, platformClient platform.Client, options *De
203205
}
204206

205207
// if namespace sync is enabled, use cleanup handlers to handle namespace cleanup
206-
if vclusterConfig.Sync.ToHost.Namespaces.Enabled {
208+
if vclusterConfig != nil && vclusterConfig.Sync.ToHost.Namespaces.Enabled {
207209
if err := CleanupSyncedNamespaces(ctx, cmd.Namespace, vClusterName, cmd.restConfig, cmd.kubeClient, cmd.log); err != nil {
208210
return fmt.Errorf("run namespace cleanup: %w", err)
209211
}

0 commit comments

Comments
 (0)