From 282a50e255e1286d9559c22ec6a36ad67591aece Mon Sep 17 00:00:00 2001 From: Adam Janikowski <12255597+ajanikow@users.noreply.github.com> Date: Fri, 18 Aug 2023 10:51:51 +0300 Subject: [PATCH] [Feature] Deprecate Actions (#1383) --- CHANGELOG.md | 1 + docs/generated/actions.md | 10 +- internal/actions.go | 21 +- internal/actions.go.tmpl | 15 +- internal/actions.register.go.tmpl | 31 +- internal/actions.register.test.go.tmpl | 9 + internal/actions.yaml | 13 +- pkg/apis/deployment/v1/actions.generated.go | 181 ++++++++- pkg/apis/deployment/v1/plan.go | 13 + .../reconcile/action.register.generated.go | 371 ++++++++++++------ .../action.register.generated_test.go | 15 + .../action_disable_scaling_cluster.go | 55 --- .../action_enable_scaling_cluster.go | 55 --- pkg/deployment/reconcile/action_helper.go | 25 +- .../reconcile/action_member_rid_update.go | 37 -- .../reconcile/action_set_condition.go | 82 ---- .../reconcile/action_set_member_condition.go | 82 ---- pkg/deployment/reconcile/plan_builder_high.go | 29 +- .../reconcile/plan_builder_rotate_upgrade.go | 25 +- pkg/util/assertion/assert.go | 3 +- 20 files changed, 600 insertions(+), 473 deletions(-) delete mode 100644 pkg/deployment/reconcile/action_disable_scaling_cluster.go delete mode 100644 pkg/deployment/reconcile/action_enable_scaling_cluster.go delete mode 100644 pkg/deployment/reconcile/action_member_rid_update.go delete mode 100644 pkg/deployment/reconcile/action_set_condition.go delete mode 100644 pkg/deployment/reconcile/action_set_member_condition.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 5070e0f5a..bd0c43eec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ - (Maintenance) Bump golang.org/x/net to v0.13.0 - (Feature) PVCResize action concurrency limit - (Feature) Optional Assertions +- (Feature) Deprecate Actions ## [1.2.32](https://github.com/arangodb/kube-arangodb/tree/1.2.32) (2023-08-07) - (Feature) Backup lifetime - remove Backup once its lifetime has been reached diff --git a/docs/generated/actions.md b/docs/generated/actions.md index 0b6bee716..4877918d0 100644 --- a/docs/generated/actions.md +++ b/docs/generated/actions.md @@ -18,10 +18,10 @@ | CleanTLSCACertificate | no | 30m0s | no | Enterprise Only | Remove Certificate from CA TrustStore | | CleanTLSKeyfileCertificate | no | 30m0s | no | Enterprise Only | Remove old TLS certificate from server | | ClusterMemberCleanup | no | 10m0s | no | Community & Enterprise | Remove member from Cluster if it is gone already (Coordinators) | -| DisableClusterScaling | no | 10m0s | no | Community & Enterprise | (Deprecated) Disable Cluster Scaling integration | +| ~~DisableClusterScaling~~ | no | 10m0s | no | Community & Enterprise | Disable Cluster Scaling integration | | DisableMaintenance | no | 10m0s | no | Community & Enterprise | Disable ArangoDB maintenance mode | | DisableMemberMaintenance | no | 10m0s | no | Enterprise Only | Disable ArangoDB DBServer maintenance mode | -| EnableClusterScaling | no | 10m0s | no | Community & Enterprise | (Deprecated) Enable Cluster Scaling integration | +| ~~EnableClusterScaling~~ | no | 10m0s | no | Community & Enterprise | Enable Cluster Scaling integration | | EnableMaintenance | no | 10m0s | no | Community & Enterprise | Enable ArangoDB maintenance mode | | EnableMemberMaintenance | no | 10m0s | no | Enterprise Only | Enable ArangoDB DBServer maintenance mode | | EncryptionKeyAdd | no | 10m0s | no | Enterprise Only | Add the encryption key to the pool | @@ -40,7 +40,7 @@ | LicenseSet | no | 10m0s | no | Community & Enterprise | Update Cluster license (3.9+) | | MarkToRemoveMember | no | 10m0s | no | Community & Enterprise | Marks member to be removed. Used when member Pod is annotated with replace annotation | | MemberPhaseUpdate | no | 10m0s | no | Community & Enterprise | Change member phase | -| MemberRIDUpdate | no | 10m0s | no | Community & Enterprise | Update Run ID of member | +| ~~MemberRIDUpdate~~ | no | 10m0s | no | Community & Enterprise | Update Run ID of member | | PVCResize | no | 30m0s | no | Community & Enterprise | Start the resize procedure. Updates PVC Requests field | | PVCResized | no | 15m0s | no | Community & Enterprise | Waits for PVC resize to be completed | | PlaceHolder | no | 10m0s | no | Community & Enterprise | Empty placeholder action | @@ -65,12 +65,12 @@ | RuntimeContainerArgsLogLevelUpdate | no | 10m0s | no | Community & Enterprise | Change ArangoDB Member log levels in runtime | | RuntimeContainerImageUpdate | no | 10m0s | no | Community & Enterprise | Update Container Image in runtime | | RuntimeContainerSyncTolerations | no | 10m0s | no | Community & Enterprise | Update Pod Tolerations in runtime | -| SetCondition | no | 10m0s | no | Community & Enterprise | (Deprecated) Set deployment condition | +| ~~SetCondition~~ | no | 10m0s | no | Community & Enterprise | Set deployment condition | | SetConditionV2 | no | 10m0s | no | Community & Enterprise | Set deployment condition | | SetCurrentImage | no | 6h0m0s | no | Community & Enterprise | Update deployment current image after image discovery | | SetCurrentMemberArch | no | 10m0s | no | Community & Enterprise | Set current member architecture | | SetMaintenanceCondition | no | 10m0s | no | Community & Enterprise | Update ArangoDB maintenance condition | -| SetMemberCondition | no | 10m0s | no | Community & Enterprise | (Deprecated) Set member condition | +| ~~SetMemberCondition~~ | no | 10m0s | no | Community & Enterprise | Set member condition | | SetMemberConditionV2 | no | 10m0s | no | Community & Enterprise | Set member condition | | SetMemberCurrentImage | no | 10m0s | no | Community & Enterprise | Update Member current image | | ShutdownMember | no | 30m0s | no | Community & Enterprise | Sends Shutdown requests and waits for container to be stopped | diff --git a/internal/actions.go b/internal/actions.go index 461c51195..c8ac14958 100644 --- a/internal/actions.go +++ b/internal/actions.go @@ -34,6 +34,7 @@ import ( "github.com/arangodb/kube-arangodb/internal/md" api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" + "github.com/arangodb/kube-arangodb/pkg/util" "github.com/arangodb/kube-arangodb/pkg/util/strings" ) @@ -188,6 +189,14 @@ func (i ActionsInput) Configurable() []string { return r } +func (i ActionsInput) Deprecated() map[string]string { + r := map[string]string{} + for k, a := range i.Actions { + r[k] = util.TypeOrDefault(a.Deprecated, "") + } + return r +} + type Action struct { Timeout *meta.Duration `json:"timeout,omitempty"` StartupFailureGracePeriod *meta.Duration `json:"startupFailureGracePeriod,omitempty"` @@ -203,6 +212,8 @@ type Action struct { Optional bool `json:"optional"` Configurable bool `json:"configurable"` + + Deprecated *string `json:"deprecated"` } func (a Action) InScope(scope string) bool { @@ -247,6 +258,7 @@ func RenderActions(root string) error { "timeouts": in.Timeouts(), "descriptions": in.Descriptions(), "optionals": in.Optionals(), + "deprecated": in.Deprecated(), "defaultTimeout": fmt.Sprintf("%d * time.Second // %s", in.DefaultTimeout.Duration/time.Second, in.DefaultTimeout.Duration.String()), }); err != nil { return err @@ -273,6 +285,7 @@ func RenderActions(root string) error { if err := i.Execute(out, map[string]interface{}{ "actions": in.Keys(), "startupFailureGracePeriods": in.StartFailureGracePeriods(), + "deprecated": in.Deprecated(), }); err != nil { return err } @@ -324,6 +337,7 @@ func RenderActions(root string) error { "startupFailureGracePeriods": in.StartFailureGracePeriods(), "internal": in.Internal(), "optional": in.Optionals(), + "deprecated": in.Deprecated(), }); err != nil { return err } @@ -352,6 +366,11 @@ func RenderActions(root string) error { ) for _, k := range in.Keys() { + name := k + if in.Actions[k].Deprecated != nil { + name = fmt.Sprintf("~~%s~~", name) + } + a := in.Actions[k] v := in.DefaultTimeout.Duration.String() if t := a.Timeout; t != nil { @@ -372,7 +391,7 @@ func RenderActions(root string) error { } if err := t.AddRow(map[md.Column]string{ - action: k, + action: name, timeout: v, description: a.Description, edition: vr, diff --git a/internal/actions.go.tmpl b/internal/actions.go.tmpl index 48e3714e4..46704e451 100644 --- a/internal/actions.go.tmpl +++ b/internal/actions.go.tmpl @@ -26,16 +26,23 @@ const ( // ActionsDefaultTimeout define default timeout ActionsDefaultTimeout time.Duration = {{ $root.defaultTimeout }} -{{- range .actions }} + +{{ range .actions -}} // Action{{ . }}DefaultTimeout define default timeout for action Action{{ . }} Action{{ . }}DefaultTimeout time.Duration = {{ index $root.timeouts . }} -{{- end }} +{{ end }} // Actions -{{ range .actions }} + +{{ range .actions -}} // ActionType{{ . }} in scopes {{ index $root.scopes . }}. {{ index $root.descriptions . }} +{{ if (index $root.deprecated .) -}} + // + // Deprecated: {{ index $root.deprecated . }} +{{ end -}} ActionType{{ . }} ActionType = "{{ . }}" -{{- end }} + +{{ end -}} ) func (a ActionType) DefaultTimeout() time.Duration { diff --git a/internal/actions.register.go.tmpl b/internal/actions.register.go.tmpl index b76f59b71..b4cf26820 100644 --- a/internal/actions.register.go.tmpl +++ b/internal/actions.register.go.tmpl @@ -27,30 +27,47 @@ import ( var ( // Ensure implementation {{- range .actions }} +{{- if not (index $root.deprecated .) }} _ Action = &action{{ . }}{} _ actionFactory = new{{ . }}Action {{- end }} +{{- end }} ) func init() { // Register all actions -{{- range .actions }} +{{ range .actions -}} // {{ . }} { - // Get Action defition - function := new{{ . }}Action + // Get Action type +{{ if (index $root.deprecated .) -}} + // nolint:staticcheck +{{ end -}} action := api.ActionType{{ . }} +{{ if (index $root.deprecated .) -}} + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction + +{{ else -}} + // Get Action defition + function := new{{ . }}Action + // Wrap action main function -{{- $startupFailureGracePeriod := index $root.startupFailureGracePeriods . -}} -{{- if $startupFailureGracePeriod }} + +{{ $startupFailureGracePeriod := index $root.startupFailureGracePeriods . -}} +{{ if $startupFailureGracePeriod -}} + // With StartupFailureGracePeriod function = withActionStartFailureGracePeriod(function, {{ $startupFailureGracePeriod }}) -{{- end }} + +{{ end -}} +{{ end -}} // Register action registerAction(action, function) } -{{- end }} + +{{ end -}} } \ No newline at end of file diff --git a/internal/actions.register.test.go.tmpl b/internal/actions.register.test.go.tmpl index c36f4dfc4..655a5a036 100644 --- a/internal/actions.register.test.go.tmpl +++ b/internal/actions.register.test.go.tmpl @@ -33,6 +33,9 @@ func Test_Actions(t *testing.T) { {{- range .actions }} t.Run("{{ . }}", func(t *testing.T) { +{{ if (index $root.deprecated .) -}} + // nolint:staticcheck +{{ end -}} ActionsExistence(t, api.ActionType{{ . }}) {{- $startupFailureGracePeriod := index $root.startupFailureGracePeriods . -}} {{- if $startupFailureGracePeriod }} @@ -40,6 +43,9 @@ func Test_Actions(t *testing.T) { {{- end }} {{- $isInternal := index $root.internal . }} t.Run("Internal", func(t *testing.T) { +{{- if (index $root.deprecated .) }} + // nolint:staticcheck +{{- end }} {{- if $isInternal }} require.True(t, api.ActionType{{ . }}.Internal()) {{- else }} @@ -48,6 +54,9 @@ func Test_Actions(t *testing.T) { }) {{- $isOptional := index $root.optional . }} t.Run("Optional", func(t *testing.T) { +{{- if (index $root.deprecated .) }} + // nolint:staticcheck +{{- end }} {{- if $isOptional }} require.True(t, api.ActionType{{ . }}.Optional()) {{- else }} diff --git a/internal/actions.yaml b/internal/actions.yaml index da6908374..27caa881c 100644 --- a/internal/actions.yaml +++ b/internal/actions.yaml @@ -100,9 +100,11 @@ actions: SetMemberCurrentImage: description: Update Member current image DisableClusterScaling: - description: (Deprecated) Disable Cluster Scaling integration + description: Disable Cluster Scaling integration + deprecated: "action is not used anymore" EnableClusterScaling: - description: (Deprecated) Enable Cluster Scaling integration + description: Enable Cluster Scaling integration + deprecated: "action is not used anymore" PVCResize: description: Start the resize procedure. Updates PVC Requests field timeout: 30m @@ -176,17 +178,19 @@ actions: scopes: - High SetMemberCondition: - description: (Deprecated) Set member condition + description: Set member condition scopes: - High + deprecated: "action is not used anymore" SetMemberConditionV2: description: Set member condition scopes: - High SetCondition: - description: (Deprecated) Set deployment condition + description: Set deployment condition scopes: - High + deprecated: "action is not used anymore" SetConditionV2: description: Set deployment condition scopes: @@ -195,6 +199,7 @@ actions: description: Update Run ID of member scopes: - High + deprecated: "action is not used anymore" ArangoMemberUpdatePodSpec: description: Propagate Member Pod spec (requested) scopes: diff --git a/pkg/apis/deployment/v1/actions.generated.go b/pkg/apis/deployment/v1/actions.generated.go index a2405782e..430c64718 100644 --- a/pkg/apis/deployment/v1/actions.generated.go +++ b/pkg/apis/deployment/v1/actions.generated.go @@ -25,168 +25,250 @@ const ( // ActionsDefaultTimeout define default timeout ActionsDefaultTimeout time.Duration = 600 * time.Second // 10m0s + // ActionAddMemberDefaultTimeout define default timeout for action ActionAddMember ActionAddMemberDefaultTimeout time.Duration = 600 * time.Second // 10m0s + // ActionAppendTLSCACertificateDefaultTimeout define default timeout for action ActionAppendTLSCACertificate ActionAppendTLSCACertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionArangoMemberUpdatePodSpecDefaultTimeout define default timeout for action ActionArangoMemberUpdatePodSpec ActionArangoMemberUpdatePodSpecDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionArangoMemberUpdatePodStatusDefaultTimeout define default timeout for action ActionArangoMemberUpdatePodStatus ActionArangoMemberUpdatePodStatusDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionBackupRestoreDefaultTimeout define default timeout for action ActionBackupRestore ActionBackupRestoreDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionBackupRestoreCleanDefaultTimeout define default timeout for action ActionBackupRestoreClean ActionBackupRestoreCleanDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionBootstrapSetPasswordDefaultTimeout define default timeout for action ActionBootstrapSetPassword ActionBootstrapSetPasswordDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionBootstrapUpdateDefaultTimeout define default timeout for action ActionBootstrapUpdate ActionBootstrapUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionCleanMemberServiceDefaultTimeout define default timeout for action ActionCleanMemberService ActionCleanMemberServiceDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionCleanOutMemberDefaultTimeout define default timeout for action ActionCleanOutMember ActionCleanOutMemberDefaultTimeout time.Duration = 172800 * time.Second // 48h0m0s + // ActionCleanTLSCACertificateDefaultTimeout define default timeout for action ActionCleanTLSCACertificate ActionCleanTLSCACertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionCleanTLSKeyfileCertificateDefaultTimeout define default timeout for action ActionCleanTLSKeyfileCertificate ActionCleanTLSKeyfileCertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionClusterMemberCleanupDefaultTimeout define default timeout for action ActionClusterMemberCleanup ActionClusterMemberCleanupDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionDisableClusterScalingDefaultTimeout define default timeout for action ActionDisableClusterScaling ActionDisableClusterScalingDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionDisableMaintenanceDefaultTimeout define default timeout for action ActionDisableMaintenance ActionDisableMaintenanceDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionDisableMemberMaintenanceDefaultTimeout define default timeout for action ActionDisableMemberMaintenance ActionDisableMemberMaintenanceDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEnableClusterScalingDefaultTimeout define default timeout for action ActionEnableClusterScaling ActionEnableClusterScalingDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEnableMaintenanceDefaultTimeout define default timeout for action ActionEnableMaintenance ActionEnableMaintenanceDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEnableMemberMaintenanceDefaultTimeout define default timeout for action ActionEnableMemberMaintenance ActionEnableMemberMaintenanceDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEncryptionKeyAddDefaultTimeout define default timeout for action ActionEncryptionKeyAdd ActionEncryptionKeyAddDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEncryptionKeyPropagatedDefaultTimeout define default timeout for action ActionEncryptionKeyPropagated ActionEncryptionKeyPropagatedDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEncryptionKeyRefreshDefaultTimeout define default timeout for action ActionEncryptionKeyRefresh ActionEncryptionKeyRefreshDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEncryptionKeyRemoveDefaultTimeout define default timeout for action ActionEncryptionKeyRemove ActionEncryptionKeyRemoveDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionEncryptionKeyStatusUpdateDefaultTimeout define default timeout for action ActionEncryptionKeyStatusUpdate ActionEncryptionKeyStatusUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionIdleDefaultTimeout define default timeout for action ActionIdle ActionIdleDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTAddDefaultTimeout define default timeout for action ActionJWTAdd ActionJWTAddDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTCleanDefaultTimeout define default timeout for action ActionJWTClean ActionJWTCleanDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTPropagatedDefaultTimeout define default timeout for action ActionJWTPropagated ActionJWTPropagatedDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTRefreshDefaultTimeout define default timeout for action ActionJWTRefresh ActionJWTRefreshDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTSetActiveDefaultTimeout define default timeout for action ActionJWTSetActive ActionJWTSetActiveDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionJWTStatusUpdateDefaultTimeout define default timeout for action ActionJWTStatusUpdate ActionJWTStatusUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionKillMemberPodDefaultTimeout define default timeout for action ActionKillMemberPod ActionKillMemberPodDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionLicenseSetDefaultTimeout define default timeout for action ActionLicenseSet ActionLicenseSetDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionMarkToRemoveMemberDefaultTimeout define default timeout for action ActionMarkToRemoveMember ActionMarkToRemoveMemberDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionMemberPhaseUpdateDefaultTimeout define default timeout for action ActionMemberPhaseUpdate ActionMemberPhaseUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionMemberRIDUpdateDefaultTimeout define default timeout for action ActionMemberRIDUpdate ActionMemberRIDUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionPVCResizeDefaultTimeout define default timeout for action ActionPVCResize ActionPVCResizeDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionPVCResizedDefaultTimeout define default timeout for action ActionPVCResized ActionPVCResizedDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionPlaceHolderDefaultTimeout define default timeout for action ActionPlaceHolder ActionPlaceHolderDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerCheckDefaultTimeout define default timeout for action ActionRebalancerCheck ActionRebalancerCheckDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerCheckV2DefaultTimeout define default timeout for action ActionRebalancerCheckV2 ActionRebalancerCheckV2DefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerCleanDefaultTimeout define default timeout for action ActionRebalancerClean ActionRebalancerCleanDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerCleanV2DefaultTimeout define default timeout for action ActionRebalancerCleanV2 ActionRebalancerCleanV2DefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerGenerateDefaultTimeout define default timeout for action ActionRebalancerGenerate ActionRebalancerGenerateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebalancerGenerateV2DefaultTimeout define default timeout for action ActionRebalancerGenerateV2 ActionRebalancerGenerateV2DefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRebuildOutSyncedShardsDefaultTimeout define default timeout for action ActionRebuildOutSyncedShards ActionRebuildOutSyncedShardsDefaultTimeout time.Duration = 86400 * time.Second // 24h0m0s + // ActionRecreateMemberDefaultTimeout define default timeout for action ActionRecreateMember ActionRecreateMemberDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRefreshTLSKeyfileCertificateDefaultTimeout define default timeout for action ActionRefreshTLSKeyfileCertificate ActionRefreshTLSKeyfileCertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionRemoveMemberDefaultTimeout define default timeout for action ActionRemoveMember ActionRemoveMemberDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRemoveMemberPVCDefaultTimeout define default timeout for action ActionRemoveMemberPVC ActionRemoveMemberPVCDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRenewTLSCACertificateDefaultTimeout define default timeout for action ActionRenewTLSCACertificate ActionRenewTLSCACertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionRenewTLSCertificateDefaultTimeout define default timeout for action ActionRenewTLSCertificate ActionRenewTLSCertificateDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionResignLeadershipDefaultTimeout define default timeout for action ActionResignLeadership ActionResignLeadershipDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionResourceSyncDefaultTimeout define default timeout for action ActionResourceSync ActionResourceSyncDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRotateMemberDefaultTimeout define default timeout for action ActionRotateMember ActionRotateMemberDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRotateStartMemberDefaultTimeout define default timeout for action ActionRotateStartMember ActionRotateStartMemberDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRotateStopMemberDefaultTimeout define default timeout for action ActionRotateStopMember ActionRotateStopMemberDefaultTimeout time.Duration = 900 * time.Second // 15m0s + // ActionRuntimeContainerArgsLogLevelUpdateDefaultTimeout define default timeout for action ActionRuntimeContainerArgsLogLevelUpdate ActionRuntimeContainerArgsLogLevelUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRuntimeContainerImageUpdateDefaultTimeout define default timeout for action ActionRuntimeContainerImageUpdate ActionRuntimeContainerImageUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionRuntimeContainerSyncTolerationsDefaultTimeout define default timeout for action ActionRuntimeContainerSyncTolerations ActionRuntimeContainerSyncTolerationsDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetConditionDefaultTimeout define default timeout for action ActionSetCondition ActionSetConditionDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetConditionV2DefaultTimeout define default timeout for action ActionSetConditionV2 ActionSetConditionV2DefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetCurrentImageDefaultTimeout define default timeout for action ActionSetCurrentImage ActionSetCurrentImageDefaultTimeout time.Duration = 21600 * time.Second // 6h0m0s + // ActionSetCurrentMemberArchDefaultTimeout define default timeout for action ActionSetCurrentMemberArch ActionSetCurrentMemberArchDefaultTimeout time.Duration = 600 * time.Second // 10m0s + // ActionSetMaintenanceConditionDefaultTimeout define default timeout for action ActionSetMaintenanceCondition ActionSetMaintenanceConditionDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetMemberConditionDefaultTimeout define default timeout for action ActionSetMemberCondition ActionSetMemberConditionDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetMemberConditionV2DefaultTimeout define default timeout for action ActionSetMemberConditionV2 ActionSetMemberConditionV2DefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionSetMemberCurrentImageDefaultTimeout define default timeout for action ActionSetMemberCurrentImage ActionSetMemberCurrentImageDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionShutdownMemberDefaultTimeout define default timeout for action ActionShutdownMember ActionShutdownMemberDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionTLSKeyStatusUpdateDefaultTimeout define default timeout for action ActionTLSKeyStatusUpdate ActionTLSKeyStatusUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionTLSPropagatedDefaultTimeout define default timeout for action ActionTLSPropagated ActionTLSPropagatedDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionTimezoneSecretSetDefaultTimeout define default timeout for action ActionTimezoneSecretSet ActionTimezoneSecretSetDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionTopologyDisableDefaultTimeout define default timeout for action ActionTopologyDisable ActionTopologyDisableDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionTopologyEnableDefaultTimeout define default timeout for action ActionTopologyEnable ActionTopologyEnableDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionTopologyMemberAssignmentDefaultTimeout define default timeout for action ActionTopologyMemberAssignment ActionTopologyMemberAssignmentDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionTopologyZonesUpdateDefaultTimeout define default timeout for action ActionTopologyZonesUpdate ActionTopologyZonesUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionUpToDateUpdateDefaultTimeout define default timeout for action ActionUpToDateUpdate ActionUpToDateUpdateDefaultTimeout time.Duration = ActionsDefaultTimeout + // ActionUpdateTLSSNIDefaultTimeout define default timeout for action ActionUpdateTLSSNI ActionUpdateTLSSNIDefaultTimeout time.Duration = 600 * time.Second // 10m0s + // ActionUpgradeMemberDefaultTimeout define default timeout for action ActionUpgradeMember ActionUpgradeMemberDefaultTimeout time.Duration = 21600 * time.Second // 6h0m0s + // ActionWaitForMemberInSyncDefaultTimeout define default timeout for action ActionWaitForMemberInSync ActionWaitForMemberInSyncDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionWaitForMemberReadyDefaultTimeout define default timeout for action ActionWaitForMemberReady ActionWaitForMemberReadyDefaultTimeout time.Duration = 1800 * time.Second // 30m0s + // ActionWaitForMemberUpDefaultTimeout define default timeout for action ActionWaitForMemberUp ActionWaitForMemberUpDefaultTimeout time.Duration = 1800 * time.Second // 30m0s @@ -194,166 +276,257 @@ const ( // ActionTypeAddMember in scopes Normal. Adds new member to the Member list ActionTypeAddMember ActionType = "AddMember" + // ActionTypeAppendTLSCACertificate in scopes Normal. Append Certificate into CA TrustStore ActionTypeAppendTLSCACertificate ActionType = "AppendTLSCACertificate" + // ActionTypeArangoMemberUpdatePodSpec in scopes High. Propagate Member Pod spec (requested) ActionTypeArangoMemberUpdatePodSpec ActionType = "ArangoMemberUpdatePodSpec" + // ActionTypeArangoMemberUpdatePodStatus in scopes High. Propagate Member Pod status (current) ActionTypeArangoMemberUpdatePodStatus ActionType = "ArangoMemberUpdatePodStatus" + // ActionTypeBackupRestore in scopes Normal. Restore selected Backup ActionTypeBackupRestore ActionType = "BackupRestore" + // ActionTypeBackupRestoreClean in scopes Normal. Clean restore status in case of restore spec change ActionTypeBackupRestoreClean ActionType = "BackupRestoreClean" + // ActionTypeBootstrapSetPassword in scopes Normal. Change password during bootstrap procedure ActionTypeBootstrapSetPassword ActionType = "BootstrapSetPassword" + // ActionTypeBootstrapUpdate in scopes Normal. Update bootstrap status ActionTypeBootstrapUpdate ActionType = "BootstrapUpdate" + // ActionTypeCleanMemberService in scopes Normal. Removes Server Service ActionTypeCleanMemberService ActionType = "CleanMemberService" + // ActionTypeCleanOutMember in scopes Normal. Run the CleanOut job on member ActionTypeCleanOutMember ActionType = "CleanOutMember" + // ActionTypeCleanTLSCACertificate in scopes Normal. Remove Certificate from CA TrustStore ActionTypeCleanTLSCACertificate ActionType = "CleanTLSCACertificate" + // ActionTypeCleanTLSKeyfileCertificate in scopes Normal. Remove old TLS certificate from server ActionTypeCleanTLSKeyfileCertificate ActionType = "CleanTLSKeyfileCertificate" + // ActionTypeClusterMemberCleanup in scopes Normal. Remove member from Cluster if it is gone already (Coordinators) ActionTypeClusterMemberCleanup ActionType = "ClusterMemberCleanup" - // ActionTypeDisableClusterScaling in scopes Normal. (Deprecated) Disable Cluster Scaling integration + + // ActionTypeDisableClusterScaling in scopes Normal. Disable Cluster Scaling integration + // + // Deprecated: action is not used anymore ActionTypeDisableClusterScaling ActionType = "DisableClusterScaling" + // ActionTypeDisableMaintenance in scopes Normal. Disable ArangoDB maintenance mode ActionTypeDisableMaintenance ActionType = "DisableMaintenance" + // ActionTypeDisableMemberMaintenance in scopes Normal. Disable ArangoDB DBServer maintenance mode ActionTypeDisableMemberMaintenance ActionType = "DisableMemberMaintenance" - // ActionTypeEnableClusterScaling in scopes Normal. (Deprecated) Enable Cluster Scaling integration + + // ActionTypeEnableClusterScaling in scopes Normal. Enable Cluster Scaling integration + // + // Deprecated: action is not used anymore ActionTypeEnableClusterScaling ActionType = "EnableClusterScaling" + // ActionTypeEnableMaintenance in scopes Normal. Enable ArangoDB maintenance mode ActionTypeEnableMaintenance ActionType = "EnableMaintenance" + // ActionTypeEnableMemberMaintenance in scopes Normal. Enable ArangoDB DBServer maintenance mode ActionTypeEnableMemberMaintenance ActionType = "EnableMemberMaintenance" + // ActionTypeEncryptionKeyAdd in scopes Normal. Add the encryption key to the pool ActionTypeEncryptionKeyAdd ActionType = "EncryptionKeyAdd" + // ActionTypeEncryptionKeyPropagated in scopes Normal. Update condition of encryption propagation ActionTypeEncryptionKeyPropagated ActionType = "EncryptionKeyPropagated" + // ActionTypeEncryptionKeyRefresh in scopes Normal. Refresh the encryption keys on member ActionTypeEncryptionKeyRefresh ActionType = "EncryptionKeyRefresh" + // ActionTypeEncryptionKeyRemove in scopes Normal. Remove the encryption key to the pool ActionTypeEncryptionKeyRemove ActionType = "EncryptionKeyRemove" + // ActionTypeEncryptionKeyStatusUpdate in scopes Normal. Update status of encryption propagation ActionTypeEncryptionKeyStatusUpdate ActionType = "EncryptionKeyStatusUpdate" + // ActionTypeIdle in scopes Normal. Define idle operation in case if preconditions are not meet ActionTypeIdle ActionType = "Idle" + // ActionTypeJWTAdd in scopes Normal. Adds new JWT to the pool ActionTypeJWTAdd ActionType = "JWTAdd" + // ActionTypeJWTClean in scopes Normal. Remove JWT key from the pool ActionTypeJWTClean ActionType = "JWTClean" + // ActionTypeJWTPropagated in scopes Normal. Update condition of JWT propagation ActionTypeJWTPropagated ActionType = "JWTPropagated" + // ActionTypeJWTRefresh in scopes Normal. Refresh current JWT secrets on the member ActionTypeJWTRefresh ActionType = "JWTRefresh" + // ActionTypeJWTSetActive in scopes Normal. Change active JWT key on the cluster ActionTypeJWTSetActive ActionType = "JWTSetActive" + // ActionTypeJWTStatusUpdate in scopes Normal. Update status of JWT propagation ActionTypeJWTStatusUpdate ActionType = "JWTStatusUpdate" + // ActionTypeKillMemberPod in scopes Normal. Execute Delete on Pod 9put pod in Terminating state) ActionTypeKillMemberPod ActionType = "KillMemberPod" + // ActionTypeLicenseSet in scopes Normal. Update Cluster license (3.9+) ActionTypeLicenseSet ActionType = "LicenseSet" + // ActionTypeMarkToRemoveMember in scopes Normal. Marks member to be removed. Used when member Pod is annotated with replace annotation ActionTypeMarkToRemoveMember ActionType = "MarkToRemoveMember" + // ActionTypeMemberPhaseUpdate in scopes High. Change member phase ActionTypeMemberPhaseUpdate ActionType = "MemberPhaseUpdate" + // ActionTypeMemberRIDUpdate in scopes High. Update Run ID of member + // + // Deprecated: action is not used anymore ActionTypeMemberRIDUpdate ActionType = "MemberRIDUpdate" + // ActionTypePVCResize in scopes Normal. Start the resize procedure. Updates PVC Requests field ActionTypePVCResize ActionType = "PVCResize" + // ActionTypePVCResized in scopes Normal. Waits for PVC resize to be completed ActionTypePVCResized ActionType = "PVCResized" + // ActionTypePlaceHolder in scopes Normal. Empty placeholder action ActionTypePlaceHolder ActionType = "PlaceHolder" + // ActionTypeRebalancerCheck in scopes Normal. Check Rebalancer job progress ActionTypeRebalancerCheck ActionType = "RebalancerCheck" + // ActionTypeRebalancerCheckV2 in scopes Normal. Check Rebalancer job progress ActionTypeRebalancerCheckV2 ActionType = "RebalancerCheckV2" + // ActionTypeRebalancerClean in scopes Normal. Cleans Rebalancer jobs ActionTypeRebalancerClean ActionType = "RebalancerClean" + // ActionTypeRebalancerCleanV2 in scopes Normal. Cleans Rebalancer jobs ActionTypeRebalancerCleanV2 ActionType = "RebalancerCleanV2" + // ActionTypeRebalancerGenerate in scopes Normal. Generates the Rebalancer plan ActionTypeRebalancerGenerate ActionType = "RebalancerGenerate" + // ActionTypeRebalancerGenerateV2 in scopes Normal. Generates the Rebalancer plan ActionTypeRebalancerGenerateV2 ActionType = "RebalancerGenerateV2" + // ActionTypeRebuildOutSyncedShards in scopes High. Run Rebuild Out Synced Shards procedure for DBServers ActionTypeRebuildOutSyncedShards ActionType = "RebuildOutSyncedShards" + // ActionTypeRecreateMember in scopes Normal. Recreate member with same ID and Data ActionTypeRecreateMember ActionType = "RecreateMember" + // ActionTypeRefreshTLSKeyfileCertificate in scopes Normal. Recreate Server TLS Certificate secret ActionTypeRefreshTLSKeyfileCertificate ActionType = "RefreshTLSKeyfileCertificate" + // ActionTypeRemoveMember in scopes Normal. Removes member from the Cluster and Status ActionTypeRemoveMember ActionType = "RemoveMember" + // ActionTypeRemoveMemberPVC in scopes Normal. Removes member PVC and enforce recreate procedure ActionTypeRemoveMemberPVC ActionType = "RemoveMemberPVC" + // ActionTypeRenewTLSCACertificate in scopes Normal. Recreate Managed CA secret ActionTypeRenewTLSCACertificate ActionType = "RenewTLSCACertificate" + // ActionTypeRenewTLSCertificate in scopes Normal. Recreate Server TLS Certificate secret ActionTypeRenewTLSCertificate ActionType = "RenewTLSCertificate" + // ActionTypeResignLeadership in scopes Normal. Run the ResignLeadership job on DBServer ActionTypeResignLeadership ActionType = "ResignLeadership" + // ActionTypeResourceSync in scopes Normal. Runs the Resource sync ActionTypeResourceSync ActionType = "ResourceSync" + // ActionTypeRotateMember in scopes Normal. Waits for Pod restart and recreation ActionTypeRotateMember ActionType = "RotateMember" + // ActionTypeRotateStartMember in scopes Normal. Start member rotation. After this action member is down ActionTypeRotateStartMember ActionType = "RotateStartMember" + // ActionTypeRotateStopMember in scopes Normal. Finalize member rotation. After this action member is started back ActionTypeRotateStopMember ActionType = "RotateStopMember" + // ActionTypeRuntimeContainerArgsLogLevelUpdate in scopes Normal. Change ArangoDB Member log levels in runtime ActionTypeRuntimeContainerArgsLogLevelUpdate ActionType = "RuntimeContainerArgsLogLevelUpdate" + // ActionTypeRuntimeContainerImageUpdate in scopes Normal. Update Container Image in runtime ActionTypeRuntimeContainerImageUpdate ActionType = "RuntimeContainerImageUpdate" + // ActionTypeRuntimeContainerSyncTolerations in scopes Normal. Update Pod Tolerations in runtime ActionTypeRuntimeContainerSyncTolerations ActionType = "RuntimeContainerSyncTolerations" - // ActionTypeSetCondition in scopes High. (Deprecated) Set deployment condition + + // ActionTypeSetCondition in scopes High. Set deployment condition + // + // Deprecated: action is not used anymore ActionTypeSetCondition ActionType = "SetCondition" + // ActionTypeSetConditionV2 in scopes High. Set deployment condition ActionTypeSetConditionV2 ActionType = "SetConditionV2" + // ActionTypeSetCurrentImage in scopes Normal. Update deployment current image after image discovery ActionTypeSetCurrentImage ActionType = "SetCurrentImage" + // ActionTypeSetCurrentMemberArch in scopes Normal. Set current member architecture ActionTypeSetCurrentMemberArch ActionType = "SetCurrentMemberArch" + // ActionTypeSetMaintenanceCondition in scopes Normal. Update ArangoDB maintenance condition ActionTypeSetMaintenanceCondition ActionType = "SetMaintenanceCondition" - // ActionTypeSetMemberCondition in scopes High. (Deprecated) Set member condition + + // ActionTypeSetMemberCondition in scopes High. Set member condition + // + // Deprecated: action is not used anymore ActionTypeSetMemberCondition ActionType = "SetMemberCondition" + // ActionTypeSetMemberConditionV2 in scopes High. Set member condition ActionTypeSetMemberConditionV2 ActionType = "SetMemberConditionV2" + // ActionTypeSetMemberCurrentImage in scopes Normal. Update Member current image ActionTypeSetMemberCurrentImage ActionType = "SetMemberCurrentImage" + // ActionTypeShutdownMember in scopes Normal. Sends Shutdown requests and waits for container to be stopped ActionTypeShutdownMember ActionType = "ShutdownMember" + // ActionTypeTLSKeyStatusUpdate in scopes Normal. Update Status of TLS propagation process ActionTypeTLSKeyStatusUpdate ActionType = "TLSKeyStatusUpdate" + // ActionTypeTLSPropagated in scopes Normal. Update TLS propagation condition ActionTypeTLSPropagated ActionType = "TLSPropagated" + // ActionTypeTimezoneSecretSet in scopes Normal. Set timezone details in cluster ActionTypeTimezoneSecretSet ActionType = "TimezoneSecretSet" + // ActionTypeTopologyDisable in scopes Normal. Disable TopologyAwareness ActionTypeTopologyDisable ActionType = "TopologyDisable" + // ActionTypeTopologyEnable in scopes Normal. Enable TopologyAwareness ActionTypeTopologyEnable ActionType = "TopologyEnable" + // ActionTypeTopologyMemberAssignment in scopes Normal. Update TopologyAwareness Members assignments ActionTypeTopologyMemberAssignment ActionType = "TopologyMemberAssignment" + // ActionTypeTopologyZonesUpdate in scopes Normal. Update TopologyAwareness Zones info ActionTypeTopologyZonesUpdate ActionType = "TopologyZonesUpdate" + // ActionTypeUpToDateUpdate in scopes Normal. Update UpToDate condition ActionTypeUpToDateUpdate ActionType = "UpToDateUpdate" + // ActionTypeUpdateTLSSNI in scopes Normal. Update certificate in SNI ActionTypeUpdateTLSSNI ActionType = "UpdateTLSSNI" + // ActionTypeUpgradeMember in scopes Normal. Run the Upgrade procedure on member ActionTypeUpgradeMember ActionType = "UpgradeMember" + // ActionTypeWaitForMemberInSync in scopes Normal. Wait for member to be in sync. In case of DBServer waits for shards. In case of Agents to catch-up on Agency index ActionTypeWaitForMemberInSync ActionType = "WaitForMemberInSync" + // ActionTypeWaitForMemberReady in scopes Normal. Wait for member Ready condition ActionTypeWaitForMemberReady ActionType = "WaitForMemberReady" + // ActionTypeWaitForMemberUp in scopes Normal. Wait for member to be responsive ActionTypeWaitForMemberUp ActionType = "WaitForMemberUp" ) diff --git a/pkg/apis/deployment/v1/plan.go b/pkg/apis/deployment/v1/plan.go index 5b4a9e06a..6ef50583f 100644 --- a/pkg/apis/deployment/v1/plan.go +++ b/pkg/apis/deployment/v1/plan.go @@ -286,6 +286,19 @@ func (p Plan) Before(action ...Action) Plan { return n } +// WrapWithPlan wraps plan with plan +func (p Plan) WrapWithPlan(before, after Plan) Plan { + n := Plan{} + + n = append(n, before...) + + n = append(n, p...) + + n = append(n, after...) + + return n +} + // Wrap wraps plan with actions func (p Plan) Wrap(before, after Action) Plan { n := Plan{} diff --git a/pkg/deployment/reconcile/action.register.generated.go b/pkg/deployment/reconcile/action.register.generated.go index f4c1996dc..daa677c90 100644 --- a/pkg/deployment/reconcile/action.register.generated.go +++ b/pkg/deployment/reconcile/action.register.generated.go @@ -66,18 +66,12 @@ var ( _ Action = &actionClusterMemberCleanup{} _ actionFactory = newClusterMemberCleanupAction - _ Action = &actionDisableClusterScaling{} - _ actionFactory = newDisableClusterScalingAction - _ Action = &actionDisableMaintenance{} _ actionFactory = newDisableMaintenanceAction _ Action = &actionDisableMemberMaintenance{} _ actionFactory = newDisableMemberMaintenanceAction - _ Action = &actionEnableClusterScaling{} - _ actionFactory = newEnableClusterScalingAction - _ Action = &actionEnableMaintenance{} _ actionFactory = newEnableMaintenanceAction @@ -132,9 +126,6 @@ var ( _ Action = &actionMemberPhaseUpdate{} _ actionFactory = newMemberPhaseUpdateAction - _ Action = &actionMemberRIDUpdate{} - _ actionFactory = newMemberRIDUpdateAction - _ Action = &actionPVCResize{} _ actionFactory = newPVCResizeAction @@ -207,9 +198,6 @@ var ( _ Action = &actionRuntimeContainerSyncTolerations{} _ actionFactory = newRuntimeContainerSyncTolerationsAction - _ Action = &actionSetCondition{} - _ actionFactory = newSetConditionAction - _ Action = &actionSetConditionV2{} _ actionFactory = newSetConditionV2Action @@ -222,9 +210,6 @@ var ( _ Action = &actionSetMaintenanceCondition{} _ actionFactory = newSetMaintenanceConditionAction - _ Action = &actionSetMemberCondition{} - _ actionFactory = newSetMemberConditionAction - _ Action = &actionSetMemberConditionV2{} _ actionFactory = newSetMemberConditionV2Action @@ -279,9 +264,11 @@ func init() { // AddMember { + // Get Action type + action := api.ActionTypeAddMember + // Get Action defition function := newAddMemberAction - action := api.ActionTypeAddMember // Wrap action main function @@ -291,9 +278,11 @@ func init() { // AppendTLSCACertificate { + // Get Action type + action := api.ActionTypeAppendTLSCACertificate + // Get Action defition function := newAppendTLSCACertificateAction - action := api.ActionTypeAppendTLSCACertificate // Wrap action main function @@ -303,9 +292,11 @@ func init() { // ArangoMemberUpdatePodSpec { + // Get Action type + action := api.ActionTypeArangoMemberUpdatePodSpec + // Get Action defition function := newArangoMemberUpdatePodSpecAction - action := api.ActionTypeArangoMemberUpdatePodSpec // Wrap action main function @@ -315,9 +306,11 @@ func init() { // ArangoMemberUpdatePodStatus { + // Get Action type + action := api.ActionTypeArangoMemberUpdatePodStatus + // Get Action defition function := newArangoMemberUpdatePodStatusAction - action := api.ActionTypeArangoMemberUpdatePodStatus // Wrap action main function @@ -327,9 +320,11 @@ func init() { // BackupRestore { + // Get Action type + action := api.ActionTypeBackupRestore + // Get Action defition function := newBackupRestoreAction - action := api.ActionTypeBackupRestore // Wrap action main function @@ -339,9 +334,11 @@ func init() { // BackupRestoreClean { + // Get Action type + action := api.ActionTypeBackupRestoreClean + // Get Action defition function := newBackupRestoreCleanAction - action := api.ActionTypeBackupRestoreClean // Wrap action main function @@ -351,9 +348,11 @@ func init() { // BootstrapSetPassword { + // Get Action type + action := api.ActionTypeBootstrapSetPassword + // Get Action defition function := newBootstrapSetPasswordAction - action := api.ActionTypeBootstrapSetPassword // Wrap action main function @@ -363,9 +362,11 @@ func init() { // BootstrapUpdate { + // Get Action type + action := api.ActionTypeBootstrapUpdate + // Get Action defition function := newBootstrapUpdateAction - action := api.ActionTypeBootstrapUpdate // Wrap action main function @@ -375,9 +376,11 @@ func init() { // CleanMemberService { + // Get Action type + action := api.ActionTypeCleanMemberService + // Get Action defition function := newCleanMemberServiceAction - action := api.ActionTypeCleanMemberService // Wrap action main function @@ -387,9 +390,11 @@ func init() { // CleanOutMember { + // Get Action type + action := api.ActionTypeCleanOutMember + // Get Action defition function := newCleanOutMemberAction - action := api.ActionTypeCleanOutMember // Wrap action main function @@ -399,9 +404,11 @@ func init() { // CleanTLSCACertificate { + // Get Action type + action := api.ActionTypeCleanTLSCACertificate + // Get Action defition function := newCleanTLSCACertificateAction - action := api.ActionTypeCleanTLSCACertificate // Wrap action main function @@ -411,9 +418,11 @@ func init() { // CleanTLSKeyfileCertificate { + // Get Action type + action := api.ActionTypeCleanTLSKeyfileCertificate + // Get Action defition function := newCleanTLSKeyfileCertificateAction - action := api.ActionTypeCleanTLSKeyfileCertificate // Wrap action main function @@ -423,9 +432,11 @@ func init() { // ClusterMemberCleanup { + // Get Action type + action := api.ActionTypeClusterMemberCleanup + // Get Action defition function := newClusterMemberCleanupAction - action := api.ActionTypeClusterMemberCleanup // Wrap action main function @@ -435,11 +446,12 @@ func init() { // DisableClusterScaling { - // Get Action defition - function := newDisableClusterScalingAction + // Get Action type + // nolint:staticcheck action := api.ActionTypeDisableClusterScaling - // Wrap action main function + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction // Register action registerAction(action, function) @@ -447,9 +459,11 @@ func init() { // DisableMaintenance { + // Get Action type + action := api.ActionTypeDisableMaintenance + // Get Action defition function := newDisableMaintenanceAction - action := api.ActionTypeDisableMaintenance // Wrap action main function @@ -459,9 +473,11 @@ func init() { // DisableMemberMaintenance { + // Get Action type + action := api.ActionTypeDisableMemberMaintenance + // Get Action defition function := newDisableMemberMaintenanceAction - action := api.ActionTypeDisableMemberMaintenance // Wrap action main function @@ -471,11 +487,12 @@ func init() { // EnableClusterScaling { - // Get Action defition - function := newEnableClusterScalingAction + // Get Action type + // nolint:staticcheck action := api.ActionTypeEnableClusterScaling - // Wrap action main function + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction // Register action registerAction(action, function) @@ -483,9 +500,11 @@ func init() { // EnableMaintenance { + // Get Action type + action := api.ActionTypeEnableMaintenance + // Get Action defition function := newEnableMaintenanceAction - action := api.ActionTypeEnableMaintenance // Wrap action main function @@ -495,9 +514,11 @@ func init() { // EnableMemberMaintenance { + // Get Action type + action := api.ActionTypeEnableMemberMaintenance + // Get Action defition function := newEnableMemberMaintenanceAction - action := api.ActionTypeEnableMemberMaintenance // Wrap action main function @@ -507,9 +528,11 @@ func init() { // EncryptionKeyAdd { + // Get Action type + action := api.ActionTypeEncryptionKeyAdd + // Get Action defition function := newEncryptionKeyAddAction - action := api.ActionTypeEncryptionKeyAdd // Wrap action main function @@ -519,9 +542,11 @@ func init() { // EncryptionKeyPropagated { + // Get Action type + action := api.ActionTypeEncryptionKeyPropagated + // Get Action defition function := newEncryptionKeyPropagatedAction - action := api.ActionTypeEncryptionKeyPropagated // Wrap action main function @@ -531,9 +556,11 @@ func init() { // EncryptionKeyRefresh { + // Get Action type + action := api.ActionTypeEncryptionKeyRefresh + // Get Action defition function := newEncryptionKeyRefreshAction - action := api.ActionTypeEncryptionKeyRefresh // Wrap action main function @@ -543,9 +570,11 @@ func init() { // EncryptionKeyRemove { + // Get Action type + action := api.ActionTypeEncryptionKeyRemove + // Get Action defition function := newEncryptionKeyRemoveAction - action := api.ActionTypeEncryptionKeyRemove // Wrap action main function @@ -555,9 +584,11 @@ func init() { // EncryptionKeyStatusUpdate { + // Get Action type + action := api.ActionTypeEncryptionKeyStatusUpdate + // Get Action defition function := newEncryptionKeyStatusUpdateAction - action := api.ActionTypeEncryptionKeyStatusUpdate // Wrap action main function @@ -567,9 +598,11 @@ func init() { // Idle { + // Get Action type + action := api.ActionTypeIdle + // Get Action defition function := newIdleAction - action := api.ActionTypeIdle // Wrap action main function @@ -579,9 +612,11 @@ func init() { // JWTAdd { + // Get Action type + action := api.ActionTypeJWTAdd + // Get Action defition function := newJWTAddAction - action := api.ActionTypeJWTAdd // Wrap action main function @@ -591,9 +626,11 @@ func init() { // JWTClean { + // Get Action type + action := api.ActionTypeJWTClean + // Get Action defition function := newJWTCleanAction - action := api.ActionTypeJWTClean // Wrap action main function @@ -603,9 +640,11 @@ func init() { // JWTPropagated { + // Get Action type + action := api.ActionTypeJWTPropagated + // Get Action defition function := newJWTPropagatedAction - action := api.ActionTypeJWTPropagated // Wrap action main function @@ -615,9 +654,11 @@ func init() { // JWTRefresh { + // Get Action type + action := api.ActionTypeJWTRefresh + // Get Action defition function := newJWTRefreshAction - action := api.ActionTypeJWTRefresh // Wrap action main function @@ -627,9 +668,11 @@ func init() { // JWTSetActive { + // Get Action type + action := api.ActionTypeJWTSetActive + // Get Action defition function := newJWTSetActiveAction - action := api.ActionTypeJWTSetActive // Wrap action main function @@ -639,9 +682,11 @@ func init() { // JWTStatusUpdate { + // Get Action type + action := api.ActionTypeJWTStatusUpdate + // Get Action defition function := newJWTStatusUpdateAction - action := api.ActionTypeJWTStatusUpdate // Wrap action main function @@ -651,9 +696,11 @@ func init() { // KillMemberPod { + // Get Action type + action := api.ActionTypeKillMemberPod + // Get Action defition function := newKillMemberPodAction - action := api.ActionTypeKillMemberPod // Wrap action main function @@ -663,9 +710,11 @@ func init() { // LicenseSet { + // Get Action type + action := api.ActionTypeLicenseSet + // Get Action defition function := newLicenseSetAction - action := api.ActionTypeLicenseSet // Wrap action main function @@ -675,9 +724,11 @@ func init() { // MarkToRemoveMember { + // Get Action type + action := api.ActionTypeMarkToRemoveMember + // Get Action defition function := newMarkToRemoveMemberAction - action := api.ActionTypeMarkToRemoveMember // Wrap action main function @@ -687,9 +738,11 @@ func init() { // MemberPhaseUpdate { + // Get Action type + action := api.ActionTypeMemberPhaseUpdate + // Get Action defition function := newMemberPhaseUpdateAction - action := api.ActionTypeMemberPhaseUpdate // Wrap action main function @@ -699,11 +752,12 @@ func init() { // MemberRIDUpdate { - // Get Action defition - function := newMemberRIDUpdateAction + // Get Action type + // nolint:staticcheck action := api.ActionTypeMemberRIDUpdate - // Wrap action main function + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction // Register action registerAction(action, function) @@ -711,9 +765,11 @@ func init() { // PVCResize { + // Get Action type + action := api.ActionTypePVCResize + // Get Action defition function := newPVCResizeAction - action := api.ActionTypePVCResize // Wrap action main function @@ -723,9 +779,11 @@ func init() { // PVCResized { + // Get Action type + action := api.ActionTypePVCResized + // Get Action defition function := newPVCResizedAction - action := api.ActionTypePVCResized // Wrap action main function @@ -735,9 +793,11 @@ func init() { // PlaceHolder { + // Get Action type + action := api.ActionTypePlaceHolder + // Get Action defition function := newPlaceHolderAction - action := api.ActionTypePlaceHolder // Wrap action main function @@ -747,9 +807,11 @@ func init() { // RebalancerCheck { + // Get Action type + action := api.ActionTypeRebalancerCheck + // Get Action defition function := newRebalancerCheckAction - action := api.ActionTypeRebalancerCheck // Wrap action main function @@ -759,9 +821,11 @@ func init() { // RebalancerCheckV2 { + // Get Action type + action := api.ActionTypeRebalancerCheckV2 + // Get Action defition function := newRebalancerCheckV2Action - action := api.ActionTypeRebalancerCheckV2 // Wrap action main function @@ -771,9 +835,11 @@ func init() { // RebalancerClean { + // Get Action type + action := api.ActionTypeRebalancerClean + // Get Action defition function := newRebalancerCleanAction - action := api.ActionTypeRebalancerClean // Wrap action main function @@ -783,9 +849,11 @@ func init() { // RebalancerCleanV2 { + // Get Action type + action := api.ActionTypeRebalancerCleanV2 + // Get Action defition function := newRebalancerCleanV2Action - action := api.ActionTypeRebalancerCleanV2 // Wrap action main function @@ -795,9 +863,11 @@ func init() { // RebalancerGenerate { + // Get Action type + action := api.ActionTypeRebalancerGenerate + // Get Action defition function := newRebalancerGenerateAction - action := api.ActionTypeRebalancerGenerate // Wrap action main function @@ -807,9 +877,11 @@ func init() { // RebalancerGenerateV2 { + // Get Action type + action := api.ActionTypeRebalancerGenerateV2 + // Get Action defition function := newRebalancerGenerateV2Action - action := api.ActionTypeRebalancerGenerateV2 // Wrap action main function @@ -819,9 +891,11 @@ func init() { // RebuildOutSyncedShards { + // Get Action type + action := api.ActionTypeRebuildOutSyncedShards + // Get Action defition function := newRebuildOutSyncedShardsAction - action := api.ActionTypeRebuildOutSyncedShards // Wrap action main function @@ -831,9 +905,11 @@ func init() { // RecreateMember { + // Get Action type + action := api.ActionTypeRecreateMember + // Get Action defition function := newRecreateMemberAction - action := api.ActionTypeRecreateMember // Wrap action main function @@ -843,9 +919,11 @@ func init() { // RefreshTLSKeyfileCertificate { + // Get Action type + action := api.ActionTypeRefreshTLSKeyfileCertificate + // Get Action defition function := newRefreshTLSKeyfileCertificateAction - action := api.ActionTypeRefreshTLSKeyfileCertificate // Wrap action main function @@ -855,9 +933,11 @@ func init() { // RemoveMember { + // Get Action type + action := api.ActionTypeRemoveMember + // Get Action defition function := newRemoveMemberAction - action := api.ActionTypeRemoveMember // Wrap action main function @@ -867,9 +947,11 @@ func init() { // RemoveMemberPVC { + // Get Action type + action := api.ActionTypeRemoveMemberPVC + // Get Action defition function := newRemoveMemberPVCAction - action := api.ActionTypeRemoveMemberPVC // Wrap action main function @@ -879,9 +961,11 @@ func init() { // RenewTLSCACertificate { + // Get Action type + action := api.ActionTypeRenewTLSCACertificate + // Get Action defition function := newRenewTLSCACertificateAction - action := api.ActionTypeRenewTLSCACertificate // Wrap action main function @@ -891,9 +975,11 @@ func init() { // RenewTLSCertificate { + // Get Action type + action := api.ActionTypeRenewTLSCertificate + // Get Action defition function := newRenewTLSCertificateAction - action := api.ActionTypeRenewTLSCertificate // Wrap action main function @@ -903,9 +989,11 @@ func init() { // ResignLeadership { + // Get Action type + action := api.ActionTypeResignLeadership + // Get Action defition function := newResignLeadershipAction - action := api.ActionTypeResignLeadership // Wrap action main function @@ -915,9 +1003,11 @@ func init() { // ResourceSync { + // Get Action type + action := api.ActionTypeResourceSync + // Get Action defition function := newResourceSyncAction - action := api.ActionTypeResourceSync // Wrap action main function @@ -927,11 +1017,15 @@ func init() { // RotateMember { - // Get Action defition - function := newRotateMemberAction + // Get Action type action := api.ActionTypeRotateMember + // Get Action defition + function := newRotateMemberAction + // Wrap action main function + + // With StartupFailureGracePeriod function = withActionStartFailureGracePeriod(function, 60*time.Second) // Register action @@ -940,11 +1034,15 @@ func init() { // RotateStartMember { - // Get Action defition - function := newRotateStartMemberAction + // Get Action type action := api.ActionTypeRotateStartMember + // Get Action defition + function := newRotateStartMemberAction + // Wrap action main function + + // With StartupFailureGracePeriod function = withActionStartFailureGracePeriod(function, 60*time.Second) // Register action @@ -953,9 +1051,11 @@ func init() { // RotateStopMember { + // Get Action type + action := api.ActionTypeRotateStopMember + // Get Action defition function := newRotateStopMemberAction - action := api.ActionTypeRotateStopMember // Wrap action main function @@ -965,9 +1065,11 @@ func init() { // RuntimeContainerArgsLogLevelUpdate { + // Get Action type + action := api.ActionTypeRuntimeContainerArgsLogLevelUpdate + // Get Action defition function := newRuntimeContainerArgsLogLevelUpdateAction - action := api.ActionTypeRuntimeContainerArgsLogLevelUpdate // Wrap action main function @@ -977,9 +1079,11 @@ func init() { // RuntimeContainerImageUpdate { + // Get Action type + action := api.ActionTypeRuntimeContainerImageUpdate + // Get Action defition function := newRuntimeContainerImageUpdateAction - action := api.ActionTypeRuntimeContainerImageUpdate // Wrap action main function @@ -989,9 +1093,11 @@ func init() { // RuntimeContainerSyncTolerations { + // Get Action type + action := api.ActionTypeRuntimeContainerSyncTolerations + // Get Action defition function := newRuntimeContainerSyncTolerationsAction - action := api.ActionTypeRuntimeContainerSyncTolerations // Wrap action main function @@ -1001,11 +1107,12 @@ func init() { // SetCondition { - // Get Action defition - function := newSetConditionAction + // Get Action type + // nolint:staticcheck action := api.ActionTypeSetCondition - // Wrap action main function + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction // Register action registerAction(action, function) @@ -1013,9 +1120,11 @@ func init() { // SetConditionV2 { + // Get Action type + action := api.ActionTypeSetConditionV2 + // Get Action defition function := newSetConditionV2Action - action := api.ActionTypeSetConditionV2 // Wrap action main function @@ -1025,9 +1134,11 @@ func init() { // SetCurrentImage { + // Get Action type + action := api.ActionTypeSetCurrentImage + // Get Action defition function := newSetCurrentImageAction - action := api.ActionTypeSetCurrentImage // Wrap action main function @@ -1037,9 +1148,11 @@ func init() { // SetCurrentMemberArch { + // Get Action type + action := api.ActionTypeSetCurrentMemberArch + // Get Action defition function := newSetCurrentMemberArchAction - action := api.ActionTypeSetCurrentMemberArch // Wrap action main function @@ -1049,9 +1162,11 @@ func init() { // SetMaintenanceCondition { + // Get Action type + action := api.ActionTypeSetMaintenanceCondition + // Get Action defition function := newSetMaintenanceConditionAction - action := api.ActionTypeSetMaintenanceCondition // Wrap action main function @@ -1061,11 +1176,12 @@ func init() { // SetMemberCondition { - // Get Action defition - function := newSetMemberConditionAction + // Get Action type + // nolint:staticcheck action := api.ActionTypeSetMemberCondition - // Wrap action main function + // Get Empty (Deprecated) Action Definition + function := newDeprecatedAction // Register action registerAction(action, function) @@ -1073,9 +1189,11 @@ func init() { // SetMemberConditionV2 { + // Get Action type + action := api.ActionTypeSetMemberConditionV2 + // Get Action defition function := newSetMemberConditionV2Action - action := api.ActionTypeSetMemberConditionV2 // Wrap action main function @@ -1085,9 +1203,11 @@ func init() { // SetMemberCurrentImage { + // Get Action type + action := api.ActionTypeSetMemberCurrentImage + // Get Action defition function := newSetMemberCurrentImageAction - action := api.ActionTypeSetMemberCurrentImage // Wrap action main function @@ -1097,11 +1217,15 @@ func init() { // ShutdownMember { - // Get Action defition - function := newShutdownMemberAction + // Get Action type action := api.ActionTypeShutdownMember + // Get Action defition + function := newShutdownMemberAction + // Wrap action main function + + // With StartupFailureGracePeriod function = withActionStartFailureGracePeriod(function, 60*time.Second) // Register action @@ -1110,9 +1234,11 @@ func init() { // TLSKeyStatusUpdate { + // Get Action type + action := api.ActionTypeTLSKeyStatusUpdate + // Get Action defition function := newTLSKeyStatusUpdateAction - action := api.ActionTypeTLSKeyStatusUpdate // Wrap action main function @@ -1122,9 +1248,11 @@ func init() { // TLSPropagated { + // Get Action type + action := api.ActionTypeTLSPropagated + // Get Action defition function := newTLSPropagatedAction - action := api.ActionTypeTLSPropagated // Wrap action main function @@ -1134,9 +1262,11 @@ func init() { // TimezoneSecretSet { + // Get Action type + action := api.ActionTypeTimezoneSecretSet + // Get Action defition function := newTimezoneSecretSetAction - action := api.ActionTypeTimezoneSecretSet // Wrap action main function @@ -1146,9 +1276,11 @@ func init() { // TopologyDisable { + // Get Action type + action := api.ActionTypeTopologyDisable + // Get Action defition function := newTopologyDisableAction - action := api.ActionTypeTopologyDisable // Wrap action main function @@ -1158,9 +1290,11 @@ func init() { // TopologyEnable { + // Get Action type + action := api.ActionTypeTopologyEnable + // Get Action defition function := newTopologyEnableAction - action := api.ActionTypeTopologyEnable // Wrap action main function @@ -1170,9 +1304,11 @@ func init() { // TopologyMemberAssignment { + // Get Action type + action := api.ActionTypeTopologyMemberAssignment + // Get Action defition function := newTopologyMemberAssignmentAction - action := api.ActionTypeTopologyMemberAssignment // Wrap action main function @@ -1182,9 +1318,11 @@ func init() { // TopologyZonesUpdate { + // Get Action type + action := api.ActionTypeTopologyZonesUpdate + // Get Action defition function := newTopologyZonesUpdateAction - action := api.ActionTypeTopologyZonesUpdate // Wrap action main function @@ -1194,9 +1332,11 @@ func init() { // UpToDateUpdate { + // Get Action type + action := api.ActionTypeUpToDateUpdate + // Get Action defition function := newUpToDateUpdateAction - action := api.ActionTypeUpToDateUpdate // Wrap action main function @@ -1206,9 +1346,11 @@ func init() { // UpdateTLSSNI { + // Get Action type + action := api.ActionTypeUpdateTLSSNI + // Get Action defition function := newUpdateTLSSNIAction - action := api.ActionTypeUpdateTLSSNI // Wrap action main function @@ -1218,9 +1360,11 @@ func init() { // UpgradeMember { + // Get Action type + action := api.ActionTypeUpgradeMember + // Get Action defition function := newUpgradeMemberAction - action := api.ActionTypeUpgradeMember // Wrap action main function @@ -1230,9 +1374,11 @@ func init() { // WaitForMemberInSync { + // Get Action type + action := api.ActionTypeWaitForMemberInSync + // Get Action defition function := newWaitForMemberInSyncAction - action := api.ActionTypeWaitForMemberInSync // Wrap action main function @@ -1242,9 +1388,11 @@ func init() { // WaitForMemberReady { + // Get Action type + action := api.ActionTypeWaitForMemberReady + // Get Action defition function := newWaitForMemberReadyAction - action := api.ActionTypeWaitForMemberReady // Wrap action main function @@ -1254,13 +1402,16 @@ func init() { // WaitForMemberUp { + // Get Action type + action := api.ActionTypeWaitForMemberUp + // Get Action defition function := newWaitForMemberUpAction - action := api.ActionTypeWaitForMemberUp // Wrap action main function // Register action registerAction(action, function) } + } diff --git a/pkg/deployment/reconcile/action.register.generated_test.go b/pkg/deployment/reconcile/action.register.generated_test.go index f2c3dc577..efd5fc514 100644 --- a/pkg/deployment/reconcile/action.register.generated_test.go +++ b/pkg/deployment/reconcile/action.register.generated_test.go @@ -161,11 +161,14 @@ func Test_Actions(t *testing.T) { }) t.Run("DisableClusterScaling", func(t *testing.T) { + // nolint:staticcheck ActionsExistence(t, api.ActionTypeDisableClusterScaling) t.Run("Internal", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeDisableClusterScaling.Internal()) }) t.Run("Optional", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeDisableClusterScaling.Optional()) }) }) @@ -191,11 +194,14 @@ func Test_Actions(t *testing.T) { }) t.Run("EnableClusterScaling", func(t *testing.T) { + // nolint:staticcheck ActionsExistence(t, api.ActionTypeEnableClusterScaling) t.Run("Internal", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeEnableClusterScaling.Internal()) }) t.Run("Optional", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeEnableClusterScaling.Optional()) }) }) @@ -381,11 +387,14 @@ func Test_Actions(t *testing.T) { }) t.Run("MemberRIDUpdate", func(t *testing.T) { + // nolint:staticcheck ActionsExistence(t, api.ActionTypeMemberRIDUpdate) t.Run("Internal", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeMemberRIDUpdate.Internal()) }) t.Run("Optional", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeMemberRIDUpdate.Optional()) }) }) @@ -633,11 +642,14 @@ func Test_Actions(t *testing.T) { }) t.Run("SetCondition", func(t *testing.T) { + // nolint:staticcheck ActionsExistence(t, api.ActionTypeSetCondition) t.Run("Internal", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeSetCondition.Internal()) }) t.Run("Optional", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeSetCondition.Optional()) }) }) @@ -683,11 +695,14 @@ func Test_Actions(t *testing.T) { }) t.Run("SetMemberCondition", func(t *testing.T) { + // nolint:staticcheck ActionsExistence(t, api.ActionTypeSetMemberCondition) t.Run("Internal", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeSetMemberCondition.Internal()) }) t.Run("Optional", func(t *testing.T) { + // nolint:staticcheck require.False(t, api.ActionTypeSetMemberCondition.Optional()) }) }) diff --git a/pkg/deployment/reconcile/action_disable_scaling_cluster.go b/pkg/deployment/reconcile/action_disable_scaling_cluster.go deleted file mode 100644 index 13ecc8a69..000000000 --- a/pkg/deployment/reconcile/action_disable_scaling_cluster.go +++ /dev/null @@ -1,55 +0,0 @@ -// -// DISCLAIMER -// -// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright holder is ArangoDB GmbH, Cologne, Germany -// - -package reconcile - -import ( - "context" - - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" - "github.com/arangodb/kube-arangodb/pkg/util" -) - -// newDisableClusterScalingAction creates the new action with disabling scaling DBservers and coordinators. -func newDisableClusterScalingAction(action api.Action, actionCtx ActionContext) Action { - a := &actionDisableClusterScaling{} - - a.actionImpl = newActionImpl(action, actionCtx, util.NewType[string]("")) - - return a -} - -// actionDisableClusterScaling implements disabling scaling DBservers and coordinators. -type actionDisableClusterScaling struct { - // actionImpl implement timeout and member id functions - actionImpl - - // actionEmptyCheckProgress implement check progress with empty implementation - actionEmptyCheckProgress -} - -// Start disables scaling DBservers and coordinators -func (a *actionDisableClusterScaling) Start(ctx context.Context) (bool, error) { - err := a.actionCtx.DisableScalingCluster(ctx) - if err != nil { - return false, err - } - return true, nil -} diff --git a/pkg/deployment/reconcile/action_enable_scaling_cluster.go b/pkg/deployment/reconcile/action_enable_scaling_cluster.go deleted file mode 100644 index 9363959cc..000000000 --- a/pkg/deployment/reconcile/action_enable_scaling_cluster.go +++ /dev/null @@ -1,55 +0,0 @@ -// -// DISCLAIMER -// -// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright holder is ArangoDB GmbH, Cologne, Germany -// - -package reconcile - -import ( - "context" - - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" - "github.com/arangodb/kube-arangodb/pkg/util" -) - -// newEnableClusterScalingAction creates the new action with enabling scaling DBservers and coordinators. -func newEnableClusterScalingAction(action api.Action, actionCtx ActionContext) Action { - a := &actionEnableClusterScaling{} - - a.actionImpl = newActionImpl(action, actionCtx, util.NewType[string]("")) - - return a -} - -// actionEnableClusterScaling implements enabling scaling DBservers and coordinators. -type actionEnableClusterScaling struct { - // actionImpl implement timeout and member id functions - actionImpl - - // actionEmptyCheckProgress implement check progress with empty implementation - actionEmptyCheckProgress -} - -// Start enables scaling DBservers and coordinators -func (a *actionEnableClusterScaling) Start(ctx context.Context) (bool, error) { - err := a.actionCtx.EnableScalingCluster(ctx) - if err != nil { - return false, err - } - return true, nil -} diff --git a/pkg/deployment/reconcile/action_helper.go b/pkg/deployment/reconcile/action_helper.go index 0b47a40e9..90d9db85a 100644 --- a/pkg/deployment/reconcile/action_helper.go +++ b/pkg/deployment/reconcile/action_helper.go @@ -1,7 +1,7 @@ // // DISCLAIMER // -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany +// Copyright 2016-2023 ArangoDB GmbH, Cologne, Germany // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import ( api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" "github.com/arangodb/kube-arangodb/pkg/logging" + "github.com/arangodb/kube-arangodb/pkg/util/assertion" ) var ( @@ -123,3 +124,25 @@ func (a actionImpl) wrap(in *zerolog.Event) *zerolog.Event { func (a actionImpl) MemberID() string { return *a.memberIDRef } + +func newDeprecatedAction(action api.Action, actionCtx ActionContext) Action { + a := actionDeprecated{} + + a.actionImpl = newActionImplDefRef(action, actionCtx) + + return a +} + +type actionDeprecated struct { + actionImpl + + actionEmptyCheckProgress +} + +func (a actionDeprecated) Start(ctx context.Context) (bool, error) { + a.log.Warn("Deprecated Action call") + + assertion.Assert(true, assertion.DeprecatedActionKey, "Action %s is deprecated", a.action.Type.String()) + + return true, nil +} diff --git a/pkg/deployment/reconcile/action_member_rid_update.go b/pkg/deployment/reconcile/action_member_rid_update.go deleted file mode 100644 index eff4a9c4d..000000000 --- a/pkg/deployment/reconcile/action_member_rid_update.go +++ /dev/null @@ -1,37 +0,0 @@ -// -// DISCLAIMER -// -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright holder is ArangoDB GmbH, Cologne, Germany -// - -package reconcile - -import ( - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" -) - -func newMemberRIDUpdateAction(action api.Action, actionCtx ActionContext) Action { - a := &actionMemberRIDUpdate{} - - a.actionImpl = newActionImplDefRef(action, actionCtx) - - return a -} - -type actionMemberRIDUpdate struct { - actionEmpty -} diff --git a/pkg/deployment/reconcile/action_set_condition.go b/pkg/deployment/reconcile/action_set_condition.go deleted file mode 100644 index 089ac973d..000000000 --- a/pkg/deployment/reconcile/action_set_condition.go +++ /dev/null @@ -1,82 +0,0 @@ -// -// DISCLAIMER -// -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright holder is ArangoDB GmbH, Cologne, Germany -// - -package reconcile - -import ( - "context" - "strconv" - - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" -) - -func newSetConditionAction(action api.Action, actionCtx ActionContext) Action { - a := &actionSetCondition{} - - a.actionImpl = newActionImplDefRef(action, actionCtx) - - return a -} - -type actionSetCondition struct { - // actionImpl implement timeout and member id functions - actionImpl - - actionEmptyCheckProgress -} - -// Start starts the action for changing conditions on the provided member. -func (a actionSetCondition) Start(ctx context.Context) (bool, error) { - if len(a.action.Params) == 0 { - a.log.Info("can not start the action with the empty list of conditions") - return true, nil - } - - if err := a.actionCtx.WithStatusUpdate(ctx, func(s *api.DeploymentStatus) bool { - changed := false - for condition, value := range a.action.Params { - if value == "" { - a.log.Debug("remove the condition") - - if s.Conditions.Remove(api.ConditionType(condition)) { - changed = true - } - } else { - set, err := strconv.ParseBool(value) - if err != nil { - a.log.Err(err).Str("value", value).Error("can not parse string to boolean") - continue - } - - a.log.Debug("set the condition") - - if s.Conditions.Update(api.ConditionType(condition), set, a.action.Reason, "action set the member condition") { - changed = true - } - } - } - return changed - }); err != nil { - a.log.Err(err).Warn("Unable to set condition") - return true, nil - } - - return true, nil -} diff --git a/pkg/deployment/reconcile/action_set_member_condition.go b/pkg/deployment/reconcile/action_set_member_condition.go deleted file mode 100644 index 5e2f7df3c..000000000 --- a/pkg/deployment/reconcile/action_set_member_condition.go +++ /dev/null @@ -1,82 +0,0 @@ -// -// DISCLAIMER -// -// Copyright 2016-2022 ArangoDB GmbH, Cologne, Germany -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright holder is ArangoDB GmbH, Cologne, Germany -// - -package reconcile - -import ( - "context" - "strconv" - - api "github.com/arangodb/kube-arangodb/pkg/apis/deployment/v1" - "github.com/arangodb/kube-arangodb/pkg/util/errors" -) - -func newSetMemberConditionAction(action api.Action, actionCtx ActionContext) Action { - a := &actionSetMemberCondition{} - - a.actionImpl = newActionImplDefRef(action, actionCtx) - - return a -} - -type actionSetMemberCondition struct { - // actionImpl implement timeout and member id functions - actionImpl - - actionEmptyCheckProgress -} - -// Start starts the action for changing conditions on the provided member. -func (a actionSetMemberCondition) Start(ctx context.Context) (bool, error) { - m, ok := a.actionCtx.GetMemberStatusByID(a.action.MemberID) - if !ok { - a.log.Info("can not set the condition because the member is gone already") - return true, nil - } - - if len(a.action.Params) == 0 { - a.log.Info("can not start the action with the empty list of conditions") - return true, nil - } - - for condition, value := range a.action.Params { - if value == "" { - a.log.Debug("remove the condition") - - m.Conditions.Remove(api.ConditionType(condition)) - } else { - set, err := strconv.ParseBool(value) - if err != nil { - a.log.Err(err).Str("value", value).Error("can not parse string to boolean") - continue - } - - a.log.Debug("set the condition") - - m.Conditions.Update(api.ConditionType(condition), set, a.action.Reason, "action set the member condition") - } - } - - if err := a.actionCtx.UpdateMember(ctx, m); err != nil { - return false, errors.Wrap(errors.WithStack(err), "can not update the member") - } - - return true, nil -} diff --git a/pkg/deployment/reconcile/plan_builder_high.go b/pkg/deployment/reconcile/plan_builder_high.go index df444a27f..b6720bd93 100644 --- a/pkg/deployment/reconcile/plan_builder_high.go +++ b/pkg/deployment/reconcile/plan_builder_high.go @@ -123,15 +123,18 @@ func (r *Reconciler) updateMemberPhasePlan(ctx context.Context, apiObject k8suti } func pendingRestartMemberConditionAction(group api.ServerGroup, memberID string, reason string) api.Action { - return actions.NewAction(api.ActionTypeSetMemberCondition, group, shared.WithPredefinedMember(memberID), reason).AddParam(api.ConditionTypePendingRestart.String(), "T") + return shared.UpdateMemberConditionActionV2(reason, api.ConditionTypePendingRestart, group, memberID, true, reason, "", "") } -func restartMemberConditionAction(group api.ServerGroup, memberID string, reason string) api.Action { - return pendingRestartMemberConditionAction(group, memberID, reason).AddParam(api.ConditionTypeRestart.String(), "T") +func restartMemberConditionAction(group api.ServerGroup, memberID string, reason string) api.Plan { + return api.Plan{ + pendingRestartMemberConditionAction(group, memberID, reason), + shared.UpdateMemberConditionActionV2(reason, api.ConditionTypeRestart, group, memberID, true, reason, "", ""), + } } func tlsRotateConditionAction(group api.ServerGroup, memberID string, reason string) api.Action { - return actions.NewAction(api.ActionTypeSetMemberCondition, group, shared.WithPredefinedMember(memberID), reason).AddParam(api.ConditionTypePendingTLSRotation.String(), "T") + return shared.UpdateMemberConditionActionV2(reason, api.ConditionTypePendingTLSRotation, group, memberID, true, reason, "", "") } func (r *Reconciler) updateMemberUpdateConditionsPlan(ctx context.Context, apiObject k8sutil.APIObject, @@ -144,13 +147,11 @@ func (r *Reconciler) updateMemberUpdateConditionsPlan(ctx context.Context, apiOb // We are in updating phase if status.Plan.IsEmpty() { // If plan is empty then something went wrong - plan = append(plan, - actions.NewAction(api.ActionTypeSetMemberCondition, e.Group, e.Member, "Clean update actions after failure"). - AddParam(api.ConditionTypePendingUpdate.String(), ""). - AddParam(api.ConditionTypeUpdating.String(), ""). - AddParam(api.ConditionTypeUpdateFailed.String(), "T"). - AddParam(api.ConditionTypePendingRestart.String(), "T"), - ) + plan = append(plan, shared.RemoveMemberConditionActionV2("Clean update actions after failure", api.ConditionTypePendingUpdate, e.Group, e.Member.ID), + shared.RemoveMemberConditionActionV2("Clean update actions after failure", api.ConditionTypeUpdating, e.Group, e.Member.ID), + shared.UpdateMemberConditionActionV2("Clean update actions after failure", api.ConditionTypeUpdateFailed, e.Group, e.Member.ID, true, "Clean update actions after failure", "", ""), + shared.UpdateMemberConditionActionV2("Clean update actions after failure", api.ConditionTypePendingRestart, e.Group, e.Member.ID, true, "Clean update actions after failure", "", "")) + } } } @@ -207,7 +208,7 @@ func (r *Reconciler) updateMemberRotationConditions(apiObject k8sutil.APIObject, r.log.Bool("enforced", true).Info("Unknown reason") } // We need to do enforced rotation - return api.Plan{restartMemberConditionAction(group, member.ID, reason)}, nil + return restartMemberConditionAction(group, member.ID, reason), nil case rotation.InPlaceRotation: if member.Conditions.IsTrue(api.ConditionTypeUpdateFailed) { if !(member.Conditions.IsTrue(api.ConditionTypePendingRestart) || member.Conditions.IsTrue(api.ConditionTypeRestart)) { @@ -217,7 +218,7 @@ func (r *Reconciler) updateMemberRotationConditions(apiObject k8sutil.APIObject, } else if member.Conditions.IsTrue(api.ConditionTypeUpdating) || member.Conditions.IsTrue(api.ConditionTypePendingUpdate) { return nil, nil } - return api.Plan{actions.NewAction(api.ActionTypeSetMemberCondition, group, member, reason).AddParam(api.ConditionTypePendingUpdate.String(), "T")}, nil + return api.Plan{shared.UpdateMemberConditionActionV2(reason, api.ConditionTypePendingUpdate, group, member.ID, true, reason, "", "")}, nil case rotation.SilentRotation: // Propagate changes without restart, but apply plan if required plan = append(plan, actions.NewAction(api.ActionTypeArangoMemberUpdatePodStatus, group, member, "Propagating status of pod").AddParam(ActionTypeArangoMemberUpdatePodStatusChecksum, checksum)) @@ -234,7 +235,7 @@ func (r *Reconciler) updateMemberRotationConditions(apiObject k8sutil.APIObject, } if spec.MemberPropagationMode.Get() == api.DeploymentMemberPropagationModeAlways { - return api.Plan{restartMemberConditionAction(group, member.ID, reason)}, nil + return restartMemberConditionAction(group, member.ID, reason), nil } else { return api.Plan{pendingRestartMemberConditionAction(group, member.ID, reason)}, nil } diff --git a/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go b/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go index 3f3d50da2..e1dc75411 100644 --- a/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go +++ b/pkg/deployment/reconcile/plan_builder_rotate_upgrade.go @@ -203,9 +203,10 @@ func (r *Reconciler) createUpdatePlanInternal(apiObject k8sutil.APIObject, spec if svc, ok := cache.Service().V1().GetSimple(arangoMember.GetName()); ok { if k8sutil.IsServiceRotationRequired(spec, svc) { - return api.Plan{actions.NewAction(api.ActionTypeSetMemberCondition, m.Group, m.Member, "Cleaning update"). - AddParam(api.ConditionTypePendingUpdate.String(), ""). - AddParam(api.ConditionTypeUpdating.String(), "T")}, false + return api.Plan{ + shared.RemoveMemberConditionActionV2("Cleaning update", api.ConditionTypePendingUpdate, m.Group, m.Member.ID), + shared.UpdateMemberConditionActionV2("Cleaning update", api.ConditionTypeUpdating, m.Group, m.Member.ID, true, "Cleaning update", "", ""), + }, false } } @@ -213,18 +214,20 @@ func (r *Reconciler) createUpdatePlanInternal(apiObject k8sutil.APIObject, spec r.planLogger.Err(err).Str("member", m.Member.ID).Error("Error while generating update plan") continue } else if mode != rotation.InPlaceRotation { - return api.Plan{actions.NewAction(api.ActionTypeSetMemberCondition, m.Group, m.Member, "Cleaning update"). - AddParam(api.ConditionTypePendingUpdate.String(), ""). - AddParam(api.ConditionTypeUpdating.String(), "T")}, false + return api.Plan{ + shared.RemoveMemberConditionActionV2(reason, api.ConditionTypePendingUpdate, m.Group, m.Member.ID), + shared.UpdateMemberConditionActionV2(reason, api.ConditionTypeUpdating, m.Group, m.Member.ID, true, reason, "", ""), + }, false } else { p = withWaitForMember(p, m.Group, m.Member) p = append(p, actions.NewAction(api.ActionTypeArangoMemberUpdatePodStatus, m.Group, m.Member, "Propagating status of pod").AddParam(ActionTypeArangoMemberUpdatePodStatusChecksum, checksum)) - - p = p.Wrap(actions.NewAction(api.ActionTypeSetMemberCondition, m.Group, m.Member, reason). - AddParam(api.ConditionTypePendingUpdate.String(), "").AddParam(api.ConditionTypeUpdating.String(), "T"), - actions.NewAction(api.ActionTypeSetMemberCondition, m.Group, m.Member, reason). - AddParam(api.ConditionTypeUpdating.String(), "")) + p.WrapWithPlan(api.Plan{ + shared.RemoveMemberConditionActionV2(reason, api.ConditionTypePendingUpdate, m.Group, m.Member.ID), + shared.UpdateMemberConditionActionV2(reason, api.ConditionTypeUpdating, m.Group, m.Member.ID, true, reason, "", ""), + }, api.Plan{ + shared.RemoveMemberConditionActionV2(reason, api.ConditionTypeUpdating, m.Group, m.Member.ID), + }) return p, false } diff --git a/pkg/util/assertion/assert.go b/pkg/util/assertion/assert.go index df41b2780..1d9aec279 100644 --- a/pkg/util/assertion/assert.go +++ b/pkg/util/assertion/assert.go @@ -27,7 +27,8 @@ import ( type Key string const ( - KeyUnknown Key = "" + KeyUnknown Key = "" + DeprecatedActionKey Key = "DeprecatedAction" ) func (k Key) Assert(condition bool, msg string, args ...interface{}) {