Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Change order of how resources get dumped #4544

Merged
merged 1 commit into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 41 additions & 41 deletions e2e/support/util/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,50 +52,21 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
return err
}

// IntegrationPlatforms
pls, err := camelClient.CamelV1().IntegrationPlatforms(ns).List(ctx, metav1.ListOptions{})
// Integrations
its, err := camelClient.CamelV1().Integrations(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d platforms:\n", len(pls.Items))
for _, p := range pls.Items {
ref := p
t.Logf("Found %d integrations:\n", len(its.Items))
for _, integration := range its.Items {
ref := integration
pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(pdata))
}

// CamelCatalogs
cats, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d catalogs:\n", len(cats.Items))
for _, c := range cats.Items {
ref := c
cdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(cdata))
}

// Builds
builds, err := camelClient.CamelV1().Builds(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d builds:\n", len(builds.Items))
for _, build := range builds.Items {
data, err := kubernetes.ToYAMLNoManagedFields(&build)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(data))
}

// IntegrationKits
iks, err := camelClient.CamelV1().IntegrationKits(ns).List(ctx, metav1.ListOptions{})
if err != nil {
Expand All @@ -111,19 +82,18 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
t.Logf("---\n%s\n---\n", string(pdata))
}

// Integrations
its, err := camelClient.CamelV1().Integrations(ns).List(ctx, metav1.ListOptions{})
// Builds
builds, err := camelClient.CamelV1().Builds(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d integrations:\n", len(its.Items))
for _, integration := range its.Items {
ref := integration
pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
t.Logf("Found %d builds:\n", len(builds.Items))
for _, build := range builds.Items {
data, err := kubernetes.ToYAMLNoManagedFields(&build)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(pdata))
t.Logf("---\n%s\n---\n", string(data))
}

// Configmaps
Expand Down Expand Up @@ -203,6 +173,36 @@ func Dump(ctx context.Context, c client.Client, ns string, t *testing.T) error {
}
}

// IntegrationPlatforms
pls, err := camelClient.CamelV1().IntegrationPlatforms(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d platforms:\n", len(pls.Items))
for _, p := range pls.Items {
ref := p
pdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(pdata))
}

// CamelCatalogs
cats, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
t.Logf("Found %d catalogs:\n", len(cats.Items))
for _, c := range cats.Items {
ref := c
cdata, err := kubernetes.ToYAMLNoManagedFields(&ref)
if err != nil {
return err
}
t.Logf("---\n%s\n---\n", string(cdata))
}

// Services
svcs, err := c.CoreV1().Services(ns).List(ctx, metav1.ListOptions{})
if err != nil {
Expand Down
59 changes: 33 additions & 26 deletions pkg/cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ func dumpNamespace(ctx context.Context, c client.Client, ns string, out io.Write
return err
}

// Integrations
its, err := camelClient.CamelV1().Integrations(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
Expand All @@ -104,76 +105,82 @@ func dumpNamespace(ctx context.Context, c client.Client, ns string, out io.Write
fmt.Fprintf(out, "---\n%s\n---\n", string(pdata))
}

pls, err := camelClient.CamelV1().IntegrationPlatforms(ns).List(ctx, metav1.ListOptions{})
// IntegrationKits
iks, err := camelClient.CamelV1().IntegrationKits(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
fmt.Fprintf(out, "Found %d platforms:\n", len(pls.Items))
for _, p := range pls.Items {
ref := p
fmt.Fprintf(out, "Found %d integration kits:\n", len(iks.Items))
for _, ik := range iks.Items {
ref := ik
pdata, err := kubernetes.ToYAML(&ref)
if err != nil {
return err
}
fmt.Fprintf(out, "---\n%s\n---\n", string(pdata))
}

cat, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx, metav1.ListOptions{})
// ConfigMaps
cms, err := c.CoreV1().ConfigMaps(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
fmt.Fprintf(out, "Found %d catalogs:\n", len(pls.Items))
for _, c := range cat.Items {
ref := c
cdata, err := kubernetes.ToYAML(&ref)
fmt.Fprintf(out, "Found %d ConfigMaps:\n", len(cms.Items))
for _, cm := range cms.Items {
ref := cm
pdata, err := kubernetes.ToYAML(&ref)
if err != nil {
return err
}
fmt.Fprintf(out, "---\n%s\n---\n", string(cdata))
fmt.Fprintf(out, "---\n%s\n---\n", string(pdata))
}

iks, err := camelClient.CamelV1().IntegrationKits(ns).List(ctx, metav1.ListOptions{})
// Deployments
deployments, err := c.AppsV1().Deployments(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
fmt.Fprintf(out, "Found %d integration kits:\n", len(iks.Items))
for _, ik := range iks.Items {
ref := ik
pdata, err := kubernetes.ToYAML(&ref)
fmt.Fprintf(out, "Found %d deployments:\n", len(deployments.Items))
for _, deployment := range deployments.Items {
ref := deployment
data, err := kubernetes.ToYAML(&ref)
if err != nil {
return err
}
fmt.Fprintf(out, "---\n%s\n---\n", string(pdata))
fmt.Fprintf(out, "---\n%s\n---\n", string(data))
}

cms, err := c.CoreV1().ConfigMaps(ns).List(ctx, metav1.ListOptions{})
// IntegrationPlatforms
pls, err := camelClient.CamelV1().IntegrationPlatforms(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
fmt.Fprintf(out, "Found %d ConfigMaps:\n", len(cms.Items))
for _, cm := range cms.Items {
ref := cm
fmt.Fprintf(out, "Found %d platforms:\n", len(pls.Items))
for _, p := range pls.Items {
ref := p
pdata, err := kubernetes.ToYAML(&ref)
if err != nil {
return err
}
fmt.Fprintf(out, "---\n%s\n---\n", string(pdata))
}

deployments, err := c.AppsV1().Deployments(ns).List(ctx, metav1.ListOptions{})
// CamelCatalogs
cat, err := camelClient.CamelV1().CamelCatalogs(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
}
fmt.Fprintf(out, "Found %d deployments:\n", len(deployments.Items))
for _, deployment := range deployments.Items {
ref := deployment
data, err := kubernetes.ToYAML(&ref)
fmt.Fprintf(out, "Found %d catalogs:\n", len(pls.Items))
for _, c := range cat.Items {
ref := c
cdata, err := kubernetes.ToYAML(&ref)
if err != nil {
return err
}
fmt.Fprintf(out, "---\n%s\n---\n", string(data))
fmt.Fprintf(out, "---\n%s\n---\n", string(cdata))
}

// Pods and Logs
lst, err := c.CoreV1().Pods(ns).List(ctx, metav1.ListOptions{})
if err != nil {
return err
Expand Down