Skip to content

Commit c614f06

Browse files
authored
Fix-migrate (#723)
## What delete argocd-initial-admin-secret ## Why after a new runtime is installed using helm, a new initial-admin-secret will be created by argocd ## Notes <!-- Add any additional notes here -->
1 parent 752b573 commit c614f06

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION=v0.1.52
1+
VERSION=v0.1.53
22

33
OUT_DIR=dist
44
YEAR?=$(shell date +"%Y")

cmd/commands/migrate.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,6 @@ func addPathToClusterApp(destFs apfs.FS, runtimeName, clusterName, path string)
474474
addPathToInclude(app, path)
475475
bytes, err := yaml.Marshal(app)
476476
bytes = filterStatus(bytes)
477-
fmt.Println(string(bytes))
478477
if err != nil {
479478
return err
480479
}
@@ -531,6 +530,11 @@ func removeFromCluster(ctx context.Context, runtimeNamespace, kubeContext string
531530
return fmt.Errorf("failed updating argoproj CRDs: %w", err)
532531
}
533532

533+
err = deleteInitialAdminSecret(ctx, kubeFactory, runtimeNamespace)
534+
if err != nil {
535+
return fmt.Errorf("failed deleting initial-admin-secret: %w", err)
536+
}
537+
534538
return nil
535539
}
536540

@@ -589,6 +593,10 @@ func patchCrds(ctx context.Context, kubeFactory apkube.Factory) error {
589593
return nil
590594
}
591595

596+
func deleteInitialAdminSecret(ctx context.Context, kubeFactory apkube.Factory, namespace string) error {
597+
return kube.GetClientSetOrDie(kubeFactory).CoreV1().Secrets(namespace).Delete(ctx, "argocd-initial-admin-secret", metav1.DeleteOptions{})
598+
}
599+
592600
func getLabelPatch(value string) string {
593601
return fmt.Sprintf(`{ "metadata": { "labels": { "%s": "%s" } } }`, apstore.Default.LabelKeyAppManagedBy, value)
594602
}

0 commit comments

Comments
 (0)