github.com/kyma-project/kyma-environment-broker@v0.0.1/internal/process/provisioning/external_eval_step.go (about) 1 package provisioning 2 3 import ( 4 "fmt" 5 "time" 6 7 "github.com/kyma-project/kyma-environment-broker/internal/process" 8 9 "github.com/kyma-project/kyma-environment-broker/internal/broker" 10 "github.com/sirupsen/logrus" 11 12 "github.com/kyma-project/kyma-environment-broker/internal" 13 ) 14 15 type ExternalEvalStep struct { 16 externalEvalCreator *ExternalEvalCreator 17 } 18 19 // ensure the interface is implemented 20 var _ process.Step = (*ExternalEvalStep)(nil) 21 22 func NewExternalEvalStep(externalEvalCreator *ExternalEvalCreator) *ExternalEvalStep { 23 return &ExternalEvalStep{ 24 externalEvalCreator: externalEvalCreator, 25 } 26 } 27 28 func (e ExternalEvalStep) Name() string { 29 return "AVS_Create_External_Eval_Step" 30 } 31 32 func (s *ExternalEvalStep) Run(operation internal.Operation, log logrus.FieldLogger) (internal.Operation, time.Duration, error) { 33 if broker.IsTrialPlan(operation.ProvisioningParameters.PlanID) || broker.IsFreemiumPlan(operation.ProvisioningParameters.PlanID) { 34 log.Debug("skipping AVS external evaluation creation for trial/freemium plan") 35 return operation, 0, nil 36 } 37 38 targetURL := fmt.Sprintf("https://healthz.%s/healthz/ready ", operation.ShootDomain) 39 op, repeat, err := s.externalEvalCreator.createEval(operation, targetURL, log) 40 if err != nil || repeat != 0 { 41 return operation, repeat, err 42 } 43 return op, 0, nil 44 }