From f8e14646b403e56fc3ab7657119acd8151cc5f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaros=C5=82aw=20Pieszka?= Date: Mon, 19 Aug 2024 15:18:31 +0200 Subject: [PATCH] KIM Integration - adjustments to current KIM behavior (#1049) rebase --- .../process/provisioning/create_runtime_resource_step.go | 4 ++++ .../provisioning/create_runtime_resource_step_test.go | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/process/provisioning/create_runtime_resource_step.go b/internal/process/provisioning/create_runtime_resource_step.go index 39965c8c16..982796ab34 100644 --- a/internal/process/provisioning/create_runtime_resource_step.go +++ b/internal/process/provisioning/create_runtime_resource_step.go @@ -167,6 +167,8 @@ func (s *CreateRuntimeResourceStep) createLabelsForRuntime(operation internal.Op } if s.kimConfig.ViewOnly && !s.kimConfig.IsDrivenByKimOnly(broker.PlanNamesMapping[operation.ProvisioningParameters.PlanID]) { labels["kyma-project.io/controlled-by-provisioner"] = "true" + } else { + labels["kyma-project.io/controlled-by-provisioner"] = "false" } return labels } @@ -339,6 +341,8 @@ func (s *CreateRuntimeResourceStep) createNetworkingConfiguration(operation inte Pods: DefaultIfParamNotSet(networking.DefaultPodsCIDR, networkingParams.PodsCidr), Services: DefaultIfParamNotSet(networking.DefaultServicesCIDR, networkingParams.ServicesCidr), Nodes: DefaultIfParamZero(networking.DefaultNodesCIDR, networkingParams.NodesCidr), + //TODO remove when KIM is ready with setting this value + Type: ptr.String("calico"), } } diff --git a/internal/process/provisioning/create_runtime_resource_step_test.go b/internal/process/provisioning/create_runtime_resource_step_test.go index 9068f99d85..47c14115a2 100644 --- a/internal/process/provisioning/create_runtime_resource_step_test.go +++ b/internal/process/provisioning/create_runtime_resource_step_test.go @@ -42,11 +42,15 @@ const ( ) var runtimeAdministrators = []string{"admin1@test.com", "admin2@test.com"} + var defaultNetworking = imv1.Networking{ Nodes: networking.DefaultNodesCIDR, Pods: networking.DefaultPodsCIDR, Services: networking.DefaultServicesCIDR, + //TODO: remove after KIM is handling this properly + Type: ptr.String("calico"), } + var defaultOIDSConfig = internal.OIDCConfigDTO{ ClientID: "client-id-default", GroupsClaim: "gc-default", @@ -414,6 +418,8 @@ func TestCreateRuntimeResourceStep_Defaults_AWS_MultiZoneWithNetworking_ActualCr Nodes: "192.168.48.0/20", Pods: "10.104.0.0/24", Services: "10.105.0.0/24", + //TODO remove after KIM is handling this properly + Type: ptr.String("calico"), }, runtime.Spec.Shoot.Networking) _, err = memoryStorage.Instances().GetByID(operation.InstanceID) @@ -728,7 +734,7 @@ func assertLabelsKIMDriven(t *testing.T, preOperation internal.Operation, runtim assertLabels(t, preOperation, runtime) provisionerDriven, ok := runtime.Labels["kyma-project.io/controlled-by-provisioner"] - assert.True(t, !ok || provisionerDriven == "false") + assert.True(t, ok && provisionerDriven == "false") } func assertLabelsProvisionerDriven(t *testing.T, preOperation internal.Operation, runtime imv1.Runtime) {