diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7a4e37e6d..3b383191d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-07T21:30:27Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: default concurrency: @@ -146,7 +146,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "true" INTEGRATION_TEST_ARGS: --test.run CleanState/|Auth/|DefaultCluster/ RUN_TALEMU_TESTS: "true" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -270,7 +270,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|EtcdBackupAndRestore RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -348,7 +348,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|RollingUpdateParallelism/|ForcedMachineRemoval/|ReplaceControlPlanes/|ConfigPatching/|KubernetesNodeAudit/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -426,7 +426,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|TalosImageGeneration/|ImmediateClusterDestruction/|DefaultCluster/|EncryptedCluster/|SinglenodeCluster/|Auth/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -504,7 +504,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|ClusterTemplate/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -582,7 +582,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test @@ -660,7 +660,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|WorkloadProxy RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-backups-cron.yaml b/.github/workflows/e2e-backups-cron.yaml index dc01ff694..55d86b1ea 100644 --- a/.github/workflows/e2e-backups-cron.yaml +++ b/.github/workflows/e2e-backups-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-backups-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|EtcdBackupAndRestore RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-scaling-cron.yaml b/.github/workflows/e2e-scaling-cron.yaml index b937ed420..d8279e854 100644 --- a/.github/workflows/e2e-scaling-cron.yaml +++ b/.github/workflows/e2e-scaling-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-scaling-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|RollingUpdateParallelism/|ForcedMachineRemoval/|ReplaceControlPlanes/|ConfigPatching/|KubernetesNodeAudit/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-short-cron.yaml b/.github/workflows/e2e-short-cron.yaml index 84cb48c35..0603121b2 100644 --- a/.github/workflows/e2e-short-cron.yaml +++ b/.github/workflows/e2e-short-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-short-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|TalosImageGeneration/|ImmediateClusterDestruction/|DefaultCluster/|EncryptedCluster/|SinglenodeCluster/|Auth/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-templates-cron.yaml b/.github/workflows/e2e-templates-cron.yaml index ccfdc7d87..3a15df1ce 100644 --- a/.github/workflows/e2e-templates-cron.yaml +++ b/.github/workflows/e2e-templates-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-templates-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|ClusterTemplate/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-upgrades-cron.yaml b/.github/workflows/e2e-upgrades-cron.yaml index 759c9ba0e..a3f80cb44 100644 --- a/.github/workflows/e2e-upgrades-cron.yaml +++ b/.github/workflows/e2e-upgrades-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-upgrades-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/ RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/.github/workflows/e2e-workload-proxy-cron.yaml b/.github/workflows/e2e-workload-proxy-cron.yaml index d55749ebf..cbbd08215 100644 --- a/.github/workflows/e2e-workload-proxy-cron.yaml +++ b/.github/workflows/e2e-workload-proxy-cron.yaml @@ -1,6 +1,6 @@ # THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT. # -# Generated on 2024-09-06T00:35:46Z by kres 8be5fa7. +# Generated on 2024-09-30T14:56:12Z by kres 8be5fa7. name: e2e-workload-proxy-cron concurrency: @@ -63,7 +63,7 @@ jobs: INTEGRATION_RUN_E2E_TEST: "false" INTEGRATION_TEST_ARGS: --test.run CleanState/|WorkloadProxy RUN_TALEMU_TESTS: "false" - TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/ + TALEMU_TEST_ARGS: --test.run ImmediateClusterDestruction/|EncryptedCluster/|SinglenodeCluster/|ScaleUpAndDown/|ScaleUpAndDownMachineClassBasedMachineSets/|TalosUpgrades/|KubernetesUpgrades/|MaintenanceDowngrade/|ClusterTemplate/|ScaleUpAndDownAutoProvisionMachineSets/ WITH_DEBUG: "true" run: | sudo -E make run-integration-test diff --git a/client/pkg/infra/controllers/provision.go b/client/pkg/infra/controllers/provision.go index 2cd5d8a91..a59a22d5d 100644 --- a/client/pkg/infra/controllers/provision.go +++ b/client/pkg/infra/controllers/provision.go @@ -6,7 +6,6 @@ package controllers import ( "context" - "slices" "github.com/cosi-project/runtime/pkg/controller" "github.com/cosi-project/runtime/pkg/controller/generic" @@ -15,6 +14,7 @@ import ( "github.com/cosi-project/runtime/pkg/safe" "github.com/cosi-project/runtime/pkg/state" "github.com/siderolabs/gen/optional" + "github.com/siderolabs/gen/xerrors" "go.uber.org/zap" "github.com/siderolabs/omni/client/api/omni/specs" @@ -184,19 +184,9 @@ func (ctrl *ProvisionController[T]) reconcileRunning(ctx context.Context, r cont steps := ctrl.provisioner.ProvisionSteps() - initialStep, ok := res.Metadata().Annotations().Get(currentStepAnnotation) + initialStep, _ := res.Metadata().Annotations().Get(currentStepAnnotation) - var initialStepIndex int - - if ok { - if index := slices.IndexFunc(steps, func(step provision.Step[T]) bool { - return step.Name() == initialStep - }); index != -1 { - initialStepIndex = index - } - } - - for _, step := range steps[initialStepIndex:] { + for _, step := range steps { if initialStep != "" && step.Name() != initialStep { continue } @@ -205,23 +195,35 @@ func (ctrl *ProvisionController[T]) reconcileRunning(ctx context.Context, r cont logger.Info("running provision step", zap.String("step", step.Name())) - res.Metadata().Annotations().Set(currentStepAnnotation, step.Name()) + var requeueError error if err = safe.WriterModify(ctx, r, res.(T), func(st T) error { //nolint:forcetypeassert - return step.Run(ctx, logger, provision.NewContext( + err = step.Run(ctx, logger, provision.NewContext( machineRequest, machineRequestStatus, st, connectionParams, ctrl.imageFactory, )) + + st.Metadata().Annotations().Set(currentStepAnnotation, step.Name()) + + if err != nil { + if !xerrors.TypeIs[*controller.RequeueError](err) { + return err + } + + requeueError = err + } + + return nil }); err != nil { logger.Error("machine provision failed", zap.Error(err), zap.String("step", step.Name())) machineRequestStatus.TypedSpec().Value.Error = err.Error() machineRequestStatus.TypedSpec().Value.Stage = specs.MachineRequestStatusSpec_FAILED - return nil + return nil //nolint:nilerr } if err = safe.WriterModify(ctx, r, machineRequestStatus, func(res *infra.MachineRequestStatus) error { @@ -231,6 +233,10 @@ func (ctrl *ProvisionController[T]) reconcileRunning(ctx context.Context, r cont }); err != nil { return err } + + if requeueError != nil { + return requeueError + } } machineRequestStatus.TypedSpec().Value.Stage = specs.MachineRequestStatusSpec_PROVISIONED diff --git a/client/pkg/infra/provision/context.go b/client/pkg/infra/provision/context.go index 13c7bbd17..6a6321d94 100644 --- a/client/pkg/infra/provision/context.go +++ b/client/pkg/infra/provision/context.go @@ -13,6 +13,7 @@ import ( "github.com/siderolabs/gen/xslices" "github.com/siderolabs/image-factory/pkg/schematic" "go.uber.org/zap" + "gopkg.in/yaml.v3" "github.com/siderolabs/omni/client/api/omni/specs" "github.com/siderolabs/omni/client/pkg/omni/resources/infra" @@ -122,6 +123,11 @@ func (context *Context[T]) SetMachineInfraID(value string) { context.MachineRequestStatus.Metadata().Labels().Set(omni.LabelMachineInfraID, value) } +// UnmarshalProviderData reads provider data string from the machine request into the dest. +func (context *Context[T]) UnmarshalProviderData(dest any) error { + return yaml.Unmarshal([]byte(context.machineRequest.TypedSpec().Value.ProviderData), dest) +} + // GenerateSchematicID generate the final schematic out of the machine request. // This method also calls the image factory and uploads the schematic there. func (context *Context[T]) GenerateSchematicID(ctx context.Context, logger *zap.Logger, opts ...SchematicOption) (string, error) { diff --git a/client/pkg/infra/provision/errors.go b/client/pkg/infra/provision/errors.go index 04fadab08..6174d810f 100644 --- a/client/pkg/infra/provision/errors.go +++ b/client/pkg/infra/provision/errors.go @@ -19,3 +19,8 @@ func NewRetryError(err error, interval time.Duration) error { func NewRetryErrorf(interval time.Duration, format string, args ...any) error { return controller.NewRequeueErrorf(interval, format, args...) } + +// NewRetryInterval should be returned from the provisioner when it should be called after some interval again. +func NewRetryInterval(interval time.Duration) error { + return controller.NewRequeueInterval(interval) +} diff --git a/frontend/src/components/common/Form/ContentWrapper.vue b/frontend/src/components/common/Form/ContentWrapper.vue index 7cb51ef23..8b2d2e3db 100644 --- a/frontend/src/components/common/Form/ContentWrapper.vue +++ b/frontend/src/components/common/Form/ContentWrapper.vue @@ -7,7 +7,7 @@ included in the LICENSE file.