Skip to content

Commit

Permalink
export e2e test
Browse files Browse the repository at this point in the history
Signed-off-by: pashakostohrys <[email protected]>
  • Loading branch information
pasha-codefresh committed Aug 14, 2024
1 parent 94f29b6 commit 3d4606a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/argocd/commands/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
20 changes: 20 additions & 0 deletions cmd/argocd/commands/admin/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"bufio"
"fmt"
"io"
"k8s.io/apimachinery/pkg/runtime/schema"
"os"

"github.com/argoproj/gitops-engine/pkg/utils/kube"
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 3d4606a

Please sign in to comment.