diff --git a/cmd/gotk/export.go b/cmd/gotk/export.go index 8a6d9f16..750def2e 100644 --- a/cmd/gotk/export.go +++ b/cmd/gotk/export.go @@ -17,6 +17,8 @@ limitations under the License. package main import ( + "bytes" + "github.com/spf13/cobra" ) @@ -35,3 +37,9 @@ func init() { rootCmd.AddCommand(exportCmd) } + +func resourceToString(data []byte) string { + data = bytes.Replace(data, []byte("creationTimestamp: null\n"), []byte(""), 1) + data = bytes.Replace(data, []byte("status: {}\n"), []byte(""), 1) + return string(data) +} diff --git a/cmd/gotk/export_helmrelease.go b/cmd/gotk/export_helmrelease.go index 583c2719..12bfc021 100644 --- a/cmd/gotk/export_helmrelease.go +++ b/cmd/gotk/export_helmrelease.go @@ -115,6 +115,6 @@ func exportHelmRelease(helmRelease helmv2.HelmRelease) error { } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) return nil } diff --git a/cmd/gotk/export_kustomization.go b/cmd/gotk/export_kustomization.go index b3adcf6c..e901012d 100644 --- a/cmd/gotk/export_kustomization.go +++ b/cmd/gotk/export_kustomization.go @@ -115,6 +115,6 @@ func exportKs(kustomization kustomizev1.Kustomization) error { } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) return nil } diff --git a/cmd/gotk/export_source_git.go b/cmd/gotk/export_source_git.go index 01af0602..5b9eb6a6 100644 --- a/cmd/gotk/export_source_git.go +++ b/cmd/gotk/export_source_git.go @@ -125,7 +125,7 @@ func exportGit(source sourcev1.GitRepository) error { } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) return nil } @@ -160,7 +160,7 @@ func exportGitCredentials(ctx context.Context, kubeClient client.Client, source } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) } return nil } diff --git a/cmd/gotk/export_source_helm.go b/cmd/gotk/export_source_helm.go index 80dd6700..061b16a9 100644 --- a/cmd/gotk/export_source_helm.go +++ b/cmd/gotk/export_source_helm.go @@ -125,7 +125,7 @@ func exportHelmRepository(source sourcev1.HelmRepository) error { } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) return nil } @@ -160,7 +160,7 @@ func exportHelmCredentials(ctx context.Context, kubeClient client.Client, source } fmt.Println("---") - fmt.Println(string(data)) + fmt.Println(resourceToString(data)) } return nil }