Skip to content

Commit

Permalink
Set KEB dependecies (#1527)
Browse files Browse the repository at this point in the history
* wip

* wip

---------

Co-authored-by: Piotr Miśkiewicz <[email protected]>
  • Loading branch information
ukff and piotrmiskiewicz authored Dec 5, 2024
1 parent 9feb11c commit 045e77e
Show file tree
Hide file tree
Showing 31 changed files with 37 additions and 33 deletions.
2 changes: 2 additions & 0 deletions internal/error/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ const (
ReconcileDependency Component = "reconciler"
InfrastructureManagerDependency Component = "infrastructure-manager"
LifeCycleManagerDependency Component = "lifecycle-manager"
BtpManagerDependency Component = "btp-manager"
AccountPoolDependency Component = "account-pool"
)

func (err LastError) GetReason() Reason {
Expand Down
2 changes: 1 addition & 1 deletion internal/process/deprovisioning/btp_operator_cleanup.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewBTPOperatorCleanupStep(os storage.Operations, k8sClientProvider K8sClien
step := &BTPOperatorCleanupStep{
k8sClientProvider: k8sClientProvider,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.BtpManagerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewCheckGardenerClusterDeletedStep(operations storage.Operations, kcpClient
step := &CheckGardenerClusterDeletedStep{
kcpClient: kcpClient,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewCheckKymaResourceDeletedStep(operations storage.Operations, kcpClient cl
kcpClient: kcpClient,
kymaResourceDeletionTimeout: kymaResourceDeletionTimeout,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.LifeCycleManagerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func NewCheckRuntimeRemovalStep(operations storage.Operations, instances storage
instanceStorage: instances,
timeout: timeout,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.ProvisionerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewCheckRuntimeResourceDeletionStep(operations storage.Operations, kcpClien
kcpClient: kcpClient,
checkRuntimeResourceDeletionStepTimeout: checkRuntimeResourceDeletionStepTimeout,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/deprovisioning/delete_gardener_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func NewDeleteGardenerClusterStep(operations storage.Operations, kcpClient clien
kcpClient: kcpClient,
instances: instances,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.KEBDependency)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewDeleteKymaResourceStep(operations storage.Operations, instances storage.
configProvider: configProvider,
instances: instances,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.LifeCycleManagerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewDeleteRuntimeResourceStep(operations storage.Operations, kcpClient clien
step := &DeleteRuntimeResourceStep{
kcpClient: kcpClient,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/deprovisioning/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewInitStep(operations storage.Operations, instances storage.Instances, ope
operationStorage: operations,
instanceStorage: instances,
}
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operations, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewReleaseSubscriptionStep(os storage.Operations, instanceStorage storage.I
instanceStorage: instanceStorage,
accountProvider: accountProvider,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.AccountPoolDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/deprovisioning/remove_instance_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewRemoveInstanceStep(instanceStorage storage.Instances, operationStorage s
instanceStorage: instanceStorage,
operationStorage: operationStorage,
}
step.operationManager = process.NewOperationManager(operationStorage, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(operationStorage, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/deprovisioning/remove_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewRemoveRuntimeStep(os storage.Operations, is storage.Instances, cli provi
provisionerClient: cli,
provisionerTimeout: provisionerTimeout,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.ProvisionerDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type CreateResourceNamesStep struct {

func NewCreateResourceNamesStep(os storage.Operations) *CreateResourceNamesStep {
step := &CreateResourceNamesStep{}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewCreateRuntimeResourceStep(os storage.Operations, is storage.Instances, k
useSmallerMachineTypes: useSmallerMachines,
oidcDefaultValues: oidcDefaultValues,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/provisioning/generate_runtime_id_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ func NewGenerateRuntimeIDStep(os storage.Operations, is storage.Instances) *Gene
step := &GenerateRuntimeIDStep{
instanceStorage: is,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/provisioning/get_kubeconfig_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewGetKubeconfigStep(os storage.Operations,
provisionerClient: provisionerClient,
kimConfig: kimConfig,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.ProvisionerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/provisioning/initialisation.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func NewInitialisationStep(os storage.Operations, is storage.Instances, b input.
inputBuilder: b,
instanceStorage: is,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func NewInjectBTPOperatorCredentialsStep(os storage.Operations, k8sClientProvide
step := &InjectBTPOperatorCredentialsStep{
k8sClientProvider: k8sClientProvider,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.BtpManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/provisioning/override_kyma_modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (k *OverrideKymaModules) Name() string {

func NewOverrideKymaModules(os storage.Operations) *OverrideKymaModules {
step := &OverrideKymaModules{}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/provisioning/resolve_creds.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewResolveCredentialsStep(os storage.Operations, accountProvider hyperscale
opStorage: os,
accountProvider: accountProvider,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.AccountPoolDependency)
return step
}

Expand Down
4 changes: 3 additions & 1 deletion internal/process/provisioning/start_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package provisioning
import (
"time"

kebError "github.com/kyma-project/kyma-environment-broker/internal/error"

"github.com/kyma-project/kyma-environment-broker/common/orchestration"
"github.com/kyma-project/kyma-environment-broker/internal/process"
"github.com/kyma-project/kyma-environment-broker/internal/storage"
Expand All @@ -25,7 +27,7 @@ func NewStartStep(os storage.Operations, is storage.Instances) *StartStep {
operationStorage: os,
instanceStorage: is,
}
step.operationManager = process.NewOperationManager(os, step.Name(), orchestration.Pending)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
4 changes: 2 additions & 2 deletions internal/process/staged_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func (m *StagedManager) Execute(operationID string) (time.Duration, error) {
logOperation := m.log.WithFields(logrus.Fields{"operation": operationID, "instanceID": operation.InstanceID, "planID": operation.ProvisioningParameters.PlanID})
logOperation.Infof("Start process operation steps for GlobalAccount=%s, ", operation.ProvisioningParameters.ErsContext.GlobalAccountID)
if time.Since(operation.CreatedAt) > m.operationTimeout {
timeoutErr := kebError.TimeoutError("operation has reached the time limit", kebError.NotSet)
timeoutErr := kebError.TimeoutError("operation has reached the time limit", string(kebError.KEBDependency))
operation.LastError = timeoutErr
defer m.publishEventOnFail(operation, err)
logOperation.Infof("operation has reached the time limit: operation was created at: %s", operation.CreatedAt)
Expand Down Expand Up @@ -219,7 +219,7 @@ func (m *StagedManager) runStep(step Step, operation internal.Operation, logger
if pErr := recover(); pErr != nil {
logger.Println("panic in RunStep in staged manager: ", pErr)
err = errors.New(fmt.Sprintf("%v", pErr))
om := NewOperationManager(m.operationStorage, step.Name(), kebError.NotSet)
om := NewOperationManager(m.operationStorage, step.Name(), kebError.KEBDependency)
processedOperation, _, _ = om.OperationFailed(operation, "recovered from panic", err, m.log)
}
}()
Expand Down
4 changes: 2 additions & 2 deletions internal/process/steps/gardener_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func NewSyncGardenerCluster(os storage.Operations, k8sClient client.Client, kimC
k8sClient: k8sClient,
kimConfig: kimConfig,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand All @@ -38,7 +38,7 @@ func NewCheckGardenerCluster(os storage.Operations, k8sClient client.Client, kim
kimConfig: kimConfig,
gardenerClusterStepTimeout: gardenerClusterStepTimeout,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/steps/kyma_template.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var _ process.Step = &InitKymaTemplate{}

func NewInitKymaTemplate(os storage.Operations) *InitKymaTemplate {
step := &InitKymaTemplate{}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
4 changes: 2 additions & 2 deletions internal/process/steps/lifecycle_manager_kubeconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ type deleteKubeconfig struct {

func SyncKubeconfig(os storage.Operations, k8sClient client.Client) syncKubeconfig {
step := syncKubeconfig{k8sClient: k8sClient}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

func DeleteKubeconfig(os storage.Operations, k8sClient client.Client) deleteKubeconfig {
step := deleteKubeconfig{k8sClient: k8sClient}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/steps/runtime_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ func NewCheckRuntimeResourceStep(os storage.Operations, k8sClient client.Client,
kimConfig: kimConfig,
runtimeResourceStepTimeout: runtimeResourceStepTimeout,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/update/check_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewCheckStep(os storage.Operations,
provisionerClient: provisionerClient,
provisioningTimeout: provisioningTimeout,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.ProvisionerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/update/initialisation_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewInitialisationStep(is storage.Instances, os storage.Operations, b input.
instanceStorage: is,
inputBuilder: b,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.KEBDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/update/update_runtime_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func NewUpdateRuntimeStep(os storage.Operations, k8sClient client.Client, delay
k8sClient: k8sClient,
delay: delay,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.InfrastructureManagerDependency)
return step
}

Expand Down
2 changes: 1 addition & 1 deletion internal/process/update/upgrade_shoot_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func NewUpgradeShootStep(
runtimeStateStorage: runtimeStorage,
k8sClient: k8sClient,
}
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.NotSet)
step.operationManager = process.NewOperationManager(os, step.Name(), kebError.ProvisionerDependency)
return step
}

Expand Down

0 comments on commit 045e77e

Please sign in to comment.