From 64ce526f78022c4d619f7d6e9501bed24da0a02f Mon Sep 17 00:00:00 2001 From: Arkadiusz Galwas Date: Fri, 17 May 2024 07:46:25 +0200 Subject: [PATCH] Adjusted to the contact changes --- api/v1/runtime_types.go | 27 +++++++++---------- api/v1/zz_generated.deepcopy.go | 9 ++++--- ...cturemanager.kyma-project.io_runtimes.yaml | 13 ++++----- .../controller/runtime_controller_test.go | 5 +--- internal/gardener/shoot/converter.go | 6 ++--- 5 files changed, 27 insertions(+), 33 deletions(-) diff --git a/api/v1/runtime_types.go b/api/v1/runtime_types.go index 11705822..18c98c60 100644 --- a/api/v1/runtime_types.go +++ b/api/v1/runtime_types.go @@ -19,7 +19,6 @@ package v1 import ( gardener "github.com/gardener/gardener/pkg/apis/core/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" ) //+kubebuilder:object:root=true @@ -64,15 +63,17 @@ type RuntimeStatus struct { } type RuntimeShoot struct { - Name string `json:"name"` - Purpose gardener.ShootPurpose `json:"purpose"` - Region string `json:"region"` - LicenceType *string `json:"licenceType,omitempty"` - SecretBindingName string `json:"secretBindingName"` - Kubernetes Kubernetes `json:"kubernetes"` - Provider Provider `json:"provider"` - Networking Networking `json:"networking"` - ControlPlane gardener.ControlPlane `json:"controlPlane"` + Name string `json:"name"` + Purpose gardener.ShootPurpose `json:"purpose"` + PlatformRegion string `json:"platformRegion"` + Region string `json:"region"` + LicenceType *string `json:"licenceType,omitempty"` + SecretBindingName string `json:"secretBindingName"` + EnforceSeedLocation *bool `json:"enforceSeedLocation,omitempty"` + Kubernetes Kubernetes `json:"kubernetes"` + Provider Provider `json:"provider"` + Networking Networking `json:"networking"` + ControlPlane gardener.ControlPlane `json:"controlPlane"` } type Kubernetes struct { @@ -86,10 +87,8 @@ type APIServer struct { } type Provider struct { - Type string `json:"type"` - ControlPlaneConfig runtime.RawExtension `json:"controlPlaneConfig"` - InfrastructureConfig runtime.RawExtension `json:"infrastructureConfig"` - Workers []gardener.Worker `json:"workers"` + Type string `json:"type"` + Workers []gardener.Worker `json:"workers"` } type Networking struct { diff --git a/api/v1/zz_generated.deepcopy.go b/api/v1/zz_generated.deepcopy.go index 0c19b247..0b5b1255 100644 --- a/api/v1/zz_generated.deepcopy.go +++ b/api/v1/zz_generated.deepcopy.go @@ -24,7 +24,7 @@ package v1 import ( "github.com/gardener/gardener/pkg/apis/core/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/runtime" + runtime "k8s.io/apimachinery/pkg/runtime" ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. @@ -274,8 +274,6 @@ func (in *NetworkingSecurity) DeepCopy() *NetworkingSecurity { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *Provider) DeepCopyInto(out *Provider) { *out = *in - in.ControlPlaneConfig.DeepCopyInto(&out.ControlPlaneConfig) - in.InfrastructureConfig.DeepCopyInto(&out.InfrastructureConfig) if in.Workers != nil { in, out := &in.Workers, &out.Workers *out = make([]v1beta1.Worker, len(*in)) @@ -362,6 +360,11 @@ func (in *RuntimeShoot) DeepCopyInto(out *RuntimeShoot) { *out = new(string) **out = **in } + if in.EnforceSeedLocation != nil { + in, out := &in.EnforceSeedLocation, &out.EnforceSeedLocation + *out = new(bool) + **out = **in + } in.Kubernetes.DeepCopyInto(&out.Kubernetes) in.Provider.DeepCopyInto(&out.Provider) out.Networking = in.Networking diff --git a/config/crd/bases/infrastructuremanager.kyma-project.io_runtimes.yaml b/config/crd/bases/infrastructuremanager.kyma-project.io_runtimes.yaml index 9930b65d..69ed7b82 100644 --- a/config/crd/bases/infrastructuremanager.kyma-project.io_runtimes.yaml +++ b/config/crd/bases/infrastructuremanager.kyma-project.io_runtimes.yaml @@ -103,6 +103,8 @@ spec: - failureTolerance type: object type: object + enforceSeedLocation: + type: boolean kubernetes: properties: kubeAPIServer: @@ -295,14 +297,10 @@ spec: - pods - services type: object + platformRegion: + type: string provider: properties: - controlPlaneConfig: - type: object - x-kubernetes-preserve-unknown-fields: true - infrastructureConfig: - type: object - x-kubernetes-preserve-unknown-fields: true type: type: string workers: @@ -1001,8 +999,6 @@ spec: type: object type: array required: - - controlPlaneConfig - - infrastructureConfig - type - workers type: object @@ -1018,6 +1014,7 @@ spec: - kubernetes - name - networking + - platformRegion - provider - purpose - region diff --git a/internal/controller/runtime_controller_test.go b/internal/controller/runtime_controller_test.go index 826b789b..32a94598 100644 --- a/internal/controller/runtime_controller_test.go +++ b/internal/controller/runtime_controller_test.go @@ -25,7 +25,6 @@ import ( . "github.com/onsi/gomega" //nolint:revive "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - apimachneryruntime "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/types" "sigs.k8s.io/controller-runtime/pkg/reconcile" ) @@ -55,9 +54,7 @@ var _ = Describe("Runtime Controller", func() { Shoot: imv1.RuntimeShoot{ Networking: imv1.Networking{}, Provider: imv1.Provider{ - ControlPlaneConfig: apimachneryruntime.RawExtension{Raw: []byte("{}")}, - InfrastructureConfig: apimachneryruntime.RawExtension{Raw: []byte("{}")}, - Workers: []gardener.Worker{}, + Workers: []gardener.Worker{}, }, }, Security: imv1.Security{ diff --git a/internal/gardener/shoot/converter.go b/internal/gardener/shoot/converter.go index b3911bb3..85ac1d1f 100644 --- a/internal/gardener/shoot/converter.go +++ b/internal/gardener/shoot/converter.go @@ -73,10 +73,8 @@ func getOIDCConfig(oidcConfig gardenerv1beta.OIDCConfig) *gardenerv1beta.OIDCCon func getProvider(runtimeProvider imv1.Provider) gardenerv1beta.Provider { return gardenerv1beta.Provider{ - Type: runtimeProvider.Type, - ControlPlaneConfig: &runtimeProvider.ControlPlaneConfig, - InfrastructureConfig: &runtimeProvider.InfrastructureConfig, - Workers: runtimeProvider.Workers, + Type: runtimeProvider.Type, + Workers: runtimeProvider.Workers, } }