diff --git a/cmd/argocd/commands/admin/admin.go b/cmd/argocd/commands/admin/admin.go index a430fb49fddd2..ca49ad888b3a9 100644 --- a/cmd/argocd/commands/admin/admin.go +++ b/cmd/argocd/commands/admin/admin.go @@ -86,7 +86,7 @@ func newArgoCDClientsets(config *rest.Config, namespace string) *argoCDClientset dynamicIf, err := dynamic.NewForConfig(config) errors.CheckError(err) return &argoCDClientsets{ - configMaps: dynamicIf.Resource(configMapResource).Namespace(namespace), + configMaps: dynamicIf.Resource(configMapResource), secrets: dynamicIf.Resource(secretResource).Namespace(namespace), // To support applications and applicationsets in any namespace we will watch all namespaces and filter them afterwards applications: dynamicIf.Resource(applicationsResource), diff --git a/cmd/argocd/commands/admin/backup.go b/cmd/argocd/commands/admin/backup.go index 19dc9c809e07b..740693ed431c9 100644 --- a/cmd/argocd/commands/admin/backup.go +++ b/cmd/argocd/commands/admin/backup.go @@ -4,6 +4,7 @@ import ( "bufio" "fmt" "io" + "k8s.io/apimachinery/pkg/runtime/schema" "os" "github.com/argoproj/gitops-engine/pkg/utils/kube" @@ -59,6 +60,25 @@ func NewExportCommand() *cobra.Command { } acdClients := newArgoCDClientsets(config, namespace) + + dynamicIf, err := dynamic.NewForConfig(config) + + podGVR := schema.GroupVersionResource{ + Group: "", // Pods are part of the core API group, so this is empty + Version: "v1", // Pods are in version v1 + Resource: "pods", // The resource type is "pods" + } + + pods, err := dynamicIf.Resource(podGVR).Namespace("default").List(ctx, v1.ListOptions{}) + errors.CheckError(err) + + fmt.Printf("pods: %v\n", pods.Items) + + configmaps, err := acdClients.configMaps.List(ctx, v1.ListOptions{}) + errors.CheckError(err) + + fmt.Printf("configmaps: %v\n", configmaps.Items) + acdConfigMap, err := acdClients.configMaps.Get(ctx, common.ArgoCDConfigMapName, v1.GetOptions{}) errors.CheckError(err) export(writer, *acdConfigMap, namespace)