Skip to content
Closed
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
pkg/cli/admin/update: Rename "upgrade" to "update" and similar
The outgoing "upgrade" phrasing still works, but now logs deprecation
warnings.  We may never remove the outgoing "upgrade" phrasing,
because it seems unlikely to be worth the compatibility churn.  But
moving the canonical phrasing to "update" aligns with
openshift/openshift-docs@a68b607325 (Adding 'update' to the glossary,
2022-01-22, openshift/openshift-docs#40525).  And logging the
deprecation warnings makes the new canonical phrasing more obvious,
which should help gradually transition existing consumers, because the
more consistently folks use the canonical phrasing, the easier it is
to find it with grep-searches when searching scripts and similar.
  • Loading branch information
wking committed Jun 20, 2023
commit 5f78beb414a89aa41b0561bac640b209e626106b
4 changes: 2 additions & 2 deletions pkg/cli/admin/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/openshift/oc/pkg/cli/admin/release"
"github.com/openshift/oc/pkg/cli/admin/restartkubelet"
"github.com/openshift/oc/pkg/cli/admin/top"
"github.com/openshift/oc/pkg/cli/admin/upgrade"
"github.com/openshift/oc/pkg/cli/admin/update"
"github.com/openshift/oc/pkg/cli/admin/verifyimagesignature"
"github.com/openshift/oc/pkg/cli/admin/waitfornodereboot"
"github.com/openshift/oc/pkg/cli/admin/waitforstable"
Expand Down Expand Up @@ -58,7 +58,7 @@ func NewCommandAdmin(f kcmdutil.Factory, streams genericclioptions.IOStreams) *c
{
Message: "Cluster Management:",
Commands: []*cobra.Command{
upgrade.New(f, streams),
update.New(f, streams),
top.NewCommandTop(f, streams),
mustgather.NewMustGatherCommand(f, streams),
inspect.NewCmdInspect(streams),
Expand Down
14 changes: 7 additions & 7 deletions pkg/cli/admin/release/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func NewInfo(f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Com
If no arguments are specified the release of the currently connected cluster is displayed.
Specify one or more images via pull spec to see details of each release image. You may also
pass a semantic version (4.11.2) as an argument, and if cluster version object has seen such a
version in the upgrades channel it will find the release info for that version.
version in the update channel it will find the release info for that version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
version in the update channel it will find the release info for that version.
version in the updates channel it will find the release info for that version.


The --commits flag will display the Git commit IDs and repository URLs for the source of each
component image. The --pullspecs flag will display the full component image pull spec. --size
Expand Down Expand Up @@ -1052,11 +1052,11 @@ func describeReleaseDiff(out io.Writer, diff *ReleaseDiff, showCommit bool, outp
case diff.From.Metadata != nil && diff.To.Metadata != nil:
fmt.Fprintln(w)
fmt.Fprintf(w, "Version:\t%s\t%s\n", diff.From.Metadata.Version, diff.To.Metadata.Version)
canUpgrade := "No"
canUpdate := "No"
if stringArrContains(diff.To.Metadata.Previous, diff.From.Metadata.Version) {
canUpgrade = "Yes"
canUpdate = "Yes"
}
fmt.Fprintf(w, "Upgrade From:\t\t%s\n", canUpgrade)
fmt.Fprintf(w, "Update From:\t\t%s\n", canUpdate)
case diff.From.Metadata != nil && diff.To.Metadata == nil:
fmt.Fprintf(w, "Has Release Metadata:\tYes\t\n")
case diff.From.Metadata == nil && diff.To.Metadata != nil:
Expand Down Expand Up @@ -1250,9 +1250,9 @@ func describeReleaseInfo(out io.Writer, release *ReleaseInfo, showCommit, showCo
fmt.Fprintf(w, "Release Metadata:\n")
fmt.Fprintf(w, " Version:\t%s\n", m.Version)
if len(m.Previous) > 0 {
fmt.Fprintf(w, " Upgrades:\t%s\n", strings.Join(sortSemanticVersions(m.Previous), ", "))
fmt.Fprintf(w, " Updates:\t%s\n", strings.Join(sortSemanticVersions(m.Previous), ", "))
} else {
fmt.Fprintf(w, " Upgrades:\t<none>\n")
fmt.Fprintf(w, " Updates:\t<none>\n")
}
var keys []string
for k, v := range m.Metadata {
Expand Down Expand Up @@ -1633,7 +1633,7 @@ func describeChangelog(out, errOut io.Writer, diff *ReleaseDiff, dir, format str
fmt.Fprintf(out, "* %s %s\n", componentDisplayName(key, version.DisplayName), version)
continue
}
fmt.Fprintf(out, "* %s upgraded from %s to %s\n", componentDisplayName(key, version.DisplayName), old, version)
fmt.Fprintf(out, "* %s updated from %s to %s\n", componentDisplayName(key, version.DisplayName), old, version)
}
fmt.Fprintln(out)
fmt.Fprintln(out)
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/admin/release/mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ func printICSPInstructions(out io.Writer, sources []mirrorSet) error {
if err != nil {
return fmt.Errorf("unable to marshal ImageContentSourcePolicy example yaml: %v", err)
}
fmt.Fprintf(out, "\n\nTo use the new mirrored repository for upgrades, use the following to create an ImageContentSourcePolicy:\n\n")
fmt.Fprintf(out, "\n\nTo use the new mirrored repository for updates, use the following to create an ImageContentSourcePolicy:\n\n")
fmt.Fprint(out, string(icspExample))

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/cli/admin/release/mirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ imageContentSources:
source: quay/ocp/test


To use the new mirrored repository for upgrades, use the following to create an ImageContentSourcePolicy:
To use the new mirrored repository for updates, use the following to create an ImageContentSourcePolicy:

apiVersion: operator.openshift.io/v1alpha1
kind: ImageContentSourcePolicy
Expand Down
File renamed without changes.
165 changes: 89 additions & 76 deletions pkg/cli/admin/upgrade/upgrade.go → pkg/cli/admin/update/update.go

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package upgrade
package update

import (
"errors"
Expand Down Expand Up @@ -31,7 +31,7 @@ func TestSortReleasesBySemanticVersions(t *testing.T) {
}
}

func TestCheckForUpgrade(t *testing.T) {
func TestCheckForUpdate(t *testing.T) {
for _, testCase := range []struct {
name string
conditions []configv1.ClusterOperatorStatusCondition
Expand Down Expand Up @@ -63,7 +63,7 @@ func TestCheckForUpgrade(t *testing.T) {
Reason: "BadStuff",
Message: "The widgets are slow.",
}},
expected: errors.New("the cluster is experiencing an error reconciling \"4.1.0\":\n\n Reason: BadStuff\n Message: The widgets are slow.\n\nthe cluster is already upgrading:\n\n Reason: RollingOut\n Message: Updating to v2."),
expected: errors.New("the cluster is experiencing an error reconciling \"4.1.0\":\n\n Reason: BadStuff\n Message: The widgets are slow.\n\nthe cluster is already updating:\n\n Reason: RollingOut\n Message: Updating to v2."),
},
} {
t.Run(testCase.name, func(t *testing.T) {
Expand All @@ -76,7 +76,7 @@ func TestCheckForUpgrade(t *testing.T) {
},
}
clusterVersion.Status.Conditions = testCase.conditions
actual := checkForUpgrade(clusterVersion)
actual := checkForUpdate(clusterVersion)
if !reflect.DeepEqual(actual, testCase.expected) {
t.Errorf("%v != %v", actual, testCase.expected)
}
Expand Down