diff --git a/apis/controller/v1alpha1/sliceconfig_types.go b/apis/controller/v1alpha1/sliceconfig_types.go index e6b8e868..12075016 100644 --- a/apis/controller/v1alpha1/sliceconfig_types.go +++ b/apis/controller/v1alpha1/sliceconfig_types.go @@ -74,6 +74,13 @@ type WorkerSliceGatewayProvider struct { //+kubebuilder:default:=Local // +kubebuilder:validation:Required SliceCaType string `json:"sliceCaType"` + + SliceGatewayServiceType []SliceGatewayServiceType `json:"sliceGatewayServiceType,omitempty"` +} + +type SliceGatewayServiceType struct { + Cluster string `json:"cluster,omitempty"` + Type string `json:"type,omitempty"` } // QOSProfile is the QOS Profile configuration from backend diff --git a/apis/worker/v1alpha1/workersliceconfig_types.go b/apis/worker/v1alpha1/workersliceconfig_types.go index 5a99981c..531211ff 100644 --- a/apis/worker/v1alpha1/workersliceconfig_types.go +++ b/apis/worker/v1alpha1/workersliceconfig_types.go @@ -59,6 +59,8 @@ type WorkerSliceGatewayProvider struct { SliceGatewayType string `json:"sliceGatewayType,omitempty"` //+kubebuilder:default:=Local SliceCaType string `json:"sliceCaType,omitempty"` + //+kubebuilder:validation:Enum:=NodePort;LoadBalancer + SliceGatewayServiceType string `json:"sliceGatewayServiceType,omitempty"` } // QOSProfile is the QOS Profile configuration from backend diff --git a/service/worker_slice_config_service.go b/service/worker_slice_config_service.go index 19f30890..d8f1e990 100644 --- a/service/worker_slice_config_service.go +++ b/service/worker_slice_config_service.go @@ -19,9 +19,10 @@ package service import ( "context" "fmt" - "github.com/kubeslice/kubeslice-controller/metrics" "time" + "github.com/kubeslice/kubeslice-controller/metrics" + "github.com/kubeslice/kubeslice-controller/events" "go.uber.org/zap" @@ -211,6 +212,17 @@ outer: logger.With(zap.Error(err)).Errorf("Failed to deep copy external gateway configuration") } + // Reconcile Slice gateway service type + sliceGatewayProvider := workerv1alpha1.WorkerSliceGatewayProvider{ + SliceGatewayType: sliceConfig.Spec.SliceGatewayProvider.SliceGatewayType, + SliceCaType: sliceConfig.Spec.SliceGatewayProvider.SliceCaType, + } + for _, gwSvcType := range sliceConfig.Spec.SliceGatewayProvider.SliceGatewayServiceType { + if gwSvcType.Cluster == "*" || gwSvcType.Cluster == workerSliceConfig.Labels["worker-cluster"] { + sliceGatewayProvider.SliceGatewayServiceType = gwSvcType.Type + } + } + // Reconcile the Namespace Isolation Profile controllerIsolationProfile := sliceConfig.Spec.NamespaceIsolationProfile workerIsolationProfile := workerv1alpha1.NamespaceIsolationProfile{