diff --git a/pkg/controller/v1alpha1/cluster_types.go b/pkg/controller/v1alpha1/cluster_types.go index d29a548..63efbe8 100644 --- a/pkg/controller/v1alpha1/cluster_types.go +++ b/pkg/controller/v1alpha1/cluster_types.go @@ -125,6 +125,9 @@ type ClusterStatus struct { RegistrationStatus RegistrationStatus `json:"registrationStatus,omitempty"` // IsDeregisterInProgress is the flag to check if the cluster deregister is InProgress IsDeregisterInProgress bool `json:"isDeregisterInProgress,omitempty"` + // NetworkPresent denotes if the networking components (NSM, Spire) are installed on a cluster + //+kubebuilder:default:=false + NetworkPresent bool `json:"networkPresent,omitempty"` // VCPURestriction is the restriction on the cluster disabling the creation of new pods VCPURestriction *VCPURestriction `json:"vCPURestriction,omitempty"` diff --git a/pkg/controller/v1alpha1/sliceconfig_types.go b/pkg/controller/v1alpha1/sliceconfig_types.go index 28e1443..7cb3913 100644 --- a/pkg/controller/v1alpha1/sliceconfig_types.go +++ b/pkg/controller/v1alpha1/sliceconfig_types.go @@ -23,16 +23,29 @@ import ( // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. +// +kubebuilder:validation:Enum:=single-network;multi-network;no-network +type NetworkType string + +const ( + // all workloads would be connected to the slice l3 overlay network + SINGLENET NetworkType = "single-network" + + // workloads would be connected at l7 through network of envoy gateways. + // And the gateways would be connected through slice l3 overlay + MULTINET NetworkType = "multi-network" + + // slice without any connectivity between clusters + NONET NetworkType = "no-network" +) + // SliceConfigSpec defines the desired state of SliceConfig type SliceConfigSpec struct { //+kubebuilder:default:=single-network - //+kubebuilder:validation:Enum:=single-network;multi-network - OverlayNetworkDeploymentMode string `json:"overlayNetworkDeploymentMode,omitempty"` - SliceSubnet string `json:"sliceSubnet,omitempty"` + OverlayNetworkDeploymentMode NetworkType `json:"overlayNetworkDeploymentMode,omitempty"` + SliceSubnet string `json:"sliceSubnet,omitempty"` //+kubebuilder:default:=Application - SliceType string `json:"sliceType,omitempty"` - // +kubebuilder:validation:Required - SliceGatewayProvider WorkerSliceGatewayProvider `json:"sliceGatewayProvider"` + SliceType string `json:"sliceType,omitempty"` + SliceGatewayProvider *WorkerSliceGatewayProvider `json:"sliceGatewayProvider,omitempty"` //+kubebuilder:default:=Local SliceIpamType string `json:"sliceIpamType,omitempty"` Clusters []string `json:"clusters,omitempty"` @@ -44,7 +57,7 @@ type SliceConfigSpec struct { //+kubebuilder:validation:Minimum=2 //+kubebuilder:validation:Maximum=32 //+kubebuilder:default:=16 - MaxClusters int `json:"maxClusters,omitempty"` + MaxClusters int `json:"maxClusters"` //+kubebuilder:validation:Minimum=30 //+kubebuilder:validation:Maximum=90 //+kubebuilder:default:=30 diff --git a/pkg/controller/v1alpha1/zz_generated.deepcopy.go b/pkg/controller/v1alpha1/zz_generated.deepcopy.go index cff3686..0490636 100644 --- a/pkg/controller/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/controller/v1alpha1/zz_generated.deepcopy.go @@ -673,7 +673,11 @@ func (in *SliceConfigList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SliceConfigSpec) DeepCopyInto(out *SliceConfigSpec) { *out = *in - in.SliceGatewayProvider.DeepCopyInto(&out.SliceGatewayProvider) + if in.SliceGatewayProvider != nil { + in, out := &in.SliceGatewayProvider, &out.SliceGatewayProvider + *out = new(WorkerSliceGatewayProvider) + (*in).DeepCopyInto(*out) + } if in.Clusters != nil { in, out := &in.Clusters, &out.Clusters *out = make([]string, len(*in)) diff --git a/pkg/worker/v1alpha1/workersliceconfig_types.go b/pkg/worker/v1alpha1/workersliceconfig_types.go index 7e6c368..6d89ad2 100644 --- a/pkg/worker/v1alpha1/workersliceconfig_types.go +++ b/pkg/worker/v1alpha1/workersliceconfig_types.go @@ -17,6 +17,7 @@ package v1alpha1 import ( + controllerv1alpha1 "github.com/kubeslice/apis/pkg/controller/v1alpha1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -47,13 +48,11 @@ type WorkerSliceConfigSpec struct { QosProfileDetails QOSProfile `json:"qosProfileDetails,omitempty"` NamespaceIsolationProfile NamespaceIsolationProfile `json:"namespaceIsolationProfile,omitempty"` IpamClusterOctet int `json:"ipamClusterOctet,omitempty"` - //+kubebuilder:validation:Required - Octet *int `json:"octet"` - ClusterSubnetCIDR string `json:"clusterSubnetCIDR,omitempty"` - ExternalGatewayConfig ExternalGatewayConfig `json:"externalGatewayConfig,omitempty"` + Octet *int `json:"octet,omitempty"` + ClusterSubnetCIDR string `json:"clusterSubnetCIDR,omitempty"` + ExternalGatewayConfig ExternalGatewayConfig `json:"externalGatewayConfig,omitempty"` //+kubebuilder:default:=single-network - //+kubebuilder:validation:Enum:=single-network;multi-network - OverlayNetworkDeploymentMode string `json:"overlayNetworkDeploymentMode,omitempty"` + OverlayNetworkDeploymentMode controllerv1alpha1.NetworkType `json:"overlayNetworkDeploymentMode,omitempty"` } // WorkerSliceGatewayProvider defines the configuration for slicegateway