From e709c074e869e3d2da5fef596553addf137a9ff0 Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Tue, 21 Feb 2023 13:34:37 +0100 Subject: [PATCH] [Feature] Optional ResignLeadership (#1246) --- CHANGELOG.md | 1 + docs/generated/actions.md | 2 +- internal/actions.yaml | 1 + pkg/apis/deployment/v1/actions.generated.go | 2 +- .../deployment/v2alpha1/actions.generated.go | 160 ++++++++++++++++++ .../action.register.generated_test.go | 2 +- 6 files changed, 165 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d72f8dc09..01799719a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - (Maintenance) Add license range rewrite command - (Feature) Optional Action - (Maintenance) Add & Enable YAML Linter +- (Feature) Optional ResignLeadership Action ## [1.2.24](https://github.com/arangodb/kube-arangodb/tree/1.2.24) (2023-01-25) - (Bugfix) Fix deployment creation on ARM64 diff --git a/docs/generated/actions.md b/docs/generated/actions.md index 6de47d519..41a95de6d 100644 --- a/docs/generated/actions.md +++ b/docs/generated/actions.md @@ -50,7 +50,7 @@ | RemoveMember | no | 15m0s | no | Community & Enterprise | Removes member from the Cluster and Status | | RenewTLSCACertificate | no | 30m0s | no | Enterprise Only | Recreate Managed CA secret | | RenewTLSCertificate | no | 30m0s | no | Enterprise Only | Recreate Server TLS Certificate secret | -| ResignLeadership | no | 30m0s | no | Community & Enterprise | Run the ResignLeadership job on DBServer | +| ResignLeadership | no | 30m0s | yes | Community & Enterprise | Run the ResignLeadership job on DBServer | | ResourceSync | no | 10m0s | no | Community & Enterprise | Runs the Resource sync | | RotateMember | no | 15m0s | no | Community & Enterprise | Waits for Pod restart and recreation | | RotateStartMember | no | 15m0s | no | Community & Enterprise | Start member rotation. After this action member is down | diff --git a/internal/actions.yaml b/internal/actions.yaml index 9d415bccb..4d946c64e 100644 --- a/internal/actions.yaml +++ b/internal/actions.yaml @@ -25,6 +25,7 @@ actions: ResignLeadership: description: Run the ResignLeadership job on DBServer timeout: 30m + optional: true KillMemberPod: description: Execute Delete on Pod 9put pod in Terminating state) RotateMember: diff --git a/pkg/apis/deployment/v1/actions.generated.go b/pkg/apis/deployment/v1/actions.generated.go index 2062c1b60..ac2406949 100644 --- a/pkg/apis/deployment/v1/actions.generated.go +++ b/pkg/apis/deployment/v1/actions.generated.go @@ -759,7 +759,7 @@ func (a ActionType) Optional() bool { case ActionTypeRenewTLSCertificate: return false case ActionTypeResignLeadership: - return false + return true case ActionTypeResourceSync: return false case ActionTypeRotateMember: diff --git a/pkg/apis/deployment/v2alpha1/actions.generated.go b/pkg/apis/deployment/v2alpha1/actions.generated.go index ed6069596..7da1cc91b 100644 --- a/pkg/apis/deployment/v2alpha1/actions.generated.go +++ b/pkg/apis/deployment/v2alpha1/actions.generated.go @@ -662,3 +662,163 @@ func (a ActionType) Internal() bool { return false } } + +// Optional returns true if action execution wont abort Plan +func (a ActionType) Optional() bool { + switch a { + case ActionTypeAddMember: + return false + case ActionTypeAppendTLSCACertificate: + return false + case ActionTypeArangoMemberUpdatePodSpec: + return false + case ActionTypeArangoMemberUpdatePodStatus: + return false + case ActionTypeBackupRestore: + return false + case ActionTypeBackupRestoreClean: + return false + case ActionTypeBootstrapSetPassword: + return false + case ActionTypeBootstrapUpdate: + return false + case ActionTypeCleanOutMember: + return false + case ActionTypeCleanTLSCACertificate: + return false + case ActionTypeCleanTLSKeyfileCertificate: + return false + case ActionTypeClusterMemberCleanup: + return false + case ActionTypeDisableClusterScaling: + return false + case ActionTypeDisableMaintenance: + return false + case ActionTypeDisableMemberMaintenance: + return false + case ActionTypeEnableClusterScaling: + return false + case ActionTypeEnableMaintenance: + return false + case ActionTypeEnableMemberMaintenance: + return false + case ActionTypeEncryptionKeyAdd: + return false + case ActionTypeEncryptionKeyPropagated: + return false + case ActionTypeEncryptionKeyRefresh: + return false + case ActionTypeEncryptionKeyRemove: + return false + case ActionTypeEncryptionKeyStatusUpdate: + return false + case ActionTypeIdle: + return false + case ActionTypeJWTAdd: + return false + case ActionTypeJWTClean: + return false + case ActionTypeJWTPropagated: + return false + case ActionTypeJWTRefresh: + return false + case ActionTypeJWTSetActive: + return false + case ActionTypeJWTStatusUpdate: + return false + case ActionTypeKillMemberPod: + return false + case ActionTypeLicenseSet: + return false + case ActionTypeMarkToRemoveMember: + return false + case ActionTypeMemberPhaseUpdate: + return false + case ActionTypeMemberRIDUpdate: + return false + case ActionTypePVCResize: + return false + case ActionTypePVCResized: + return false + case ActionTypePlaceHolder: + return false + case ActionTypeRebalancerCheck: + return false + case ActionTypeRebalancerClean: + return false + case ActionTypeRebalancerGenerate: + return false + case ActionTypeRecreateMember: + return false + case ActionTypeRefreshTLSKeyfileCertificate: + return false + case ActionTypeRemoveMember: + return false + case ActionTypeRenewTLSCACertificate: + return false + case ActionTypeRenewTLSCertificate: + return false + case ActionTypeResignLeadership: + return true + case ActionTypeResourceSync: + return false + case ActionTypeRotateMember: + return false + case ActionTypeRotateStartMember: + return false + case ActionTypeRotateStopMember: + return false + case ActionTypeRuntimeContainerArgsLogLevelUpdate: + return false + case ActionTypeRuntimeContainerImageUpdate: + return false + case ActionTypeRuntimeContainerSyncTolerations: + return false + case ActionTypeSetCondition: + return false + case ActionTypeSetConditionV2: + return false + case ActionTypeSetCurrentImage: + return false + case ActionTypeSetCurrentMemberArch: + return false + case ActionTypeSetMaintenanceCondition: + return false + case ActionTypeSetMemberCondition: + return false + case ActionTypeSetMemberConditionV2: + return false + case ActionTypeSetMemberCurrentImage: + return false + case ActionTypeShutdownMember: + return false + case ActionTypeTLSKeyStatusUpdate: + return false + case ActionTypeTLSPropagated: + return false + case ActionTypeTimezoneSecretSet: + return false + case ActionTypeTopologyDisable: + return false + case ActionTypeTopologyEnable: + return false + case ActionTypeTopologyMemberAssignment: + return false + case ActionTypeTopologyZonesUpdate: + return false + case ActionTypeUpToDateUpdate: + return false + case ActionTypeUpdateTLSSNI: + return false + case ActionTypeUpgradeMember: + return false + case ActionTypeWaitForMemberInSync: + return false + case ActionTypeWaitForMemberReady: + return false + case ActionTypeWaitForMemberUp: + return false + default: + return false + } +} diff --git a/pkg/deployment/reconcile/action.register.generated_test.go b/pkg/deployment/reconcile/action.register.generated_test.go index 6e463d3c6..b8a2a0d09 100644 --- a/pkg/deployment/reconcile/action.register.generated_test.go +++ b/pkg/deployment/reconcile/action.register.generated_test.go @@ -496,7 +496,7 @@ func Test_Actions(t *testing.T) { require.False(t, api.ActionTypeResignLeadership.Internal()) }) t.Run("Optional", func(t *testing.T) { - require.False(t, api.ActionTypeResignLeadership.Optional()) + require.True(t, api.ActionTypeResignLeadership.Optional()) }) })