github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/provisioning/btp_operator_overrides.go (about) 1 package provisioning 2 3 import ( 4 "time" 5 6 "github.com/google/uuid" 7 "github.com/kyma-project/kyma-environment-broker/internal" 8 "github.com/kyma-project/kyma-environment-broker/internal/process" 9 "github.com/kyma-project/kyma-environment-broker/internal/storage" 10 "github.com/sirupsen/logrus" 11 ) 12 13 type BTPOperatorOverridesStep struct { 14 operationManager *process.OperationManager 15 } 16 17 func NewBTPOperatorOverridesStep(os storage.Operations) *BTPOperatorOverridesStep { 18 return &BTPOperatorOverridesStep{ 19 operationManager: process.NewOperationManager(os), 20 } 21 } 22 23 func (s *BTPOperatorOverridesStep) Name() string { 24 return "BTPOperatorOverrides" 25 } 26 27 func (s *BTPOperatorOverridesStep) Run(operation internal.Operation, log logrus.FieldLogger) (internal.Operation, time.Duration, error) { 28 clusterID := uuid.NewString() 29 f := func(op *internal.Operation) { 30 op.InstanceDetails.ServiceManagerClusterID = clusterID 31 } 32 if !operation.InputCreator.Configuration().ContainsAdditionalComponent(internal.BTPOperatorComponentName) { 33 log.Infof("BTP operator is not in the list of additional components, skipping preparing overrides") 34 return operation, 0, nil 35 } 36 overrides := internal.GetBTPOperatorProvisioningOverrides(operation.ProvisioningParameters.ErsContext.SMOperatorCredentials, clusterID) 37 operation.InputCreator.AppendOverrides(internal.BTPOperatorComponentName, overrides) 38 operation.InputCreator.EnableOptionalComponent(internal.BTPOperatorComponentName) 39 return s.operationManager.UpdateOperation(operation, f, log) 40 }