Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description field to the migration plan and add support for execution from specified step #235

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Change the descriptions as suggested
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
  • Loading branch information
sergenyalcin committed Jul 24, 2023
commit 32ec7197777ece5dcb83003b187cf53eb1044936
34 changes: 17 additions & 17 deletions pkg/migration/configurationmetadata_steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,37 +128,37 @@ func (pg *PlanGenerator) stepConfigurationWithSubStep(s step, newSubStep bool) *
setPatchStep("deletion-policy-orphan", "Setting the deletion policies of Managed Resources to Orphan as a precaution against any unexpected problems that may occur during migration",
pg.Plan.Spec.stepMap[stepKey])
case stepRevertOrphanMRs:
setPatchStep("deletion-policy-delete", "Setting the deletion policies of Managed Resources whose deletion policy is set to Orphan at the beginning of the migration, to Delete again",
setPatchStep("deletion-policy-delete", "Setting the deletion policies of Managed Resources whose deletion policy had been set to Orphan at the beginning of the migration process, back to Delete",
pg.Plan.Spec.stepMap[stepKey])
case stepNewFamilyProvider:
setApplyStep("new-ssop", "Installing the new family provider",
setApplyStep("new-ssop", "Installing the new family config provider",
pg.Plan.Spec.stepMap[stepKey])
case stepNewServiceScopedProvider:
setApplyStep("new-ssop", "Installing the new service scoped providers",
setApplyStep("new-ssop", "Installing the new family resource providers",
pg.Plan.Spec.stepMap[stepKey])
case stepConfigurationPackageDisableDepResolution:
setPatchStep("disable-dependency-resolution", "Setting the value of skipDependencyResolution field to true so that dependencies in the configuration package are not resolved automatically",
setPatchStep("disable-dependency-resolution", "Setting the value of spec.skipDependencyResolution field to true so that dependencies of the Crossplane Configuration package are not resolved automatically, in preparation of deleting the monolithic provider packages",
pg.Plan.Spec.stepMap[stepKey])
case stepConfigurationPackageEnableDepResolution:
setPatchStep("enable-dependency-resolution", "Setting the value of skipDependencyResolution field in the configuration package back to false",
setPatchStep("enable-dependency-resolution", "Setting the value of spec.skipDependencyResolution field in the Configuration package back to false",
pg.Plan.Spec.stepMap[stepKey])
case stepEditConfigurationPackage:
setPatchStep("edit-configuration-package", "Setting the configuration package reference to new one",
setPatchStep("edit-configuration-package", "Setting the Configuration package reference (spec.package) to the new one",
pg.Plan.Spec.stepMap[stepKey])
case stepEditPackageLock:
setPatchStep("edit-package-lock", "Deleting configuration package dependency from Lock resource",
setPatchStep("edit-package-lock", "Deleting the Configuration package dependency from the Lock resource in preparation of deleting the monolithic provider packages",
pg.Plan.Spec.stepMap[stepKey])
case stepDeleteMonolithicProvider:
setDeleteStep("delete-monolithic-provider", "Deleting monolithic provider",
setDeleteStep("delete-monolithic-provider", "Deleting the monolithic provider package",
pg.Plan.Spec.stepMap[stepKey])
case stepActivateFamilyProviderRevision:
setPatchStep("activate-ssop", "Activating the new family provider after deletion monolithic one",
setPatchStep("activate-ssop", "Activating the new family config provider after the deletion of the monolithic one",
pg.Plan.Spec.stepMap[stepKey])
case stepActivateServiceScopedProviderRevision:
setPatchStep("activate-ssop", "Activating the new service scoped providers",
setPatchStep("activate-ssop", "Activating the new family resource providers",
pg.Plan.Spec.stepMap[stepKey])
case stepEditConfigurationMetadata:
setExecStep("edit-configuration-metadata", "Editing the Configuration Meta resource with new family provider references",
setExecStep("edit-configuration-metadata", "Replacing the monolithic provider dependencies in the Configuration metadata with references to the new family providers",
pg.Plan.Spec.stepMap[stepKey])
case stepBackupMRs:
setExecStep("backup-managed-resources", "Backing up Managed Resources",
Expand All @@ -167,25 +167,25 @@ func (pg *PlanGenerator) stepConfigurationWithSubStep(s step, newSubStep bool) *
setExecStep("backup-composite-resources", "Backing up Composite Resources",
pg.Plan.Spec.stepMap[stepKey])
case stepBackupClaims:
setExecStep("backup-claim-resources", "Backing up Claims",
setExecStep("backup-claim-resources", "Backing up Claims from all namespaces",
pg.Plan.Spec.stepMap[stepKey])
case stepCheckHealthFamilyProvider:
setExecStep("wait-for-healthy", "Checking health of new family provider",
setExecStep("wait-for-healthy", "Checking the health of new family config provider",
pg.Plan.Spec.stepMap[stepKey])
case stepCheckHealthNewServiceScopedProvider:
setExecStep("wait-for-healthy", "Checking health of new service scoped provider",
setExecStep("wait-for-healthy", "Checking health of new family resource provider",
pg.Plan.Spec.stepMap[stepKey])
case stepCheckInstallationFamilyProviderRevision:
setExecStep("wait-for-installed", "Checking installation of new family provider",
setExecStep("wait-for-installed", "Checking the installation of new family config provider",
pg.Plan.Spec.stepMap[stepKey])
case stepCheckInstallationServiceScopedProviderRevision:
setExecStep("wait-for-installed", "Checking installation of new service scoped provider",
pg.Plan.Spec.stepMap[stepKey])
case stepBuildConfiguration:
setExecStep("build-configuration", "Building the new configuration pkg",
setExecStep("build-configuration", "Building the new Configuration package using up",
pg.Plan.Spec.stepMap[stepKey])
case stepPushConfiguration:
setExecStep("push-configuration", "Pushing the new configuration pkg",
setExecStep("push-configuration", "Pushing the new Configuration package",
pg.Plan.Spec.stepMap[stepKey])
default:
panic(fmt.Sprintf(errInvalidStepFmt, s))
Expand Down
2 changes: 2 additions & 0 deletions pkg/migration/plan_executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ func WithExecutorCallback(cb ExecutorCallback) PlanExecutorOption {
}
}

// WithStartIndex configures a StartIndex for a PlanExecutor
// to modify the starting index of the execution
func WithStartIndex(startIndex int) PlanExecutorOption {
return func(pe *PlanExecutor) {
pe.StartIndex = startIndex
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
manualExecution:
- sh -c "kubectl get claim --all-namespaces -o yaml > backup/claim-resources.yaml"
type: Exec
description: "Backing up Claims"
description: "Backing up Claims from all namespaces"

- exec:
command: sh
Expand All @@ -42,7 +42,7 @@ spec:
manualExecution:
- sh -c "cp edit-configuration-metadata/platform-ref-aws.configurations.meta.pkg.crossplane.io_v1.yaml testdata/plan/configurationv1.yaml"
type: Exec
description: "Editing the Configuration Meta resource with new family provider references"
description: "Replacing the monolithic provider dependencies in the Configuration metadata with references to the new family providers"

- exec:
command: sh
Expand All @@ -53,7 +53,7 @@ spec:
manualExecution:
- sh -c "up xpkg build --package-root={{PKG_ROOT}} --examples-root={{EXAMPLES_ROOT}} -o {{PKG_PATH}}"
type: Exec
description: "Building the new configuration pkg"
description: "Building the new Configuration package using up"

- exec:
command: sh
Expand All @@ -64,6 +64,6 @@ spec:
manualExecution:
- sh -c "up xpkg push {{TARGET_CONFIGURATION_PACKAGE}} -f {{PKG_PATH}}"
type: Exec
description: "Pushing the new configuration pkg"
description: "Pushing the new Configuration package"

version: 0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
manualExecution:
- sh -c "kubectl get claim --all-namespaces -o yaml > backup/claim-resources.yaml"
type: Exec
description: "Backing up Claims"
description: "Backing up Claims from all namespaces"

- patch:
type: merge
Expand All @@ -50,7 +50,7 @@ spec:
manualExecution:
- "kubectl apply -f new-ssop/provider-family-aws.providers.pkg.crossplane.io_v1.yaml"
type: Apply
description: "Installing the new family provider"
description: "Installing the new family config provider"

- exec:
command: sh
Expand All @@ -61,7 +61,7 @@ spec:
manualExecution:
- sh -c "kubectl wait provider.pkg provider-family-aws --for condition=Healthy"
type: Exec
description: "Checking health of new family provider"
description: "Checking the health of new family config provider"

- apply:
files:
Expand All @@ -72,7 +72,7 @@ spec:
- "kubectl apply -f new-ssop/provider-aws-ec2.providers.pkg.crossplane.io_v1.yaml"
- "kubectl apply -f new-ssop/provider-aws-eks.providers.pkg.crossplane.io_v1.yaml"
type: Apply
description: "Installing the new service scoped providers"
description: "Installing the new family resource providers"

- exec:
command: sh
Expand All @@ -83,7 +83,7 @@ spec:
manualExecution:
- sh -c "kubectl wait provider.pkg provider-aws-ec2 --for condition=Healthy"
type: Exec
description: "Checking health of new service scoped provider"
description: "Checking health of new family resource provider"

- exec:
command: sh
Expand All @@ -94,7 +94,7 @@ spec:
manualExecution:
- sh -c "kubectl wait provider.pkg provider-aws-eks --for condition=Healthy"
type: Exec
description: "Checking health of new service scoped provider"
description: "Checking health of new family resource provider"

- patch:
type: merge
Expand All @@ -104,7 +104,7 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f disable-dependency-resolution/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml --patch-file disable-dependency-resolution/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml"
type: Patch
description: "Setting the value of skipDependencyResolution field to true so that dependencies in the configuration package are not resolved automatically"
description: "Setting the value of spec.skipDependencyResolution field to true so that dependencies of the Crossplane Configuration package are not resolved automatically, in preparation of deleting the monolithic provider packages"

- patch:
type: merge
Expand All @@ -114,7 +114,7 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f edit-package-lock/lock.locks.pkg.crossplane.io_v1beta1.yaml --patch-file edit-package-lock/lock.locks.pkg.crossplane.io_v1beta1.yaml"
type: Patch
description: "Deleting configuration package dependency from Lock resource"
description: "Deleting the Configuration package dependency from the Lock resource in preparation of deleting the monolithic provider packages"

- delete:
options:
Expand All @@ -128,7 +128,7 @@ spec:
manualExecution:
- "kubectl delete Provider.pkg.crossplane.io provider-aws"
type: Delete
description: "Deleting monolithic provider"
description: "Deleting the monolithic provider package"

- patch:
type: merge
Expand All @@ -138,7 +138,7 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f activate-ssop/provider-family-aws.providers.pkg.crossplane.io_v1.yaml --patch-file activate-ssop/provider-family-aws.providers.pkg.crossplane.io_v1.yaml"
type: Patch
description: "Activating the new family provider after deletion monolithic one"
description: "Activating the new family config provider after the deletion of the monolithic one"

- exec:
command: sh
Expand All @@ -149,7 +149,7 @@ spec:
manualExecution:
- sh -c "kubectl wait provider.pkg provider-family-aws --for condition=Installed"
type: Exec
description: "Checking installation of new family provider"
description: "Checking the installation of new family config provider"

- patch:
type: merge
Expand All @@ -161,7 +161,7 @@ spec:
- "kubectl patch --type='merge' -f activate-ssop/provider-aws-ec2.providers.pkg.crossplane.io_v1.yaml --patch-file activate-ssop/provider-aws-ec2.providers.pkg.crossplane.io_v1.yaml"
- "kubectl patch --type='merge' -f activate-ssop/provider-aws-eks.providers.pkg.crossplane.io_v1.yaml --patch-file activate-ssop/provider-aws-eks.providers.pkg.crossplane.io_v1.yaml"
type: Patch
description: "Activating the new service scoped providers"
description: "Activating the new family resource providers"

- exec:
command: sh
Expand Down Expand Up @@ -194,7 +194,7 @@ spec:
manualExecution:
- sh -c "cp edit-configuration-metadata/platform-ref-aws.configurations.meta.pkg.crossplane.io_v1.yaml testdata/plan/configurationv1.yaml"
type: Exec
description: "Editing the Configuration Meta resource with new family provider references"
description: "Replacing the monolithic provider dependencies in the Configuration metadata with references to the new family providers"

- exec:
command: sh
Expand All @@ -205,7 +205,7 @@ spec:
manualExecution:
- sh -c "up xpkg build --package-root={{PKG_ROOT}} --examples-root={{EXAMPLES_ROOT}} -o {{PKG_PATH}}"
type: Exec
description: "Building the new configuration pkg"
description: "Building the new Configuration package using up"

- exec:
command: sh
Expand All @@ -216,7 +216,7 @@ spec:
manualExecution:
- sh -c "up xpkg push {{TARGET_CONFIGURATION_PACKAGE}} -f {{PKG_PATH}}"
type: Exec
description: "Pushing the new configuration pkg"
description: "Pushing the new Configuration package"

- patch:
type: merge
Expand All @@ -226,7 +226,7 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f edit-configuration-package/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml --patch-file edit-configuration-package/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml"
type: Patch
description: "Setting the configuration package reference to new one"
description: "Setting the Configuration package reference (spec.package) to the new one"

- patch:
type: merge
Expand All @@ -236,7 +236,7 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f enable-dependency-resolution/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml --patch-file enable-dependency-resolution/platform-ref-aws.configurations.pkg.crossplane.io_v1.yaml"
type: Patch
description: "Setting the value of skipDependencyResolution field in the configuration package back to false"
description: "Setting the value of spec.skipDependencyResolution field in the Configuration package back to false"

- patch:
type: merge
Expand All @@ -246,6 +246,6 @@ spec:
manualExecution:
- "kubectl patch --type='merge' -f deletion-policy-delete/sample-vpc.vpcs.fakesourceapi_v1alpha1.yaml --patch-file deletion-policy-delete/sample-vpc.vpcs.fakesourceapi_v1alpha1.yaml"
type: Patch
description: "Setting the deletion policies of Managed Resources whose deletion policy is set to Orphan at the beginning of the migration, to Delete again"
description: "Setting the deletion policies of Managed Resources whose deletion policy had been set to Orphan at the beginning of the migration process, back to Delete"

version: 0.1.0
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
manualExecution:
- sh -c "kubectl get claim --all-namespaces -o yaml > backup/claim-resources.yaml"
type: Exec
description: "Backing up Claims"
description: "Backing up Claims from all namespaces"

- exec:
command: sh
Expand All @@ -42,7 +42,7 @@ spec:
manualExecution:
- sh -c "cp edit-configuration-metadata/platform-ref-aws.configurations.meta.pkg.crossplane.io_v1alpha1.yaml testdata/plan/configurationv1alpha1.yaml"
type: Exec
description: "Editing the Configuration Meta resource with new family provider references"
description: "Replacing the monolithic provider dependencies in the Configuration metadata with references to the new family providers"

- exec:
command: sh
Expand All @@ -53,7 +53,7 @@ spec:
manualExecution:
- sh -c "up xpkg build --package-root={{PKG_ROOT}} --examples-root={{EXAMPLES_ROOT}} -o {{PKG_PATH}}"
type: Exec
description: "Building the new configuration pkg"
description: "Building the new Configuration package using up"

- exec:
command: sh
Expand All @@ -64,6 +64,6 @@ spec:
manualExecution:
- sh -c "up xpkg push {{TARGET_CONFIGURATION_PACKAGE}} -f {{PKG_PATH}}"
type: Exec
description: "Pushing the new configuration pkg"
description: "Pushing the new Configuration package"

version: 0.1.0
Loading