We are introducing a new CLI tool called metalctl to interact with the metal-operator as part of our metal-operator ecosystem. The initial command to be implemented is the move command, which will facilitate the migration of Custom Resource Definitions (CRDs) and Custom Resources (CRs) related to metal-operator from one Kubernetes cluster to another.
Goal
Create a new CLI utility called metalctl.
Integrate the move command to migrate all metal-operator related CRDs and CRs between two clusters.
Key Objectives
Ensure seamless migration of metal-operator CRDs and CRs.
Ensure the migration process handles dependency order (CRDs must be moved before CRs).
Handle failure scenarios gracefully with appropriate error messages and rollback functionality.
Command Details
Command: move
The move command will enable users to specify a source and target Kubernetes cluster for migrating CRDs and CRs associated with the metal-operator.
Command Options:
--source-kubeconfig (required): Path to the kubeconfig of the source cluster.
--target-kubeconfig (required): Path to the kubeconfig of the target cluster.
--crds-only (optional): Flag to migrate only the CRDs without CRs.
--crs-only (optional): Flag to migrate only the CRs without CRDs.
--namespace (optional): Specify a namespace to filter CRDs and CRs to migrate. Defaults to all namespaces if not specified.
--dry-run (optional): Perform a dry run to show what would be moved without executing the migration.
--verbose (optional): Enable verbose logging for detailed output during migration.
Validate Input: Verify the presence of both source-kubeconfig and target-kubeconfig.
Fetch CRDs from Source Cluster: Use the source kubeconfig to list all CRDs related to the metal-operator.
Apply CRDs to Target Cluster: Use the target kubeconfig to apply the CRDs. Ensure idempotency in case they already exist.
Fetch CRs from Source Cluster: Fetch all CRs of the metal-operator from the source cluster.
Apply CRs to Target Cluster: Apply all CRs to the target cluster.
Verify Migration: Ensure the CRDs and CRs have been successfully created in the target cluster.
Error Handling and Rollback: If any step fails, provide detailed error messages and rollback any partial migrations where applicable.
Definition of Done
A new CLI tool metalctl is created with a functional move command.
The move command successfully migrates metal-operator CRDs and CRs between clusters.
Support for dry-run, crds-only, crs-only, and namespace options.
Detailed documentation for using the move command is included.
Adequate test coverage for the move functionality, including unit tests and integration tests.
Additional Considerations
Future commands for metalctl can include operations like listing or deleting resources, which should be planned for in the CLI structure.
Console access: Add a console command to access the serial console of a server. This will allow users to remotely view or interact with a server's console for debugging and management purposes.
Description
We are introducing a new CLI tool called
metalctl
to interact with themetal-operator
as part of ourmetal-operator
ecosystem. The initial command to be implemented is themove
command, which will facilitate the migration of Custom Resource Definitions (CRDs) and Custom Resources (CRs) related tometal-operator
from one Kubernetes cluster to another.Goal
metalctl
.move
command to migrate allmetal-operator
related CRDs and CRs between two clusters.Key Objectives
metal-operator
CRDs and CRs.Command Details
Command:
move
The
move
command will enable users to specify a source and target Kubernetes cluster for migrating CRDs and CRs associated with themetal-operator
.Command Options:
--source-kubeconfig
(required): Path to the kubeconfig of the source cluster.--target-kubeconfig
(required): Path to the kubeconfig of the target cluster.--crds-only
(optional): Flag to migrate only the CRDs without CRs.--crs-only
(optional): Flag to migrate only the CRs without CRDs.--namespace
(optional): Specify a namespace to filter CRDs and CRs to migrate. Defaults to all namespaces if not specified.--dry-run
(optional): Perform a dry run to show what would be moved without executing the migration.--verbose
(optional): Enable verbose logging for detailed output during migration.Example Usage:
Steps in the move Process:
source-kubeconfig
andtarget-kubeconfig
.metal-operator
.Definition of Done
metalctl
is created with a functional move command.metal-operator
CRDs and CRs between clusters.dry-run
,crds-only
,crs-only
, andnamespace
options.move
command is included.move
functionality, including unit tests and integration tests.Additional Considerations
metalctl
can include operations like listing or deleting resources, which should be planned for in the CLI structure.Console access
: Add aconsole
command to access the serial console of a server. This will allow users to remotely view or interact with a server's console for debugging and management purposes.