From e46df1db619194642cf2eb1012d7c0831ab6e783 Mon Sep 17 00:00:00 2001 From: Vishal Thapar <5137689+vthapar@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:31:45 +0530 Subject: [PATCH] Update CRDs for ClustersetIP fields Add fields to CRDs to support ClustersetIPs Refer: https://github.com/submariner-io/enhancements/pull/230 Signed-off-by: Vishal Thapar <5137689+vthapar@users.noreply.github.com> --- api/v1alpha1/broker_types.go | 13 ++++++++ api/v1alpha1/servicediscovery_types.go | 32 +++++++++++-------- api/v1alpha1/submariner_types.go | 18 +++++++++++ config/crd/bases/submariner.io_brokers.yaml | 7 ++++ .../submariner.io_servicediscoveries.yaml | 4 +++ .../crd/bases/submariner.io_submariners.yaml | 11 +++++++ pkg/embeddedyamls/yamls.go | 22 +++++++++++++ 7 files changed, 93 insertions(+), 14 deletions(-) diff --git a/api/v1alpha1/broker_types.go b/api/v1alpha1/broker_types.go index f1108ec6a..3b2eaf14f 100644 --- a/api/v1alpha1/broker_types.go +++ b/api/v1alpha1/broker_types.go @@ -47,6 +47,13 @@ type BrokerSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:fieldDependency:globalnetEnabled:true","urn:alm:descriptor:com.tectonic.ui:advanced"} GlobalnetCIDRRange string `json:"globalnetCIDRRange,omitempty"` + // ClustersetIP supernet range for allocating ClustersetIPCIDRs to each cluster. + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ClustersetIP CIDR Range" + //nolint:lll // Markers can't be wrapped + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} + // +optional + ClustersetIPCIDRRange string `json:"clustersetIPCIDRRange,omitempty"` + // Default cluster size for GlobalCIDR allocated to each cluster (amount of global IPs). // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Default Globalnet Cluster Size" //nolint:lll // Markers can't be wrapped @@ -57,6 +64,12 @@ type BrokerSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable Globalnet" // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} GlobalnetEnabled bool `json:"globalnetEnabled,omitempty"` + + // Enable ClustersetIP default for connecting clusters. + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable ClustersetIP" + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} + // +optional + ClustersetIPEnabled bool `json:"clustersetIPEnabled,omitempty"` } // BrokerStatus defines the observed state of Broker. diff --git a/api/v1alpha1/servicediscovery_types.go b/api/v1alpha1/servicediscovery_types.go index 31e2deacc..5da05b511 100644 --- a/api/v1alpha1/servicediscovery_types.go +++ b/api/v1alpha1/servicediscovery_types.go @@ -32,20 +32,24 @@ type ServiceDiscoverySpec struct { // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster // Important: Run "make" to regenerate code after modifying this file - BrokerK8sApiServer string `json:"brokerK8sApiServer"` - BrokerK8sApiServerToken string `json:"brokerK8sApiServerToken,omitempty"` - BrokerK8sCA string `json:"brokerK8sCA,omitempty"` - BrokerK8sSecret string `json:"brokerK8sSecret,omitempty"` - BrokerK8sRemoteNamespace string `json:"brokerK8sRemoteNamespace"` - ClusterID string `json:"clusterID"` - Namespace string `json:"namespace"` - Repository string `json:"repository,omitempty"` - Version string `json:"version,omitempty"` - Debug bool `json:"debug"` - GlobalnetEnabled bool `json:"globalnetEnabled,omitempty"` - BrokerK8sInsecure bool `json:"brokerK8sInsecure,omitempty"` - HaltOnCertificateError bool `json:"haltOnCertificateError,omitempty"` - CoreDNSCustomConfig *CoreDNSCustomConfig `json:"coreDNSCustomConfig,omitempty"` + BrokerK8sApiServer string `json:"brokerK8sApiServer"` + BrokerK8sApiServerToken string `json:"brokerK8sApiServerToken,omitempty"` + BrokerK8sCA string `json:"brokerK8sCA,omitempty"` + BrokerK8sSecret string `json:"brokerK8sSecret,omitempty"` + BrokerK8sRemoteNamespace string `json:"brokerK8sRemoteNamespace"` + ClusterID string `json:"clusterID"` + Namespace string `json:"namespace"` + Repository string `json:"repository,omitempty"` + Version string `json:"version,omitempty"` + // +optional + ClustersetIPCIDR string `json:"clustersetIPCIDR,omitempty"` + Debug bool `json:"debug"` + GlobalnetEnabled bool `json:"globalnetEnabled,omitempty"` + BrokerK8sInsecure bool `json:"brokerK8sInsecure,omitempty"` + HaltOnCertificateError bool `json:"haltOnCertificateError,omitempty"` + // +optional + ClustersetIPEnabled bool `json:"clustersetIPEnabled,omitempty"` + CoreDNSCustomConfig *CoreDNSCustomConfig `json:"coreDNSCustomConfig,omitempty"` // +listType=set CustomDomains []string `json:"customDomains,omitempty"` ImageOverrides map[string]string `json:"imageOverrides,omitempty"` diff --git a/api/v1alpha1/submariner_types.go b/api/v1alpha1/submariner_types.go index 32d220093..7dc385e15 100644 --- a/api/v1alpha1/submariner_types.go +++ b/api/v1alpha1/submariner_types.go @@ -104,6 +104,13 @@ type SubmarinerSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} GlobalCIDR string `json:"globalCIDR,omitempty"` + // ClustersetIP CIDR for allocating ClustersetIPs to exported services. + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="ClustersetIP CIDR" + //nolint:lll // Markers can't be wrapped + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text","urn:alm:descriptor:com.tectonic.ui:advanced"} + // +optional + ClustersetIPCIDR string `json:"clustersetIPCIDR,omitempty"` + // The namespace in which to deploy the submariner operator. // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Namespace" // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} @@ -174,6 +181,12 @@ type SubmarinerSpec struct { // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} HaltOnCertificateError bool `json:"haltOnCertificateError,omitempty"` + // Enable ClustersetIP default for services exported on this cluster. + // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Enable ClustersetIP default" + // +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:booleanSwitch"} + // +optional + ClustersetIPEnabled bool `json:"clustersetIPEnabled,omitempty"` + // Name of the custom CoreDNS configmap to configure forwarding to Lighthouse. // It should be in / format where is optional and defaults to kube-system. // +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="CoreDNS Custom Config" @@ -237,6 +250,11 @@ type SubmarinerStatus struct { // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} GlobalCIDR string `json:"globalCIDR,omitempty"` + // The current clustersetIP CIDR. + // +operator-sdk:csv:customresourcedefinitions:type=status,displayName="ClustersetIP CIDR" + // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} + ClustersetIPCIDR string `json:"clustersetIPCIDR,omitempty"` + // The current network plugin. // +operator-sdk:csv:customresourcedefinitions:type=status,displayName="Network Plugin" // +operator-sdk:csv:customresourcedefinitions:type=status,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:text"} diff --git a/config/crd/bases/submariner.io_brokers.yaml b/config/crd/bases/submariner.io_brokers.yaml index 19a45ece5..276940ad2 100644 --- a/config/crd/bases/submariner.io_brokers.yaml +++ b/config/crd/bases/submariner.io_brokers.yaml @@ -34,6 +34,10 @@ spec: spec: description: BrokerSpec defines the desired state of Broker. properties: + clustersetIPCIDRRange: + description: ClustersetIP supernet range for allocating ClustersetIPCIDRs + to each cluster. + type: string components: description: List of the components to be installed - any of [service-discovery, connectivity]. @@ -56,6 +60,9 @@ spec: globalnetEnabled: description: Enable support for Overlapping CIDRs in connecting clusters. type: boolean + clustersetIPEnabled: + description: Enable ClustersetIP default for connecting clusters. + type: boolean type: object status: description: BrokerStatus defines the observed state of Broker. diff --git a/config/crd/bases/submariner.io_servicediscoveries.yaml b/config/crd/bases/submariner.io_servicediscoveries.yaml index dd5e4df53..187e79167 100644 --- a/config/crd/bases/submariner.io_servicediscoveries.yaml +++ b/config/crd/bases/submariner.io_servicediscoveries.yaml @@ -48,6 +48,8 @@ spec: type: string clusterID: type: string + clustersetIPCIDR: + type: string coreDNSCustomConfig: properties: configMapName: @@ -68,6 +70,8 @@ spec: type: boolean haltOnCertificateError: type: boolean + clustersetIPEnabled: + type: boolean imageOverrides: additionalProperties: type: string diff --git a/config/crd/bases/submariner.io_submariners.yaml b/config/crd/bases/submariner.io_submariners.yaml index 2b047c864..89d0ce972 100644 --- a/config/crd/bases/submariner.io_submariners.yaml +++ b/config/crd/bases/submariner.io_submariners.yaml @@ -87,6 +87,10 @@ spec: clusterID: description: The cluster ID used to identify the tunnels. type: string + clustersetIPCIDR: + description: ClustersetIP CIDR for allocating ClustersetIPs to exported + services. + type: string colorCodes: type: string connectionHealthCheck: @@ -160,6 +164,10 @@ spec: serviceDiscoveryEnabled: description: Enable support for Service Discovery (Lighthouse). type: boolean + clustersetIPEnabled: + description: Enable ClustersetIP default for services exported on this + cluster. + type: boolean tolerations: items: description: The pod this Toleration is attached to tolerates any @@ -225,6 +233,9 @@ spec: clusterID: description: The current cluster ID. type: string + clustersetIPCIDR: + description: The current clustersetIP CIDR. + type: string colorCodes: type: string deploymentInfo: diff --git a/pkg/embeddedyamls/yamls.go b/pkg/embeddedyamls/yamls.go index 5aff99c0e..d8c3679dd 100644 --- a/pkg/embeddedyamls/yamls.go +++ b/pkg/embeddedyamls/yamls.go @@ -61,6 +61,13 @@ spec: spec: description: BrokerSpec defines the desired state of Broker. properties: + clustersetIPCIDRRange: + description: ClustersetIP supernet range for allocating ClustersetIPCIDRs + to each cluster. + type: string + clustersetIPEnabled: + description: Enable ClustersetIP default for connecting clusters. + type: boolean components: description: List of the components to be installed - any of [service-discovery, connectivity]. @@ -187,6 +194,14 @@ spec: clusterID: description: The cluster ID used to identify the tunnels. type: string + clustersetIPCIDR: + description: ClustersetIP CIDR for allocating ClustersetIPs to exported + services. + type: string + clustersetIPEnabled: + description: Enable ClustersetIP default for services exported on + this cluster. + type: boolean colorCodes: type: string connectionHealthCheck: @@ -324,6 +339,9 @@ spec: clusterID: description: The current cluster ID. type: string + clustersetIPCIDR: + description: The current clustersetIP CIDR. + type: string colorCodes: type: string deploymentInfo: @@ -1150,6 +1168,10 @@ spec: type: string clusterID: type: string + clustersetIPCIDR: + type: string + clustersetIPEnabled: + type: boolean coreDNSCustomConfig: properties: configMapName: