Skip to content

Commit 63e0d4f

Browse files
jaypoulzclaude
andcommitted
OCPEDGE-2416: Add oc adm transition topology command
Implement SNO to HA topology transition command with comprehensive preflight validation, user confirmation prompts, and status monitoring. Features: - Three operational modes: discovery, initiate, status - Tiered preflight validation (Error and Warning severity checks) - Client-side feature gate (OC_ENABLE_CMD_TRANSITION_TOPOLOGY) - Server-side validation (MutableTopology feature gate check) - User confirmation with bypass support (--allow-transition-with-warnings) Preflight checks (10 total): - Error-severity (blocking): Supported transition, feature gate enabled - Warning-severity (bypassable): Cluster operators stable, control plane node count/schedulability/readiness, etcd quorum/stability/voting members Implementation structure: - pkg/cli/admin/transition/transition.go: Main command and orchestration - pkg/cli/admin/transition/status.go: Status monitoring subcommand - pkg/cli/admin/transition/preflight/: Validation logic and types - pkg/cli/admin/transition/prompt/: User interaction and confirmation Command is gated behind OC_ENABLE_CMD_TRANSITION_TOPOLOGY environment variable and only appears in cluster management commands when enabled. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent fbf0f6a commit 63e0d4f

11 files changed

Lines changed: 2921 additions & 0 deletions

File tree

pkg/cli/admin/admin.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535
"github.com/openshift/oc/pkg/cli/admin/release"
3636
"github.com/openshift/oc/pkg/cli/admin/restartkubelet"
3737
"github.com/openshift/oc/pkg/cli/admin/top"
38+
"github.com/openshift/oc/pkg/cli/admin/transition"
3839
"github.com/openshift/oc/pkg/cli/admin/upgrade"
3940
"github.com/openshift/oc/pkg/cli/admin/verifyimagesignature"
4041
"github.com/openshift/oc/pkg/cli/admin/waitfornodereboot"
@@ -50,6 +51,9 @@ var adminLong = ktemplates.LongDesc(`
5051
// inspectAlertsFeatureGate is an environment variable used to gate the inclusion of the inspect-alerts subcommand.
5152
const inspectAlertsFeatureGate = "OC_ENABLE_CMD_INSPECT_ALERTS"
5253

54+
// transitionTopologyFeatureGate is an environment variable used to gate the inclusion of the transition topology subcommand.
55+
const transitionTopologyFeatureGate = "OC_ENABLE_CMD_TRANSITION_TOPOLOGY"
56+
5357
func NewCommandAdmin(f kcmdutil.Factory, streams genericiooptions.IOStreams) *cobra.Command {
5458
// Main command
5559
cmds := &cobra.Command{
@@ -72,6 +76,10 @@ func NewCommandAdmin(f kcmdutil.Factory, streams genericiooptions.IOStreams) *co
7276
clusterManagement = append(clusterManagement, inspectalerts.New(f, streams))
7377
}
7478

79+
if kcmdutil.FeatureGate(transitionTopologyFeatureGate).IsEnabled() {
80+
clusterManagement = append(clusterManagement, transition.NewCmdTransition(f, streams))
81+
}
82+
7583
groups := ktemplates.CommandGroups{
7684
{
7785
Message: "Cluster Management:",
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package transition
2+
3+
import (
4+
configv1 "github.com/openshift/api/config/v1"
5+
)
6+
7+
// Kubernetes and OpenShift resource names
8+
const (
9+
// InfrastructureResourceName is the name of the cluster-scoped Infrastructure resource
10+
InfrastructureResourceName = "cluster"
11+
12+
// EtcdOperatorResourceName is the name of the cluster-scoped Etcd operator resource
13+
EtcdOperatorResourceName = "cluster"
14+
15+
// EtcdNamespace is the namespace where etcd resources are located
16+
EtcdNamespace = "openshift-etcd"
17+
18+
// EtcdEndpointsConfigMapName is the name of the ConfigMap containing etcd endpoints
19+
EtcdEndpointsConfigMapName = "etcd-endpoints"
20+
)
21+
22+
// ClusterOperator condition types
23+
const (
24+
// ClusterOperatorAvailable indicates the operand is available
25+
ClusterOperatorAvailable configv1.ClusterStatusConditionType = configv1.OperatorAvailable
26+
27+
// ClusterOperatorProgressing indicates the operand is being updated
28+
ClusterOperatorProgressing configv1.ClusterStatusConditionType = configv1.OperatorProgressing
29+
30+
// ClusterOperatorDegraded indicates the operand is degraded
31+
ClusterOperatorDegraded configv1.ClusterStatusConditionType = configv1.OperatorDegraded
32+
)
33+
34+
// Etcd operator condition types
35+
const (
36+
// EtcdMembersAvailableCondition indicates etcd has quorum
37+
EtcdMembersAvailableCondition = "EtcdMembersAvailable"
38+
)

0 commit comments

Comments
 (0)