Skip to content

Commit

Permalink
Merge pull request helm#12272 from helm/revert-11631-get-metadata
Browse files Browse the repository at this point in the history
Revert "Add `helm get metadata` command"
  • Loading branch information
joejulian authored Aug 3, 2023
2 parents b12139a + e8e6da2 commit d568e08
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 276 deletions.
2 changes: 0 additions & 2 deletions cmd/helm/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ get extended information about the release, including:
- The generated manifest file
- The notes provided by the chart of the release
- The hooks associated with the release
- The metadata of the release
`

func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
Expand All @@ -49,7 +48,6 @@ func newGetCmd(cfg *action.Configuration, out io.Writer) *cobra.Command {
cmd.AddCommand(newGetManifestCmd(cfg, out))
cmd.AddCommand(newGetHooksCmd(cfg, out))
cmd.AddCommand(newGetNotesCmd(cfg, out))
cmd.AddCommand(newGetMetadataCmd(cfg, out))

return cmd
}
94 changes: 0 additions & 94 deletions cmd/helm/get_metadata.go

This file was deleted.

66 changes: 0 additions & 66 deletions cmd/helm/get_metadata_test.go

This file was deleted.

41 changes: 19 additions & 22 deletions cmd/helm/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,15 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
if s.release == nil {
return nil
}
_, _ = fmt.Fprintf(out, "NAME: %s\n", s.release.Name)
fmt.Fprintf(out, "NAME: %s\n", s.release.Name)
if !s.release.Info.LastDeployed.IsZero() {
_, _ = fmt.Fprintf(out, "LAST DEPLOYED: %s\n", s.release.Info.LastDeployed.Format(time.ANSIC))
fmt.Fprintf(out, "LAST DEPLOYED: %s\n", s.release.Info.LastDeployed.Format(time.ANSIC))
}
_, _ = fmt.Fprintf(out, "CHART: %s\n", s.release.Chart.Metadata.Name)
_, _ = fmt.Fprintf(out, "NAMESPACE: %s\n", s.release.Namespace)
_, _ = fmt.Fprintf(out, "STATUS: %s\n", s.release.Info.Status.String())
_, _ = fmt.Fprintf(out, "REVISION: %d\n", s.release.Version)
_, _ = fmt.Fprintf(out, "VERSION: %s\n", s.release.Chart.Metadata.Version)
_, _ = fmt.Fprintf(out, "APP_VERSION: %s\n", s.release.Chart.Metadata.AppVersion)
fmt.Fprintf(out, "NAMESPACE: %s\n", s.release.Namespace)
fmt.Fprintf(out, "STATUS: %s\n", s.release.Info.Status.String())
fmt.Fprintf(out, "REVISION: %d\n", s.release.Version)
if s.showDescription {
_, _ = fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description)
fmt.Fprintf(out, "DESCRIPTION: %s\n", s.release.Info.Description)
}

if s.showResources && s.release.Info.Resources != nil && len(s.release.Info.Resources) > 0 {
Expand All @@ -152,31 +149,31 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
}

for _, t := range keys {
_, _ = fmt.Fprintf(buf, "==> %s\n", t)
fmt.Fprintf(buf, "==> %s\n", t)

vk := s.release.Info.Resources[t]
for _, resource := range vk {
if err := printer.PrintObj(resource, buf); err != nil {
_, _ = fmt.Fprintf(buf, "failed to print object type %s: %v\n", t, err)
fmt.Fprintf(buf, "failed to print object type %s: %v\n", t, err)
}
}

buf.WriteString("\n")
}

_, _ = fmt.Fprintf(out, "RESOURCES:\n%s\n", buf.String())
fmt.Fprintf(out, "RESOURCES:\n%s\n", buf.String())
}

executions := executionsByHookEvent(s.release)
if tests, ok := executions[release.HookTest]; !ok || len(tests) == 0 {
_, _ = fmt.Fprintln(out, "TEST SUITE: None")
fmt.Fprintln(out, "TEST SUITE: None")
} else {
for _, h := range tests {
// Don't print anything if hook has not been initiated
if h.LastRun.StartedAt.IsZero() {
continue
}
_, _ = fmt.Fprintf(out, "TEST SUITE: %s\n%s\n%s\n%s\n",
fmt.Fprintf(out, "TEST SUITE: %s\n%s\n%s\n%s\n",
h.Name,
fmt.Sprintf("Last Started: %s", h.LastRun.StartedAt.Format(time.ANSIC)),
fmt.Sprintf("Last Completed: %s", h.LastRun.CompletedAt.Format(time.ANSIC)),
Expand All @@ -186,38 +183,38 @@ func (s statusPrinter) WriteTable(out io.Writer) error {
}

if s.debug {
_, _ = fmt.Fprintln(out, "USER-SUPPLIED VALUES:")
fmt.Fprintln(out, "USER-SUPPLIED VALUES:")
err := output.EncodeYAML(out, s.release.Config)
if err != nil {
return err
}
// Print an extra newline
_, _ = fmt.Fprintln(out)
fmt.Fprintln(out)

cfg, err := chartutil.CoalesceValues(s.release.Chart, s.release.Config)
if err != nil {
return err
}

_, _ = fmt.Fprintln(out, "COMPUTED VALUES:")
fmt.Fprintln(out, "COMPUTED VALUES:")
err = output.EncodeYAML(out, cfg.AsMap())
if err != nil {
return err
}
// Print an extra newline
_, _ = fmt.Fprintln(out)
fmt.Fprintln(out)
}

if strings.EqualFold(s.release.Info.Description, "Dry run complete") || s.debug {
_, _ = fmt.Fprintln(out, "HOOKS:")
fmt.Fprintln(out, "HOOKS:")
for _, h := range s.release.Hooks {
_, _ = fmt.Fprintf(out, "---\n# Source: %s\n%s\n", h.Path, h.Manifest)
fmt.Fprintf(out, "---\n# Source: %s\n%s\n", h.Path, h.Manifest)
}
_, _ = fmt.Fprintf(out, "MANIFEST:\n%s\n", s.release.Manifest)
fmt.Fprintf(out, "MANIFEST:\n%s\n", s.release.Manifest)
}

if len(s.release.Info.Notes) > 0 {
_, _ = fmt.Fprintf(out, "NOTES:\n%s\n", strings.TrimSpace(s.release.Info.Notes))
fmt.Fprintf(out, "NOTES:\n%s\n", strings.TrimSpace(s.release.Info.Notes))
}
return nil
}
Expand Down
3 changes: 0 additions & 3 deletions cmd/helm/testdata/output/get-metadata-args.txt

This file was deleted.

1 change: 0 additions & 1 deletion cmd/helm/testdata/output/get-metadata.json

This file was deleted.

8 changes: 0 additions & 8 deletions cmd/helm/testdata/output/get-metadata.txt

This file was deleted.

8 changes: 0 additions & 8 deletions cmd/helm/testdata/output/get-metadata.yaml

This file was deleted.

3 changes: 0 additions & 3 deletions cmd/helm/testdata/output/get-release.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
NAME: thomas-guide
LAST DEPLOYED: Fri Sep 2 22:04:05 1977
CHART: foo
NAMESPACE: default
STATUS: deployed
REVISION: 1
VERSION: 0.1.0-beta.1
APP_VERSION: 1.0
TEST SUITE: None
USER-SUPPLIED VALUES:
name: value
Expand Down
69 changes: 0 additions & 69 deletions pkg/action/get_metadata.go

This file was deleted.

0 comments on commit d568e08

Please sign in to comment.