Skip to content

Commit

Permalink
KIM Integration - using imported constants (#1094)
Browse files Browse the repository at this point in the history
using imported constants
  • Loading branch information
jaroslaw-pieszka authored Sep 9, 2024
1 parent 62771a7 commit 34ead58
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
4 changes: 2 additions & 2 deletions internal/process/provisioning/create_runtime_resource_step.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@ func (s *CreateRuntimeResourceStep) createLabelsForRuntime(operation internal.Op
"operator.kyma-project.io/kyma-name": kymaName,
}
if s.kimConfig.ViewOnly && !s.kimConfig.IsDrivenByKimOnly(broker.PlanNamesMapping[operation.ProvisioningParameters.PlanID]) {
labels["kyma-project.io/controlled-by-provisioner"] = "true"
labels[imv1.LabelControlledByProvisioner] = "true"
} else {
labels["kyma-project.io/controlled-by-provisioner"] = "false"
labels[imv1.LabelControlledByProvisioner] = "false"
}
return labels
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,14 @@ func assertSecurityWithNetworkingFilter(t *testing.T, runtime imv1.Runtime, egre
func assertLabelsKIMDriven(t *testing.T, preOperation internal.Operation, runtime imv1.Runtime) {
assertLabels(t, preOperation, runtime)

provisionerDriven, ok := runtime.Labels["kyma-project.io/controlled-by-provisioner"]
provisionerDriven, ok := runtime.Labels[imv1.LabelControlledByProvisioner]
assert.True(t, ok && provisionerDriven == "false")
}

func assertLabelsProvisionerDriven(t *testing.T, preOperation internal.Operation, runtime imv1.Runtime) {
assertLabels(t, preOperation, runtime)

provisionerDriven, ok := runtime.Labels["kyma-project.io/controlled-by-provisioner"]
provisionerDriven, ok := runtime.Labels[imv1.LabelControlledByProvisioner]
assert.True(t, ok && provisionerDriven == "true")
}

Expand Down
4 changes: 1 addition & 3 deletions internal/process/steps/runtime_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
)

const RuntimeResourceStateReady = "Ready"

func NewCheckRuntimeResourceStep(os storage.Operations, k8sClient client.Client, kimConfig broker.KimConfig, runtimeResourceStepTimeout time.Duration) *checkRuntimeResource {
return &checkRuntimeResource{
k8sClient: k8sClient,
Expand Down Expand Up @@ -52,7 +50,7 @@ func (s *checkRuntimeResource) Run(operation internal.Operation, log logrus.Fiel
// check status
state := runtime.Status.State
log.Infof("Runtime resource state: %s", state)
if state != RuntimeResourceStateReady {
if state != imv1.RuntimeStateReady {
if time.Since(operation.UpdatedAt) > s.runtimeResourceStepTimeout {
description := fmt.Sprintf("Waiting for Runtime resource (%s/%s) ready state timeout.", operation.KymaResourceNamespace, operation.RuntimeID)
log.Error(description)
Expand Down

0 comments on commit 34ead58

Please sign in to comment.