Skip to content

Commit

Permalink
added slicegatewayServiceType field
Browse files Browse the repository at this point in the history
Signed-off-by: Mridul <[email protected]>
  • Loading branch information
mridulgain committed Sep 19, 2023
1 parent 8a0ab6f commit 90f4962
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apis/controller/v1alpha1/sliceconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions apis/worker/v1alpha1/workersliceconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 13 additions & 1 deletion service/worker_slice_config_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit 90f4962

Please sign in to comment.