From 9742f32e2a77342e1c96ded64ee93fcb96e4a8d4 Mon Sep 17 00:00:00 2001 From: Alessandro Olivero Date: Tue, 19 Sep 2023 17:18:53 +0200 Subject: [PATCH] fixup! add external network apis --- .../v1alpha1/configuration_types.go | 11 +++++--- apis/networking/v1alpha1/connection_types.go | 4 +-- .../v1alpha1/firewallconfiguration_types.go | 2 +- .../v1alpha1/gatewayclient_types.go | 2 +- .../v1alpha1/gatewayserver_types.go | 7 +++-- apis/networking/v1alpha1/publickey_types.go | 2 +- .../v1alpha1/wggatewayclient_types.go | 2 +- .../v1alpha1/wggatewayclienttemplate_types.go | 2 +- .../v1alpha1/wggatewayserver_types.go | 2 +- .../v1alpha1/wggatewayservertemplate_types.go | 2 +- .../v1alpha1/zz_generated.deepcopy.go | 18 ++++++++++++- .../networking.liqo.io_configurations.yaml | 27 ++++++++++++++++--- .../crds/networking.liqo.io_connections.yaml | 7 +++-- ...orking.liqo.io_firewallconfigurations.yaml | 4 +-- .../networking.liqo.io_gatewayclients.yaml | 3 ++- .../networking.liqo.io_gatewayservers.yaml | 7 +++-- .../crds/networking.liqo.io_publickeys.yaml | 3 ++- .../networking.liqo.io_wggatewayclients.yaml | 3 ++- ...king.liqo.io_wggatewayclienttemplates.yaml | 4 +-- .../networking.liqo.io_wggatewayservers.yaml | 7 +++-- ...king.liqo.io_wggatewayservertemplates.yaml | 4 +-- 21 files changed, 80 insertions(+), 43 deletions(-) diff --git a/apis/networking/v1alpha1/configuration_types.go b/apis/networking/v1alpha1/configuration_types.go index ebb61e113c..94b24ae195 100644 --- a/apis/networking/v1alpha1/configuration_types.go +++ b/apis/networking/v1alpha1/configuration_types.go @@ -50,15 +50,17 @@ type ClusterConfig struct { // ConfigurationSpec defines the desired state of Configuration. type ConfigurationSpec struct { - // Local configuration. + // Local network configuration (the cluster where the resource is created). Local ClusterConfig `json:"local,omitempty"` - // Remote configuration. + // LocalRemapped network configuration, it defines how the remote cluster sees the local cluster. + LocalRemapped ClusterConfig `json:"localRemapped,omitempty"` + // Remote network configuration (the other cluster). Remote ClusterConfig `json:"remote,omitempty"` } // ConfigurationStatus defines the observed state of Configuration. type ConfigurationStatus struct { - // Remote remapped configuration. + // Remote remapped configuration, it defines how the local cluster sees the remote cluster. Remote ClusterConfig `json:"remote,omitempty"` } @@ -66,7 +68,8 @@ type ConfigurationStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// Configuration is the Schema for the configuration API. +// Configuration contains the network configuration of a pair of clusters, +// including the local and the remote pod and external CIDRs and how the where remapped. type Configuration struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/connection_types.go b/apis/networking/v1alpha1/connection_types.go index fed71a70a4..021a4a9f5c 100644 --- a/apis/networking/v1alpha1/connection_types.go +++ b/apis/networking/v1alpha1/connection_types.go @@ -49,7 +49,7 @@ const ( type PingSpec struct { // Enabled specifies whether the ping is enabled or not. // +kubebuilder:default=true - Enabled bool `json:"enabled,omitempty"` + Enabled *bool `json:"enabled,omitempty"` // Endpoint specifies the endpoint to ping. Endpoint EndpointStatus `json:"endpoint,omitempty"` } @@ -118,7 +118,7 @@ type ConnectionStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// Connection is the Schema for the connection API. +// Connection contains the status of a connection between two clusters (a client and a server). type Connection struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/firewallconfiguration_types.go b/apis/networking/v1alpha1/firewallconfiguration_types.go index d90f2b6ddb..29228385af 100644 --- a/apis/networking/v1alpha1/firewallconfiguration_types.go +++ b/apis/networking/v1alpha1/firewallconfiguration_types.go @@ -104,7 +104,7 @@ type FirewallConfigurationStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// FirewallConfiguration is the Schema for the firewallconfiguration API. +// FirewallConfiguration contains a rule to be applied to the firewall in the gateway. type FirewallConfiguration struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/gatewayclient_types.go b/apis/networking/v1alpha1/gatewayclient_types.go index bb448b5f0b..5cd09440c7 100644 --- a/apis/networking/v1alpha1/gatewayclient_types.go +++ b/apis/networking/v1alpha1/gatewayclient_types.go @@ -55,7 +55,7 @@ type GatewayClientStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// GatewayClient is the Schema for the gatewayclient API. +// GatewayClient defines a gateway client that needs to point to a remote gateway server. type GatewayClient struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/gatewayserver_types.go b/apis/networking/v1alpha1/gatewayserver_types.go index 1834cdd017..9929c9ec72 100644 --- a/apis/networking/v1alpha1/gatewayserver_types.go +++ b/apis/networking/v1alpha1/gatewayserver_types.go @@ -62,9 +62,8 @@ type EndpointStatus struct { // Port specifies the port of the endpoint. Port int32 `json:"port,omitempty"` // Protocol specifies the protocol of the endpoint. - // +kubebuilder:default=TCP // +kubebuilder:validation:Enum=TCP;UDP - Protocol corev1.Protocol `json:"protocol,omitempty"` + Protocol *corev1.Protocol `json:"protocol,omitempty"` } // GatewayServerStatus defines the observed state of GatewayServer. @@ -72,14 +71,14 @@ type GatewayServerStatus struct { // ServerRef specifies the reference to the server. ServerRef corev1.ObjectReference `json:"serverRef,omitempty"` // Endpoint specifies the endpoint of the tunnel. - Endpoint EndpointStatus `json:"endpoint,omitempty"` + Endpoint *EndpointStatus `json:"endpoint,omitempty"` } // +kubebuilder:object:root=true // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// GatewayServer is the Schema for the gatewayserver API. +// GatewayServer defines a gateway server that remote gateway clients need to point to. type GatewayServer struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/publickey_types.go b/apis/networking/v1alpha1/publickey_types.go index 921f9ce51b..5870ddacd7 100644 --- a/apis/networking/v1alpha1/publickey_types.go +++ b/apis/networking/v1alpha1/publickey_types.go @@ -43,7 +43,7 @@ type PublicKeySpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:categories=liqo -// PublicKey is the Schema for the publickey API. +// PublicKey contains a public key data required by some interconnection technologies. type PublicKey struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/wggatewayclient_types.go b/apis/networking/v1alpha1/wggatewayclient_types.go index c8e785b2c7..901ca63934 100644 --- a/apis/networking/v1alpha1/wggatewayclient_types.go +++ b/apis/networking/v1alpha1/wggatewayclient_types.go @@ -53,7 +53,7 @@ type WgGatewayClientStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// WgGatewayClient is the Schema for the wggatewayclient API. +// WgGatewayClient defines a wireguard gateway client that needs to point to a remote wireguard gateway server. type WgGatewayClient struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/wggatewayclienttemplate_types.go b/apis/networking/v1alpha1/wggatewayclienttemplate_types.go index be4bdfce85..7a845a9b8e 100644 --- a/apis/networking/v1alpha1/wggatewayclienttemplate_types.go +++ b/apis/networking/v1alpha1/wggatewayclienttemplate_types.go @@ -53,7 +53,7 @@ type WgGatewayClientTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:categories=liqo -// WgGatewayClientTemplate is the Schema for the wggatewayclienttemplate API. +// WgGatewayClientTemplate contains a template for a wireguard gateway client. type WgGatewayClientTemplate struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/wggatewayserver_types.go b/apis/networking/v1alpha1/wggatewayserver_types.go index 848fc7fc78..4f39c1ea4d 100644 --- a/apis/networking/v1alpha1/wggatewayserver_types.go +++ b/apis/networking/v1alpha1/wggatewayserver_types.go @@ -74,7 +74,7 @@ type WgGatewayServerStatus struct { // +kubebuilder:resource:categories=liqo // +kubebuilder:subresource:status -// WgGatewayServer is the Schema for the wggatewayserver API. +// WgGatewayServer defines a wireguard gateway server that will accept connections from remote wireguard gateway clients. type WgGatewayServer struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/wggatewayservertemplate_types.go b/apis/networking/v1alpha1/wggatewayservertemplate_types.go index db3878e907..db2ae79712 100644 --- a/apis/networking/v1alpha1/wggatewayservertemplate_types.go +++ b/apis/networking/v1alpha1/wggatewayservertemplate_types.go @@ -53,7 +53,7 @@ type WgGatewayServerTemplateSpec struct { // +kubebuilder:object:root=true // +kubebuilder:resource:categories=liqo -// WgGatewayServerTemplate is the Schema for the wggatewayservertemplate API. +// WgGatewayServerTemplate contains a template for a wireguard gateway server. type WgGatewayServerTemplate struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/networking/v1alpha1/zz_generated.deepcopy.go b/apis/networking/v1alpha1/zz_generated.deepcopy.go index ce1592957c..f934d7e41d 100644 --- a/apis/networking/v1alpha1/zz_generated.deepcopy.go +++ b/apis/networking/v1alpha1/zz_generated.deepcopy.go @@ -20,6 +20,7 @@ package v1alpha1 import ( + "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -159,6 +160,7 @@ func (in *ConfigurationList) DeepCopyObject() runtime.Object { func (in *ConfigurationSpec) DeepCopyInto(out *ConfigurationSpec) { *out = *in out.Local = in.Local + out.LocalRemapped = in.LocalRemapped out.Remote = in.Remote } @@ -342,6 +344,11 @@ func (in *EndpointStatus) DeepCopyInto(out *EndpointStatus) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.Protocol != nil { + in, out := &in.Protocol, &out.Protocol + *out = new(v1.Protocol) + **out = **in + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new EndpointStatus. @@ -639,7 +646,11 @@ func (in *GatewayServerSpec) DeepCopy() *GatewayServerSpec { func (in *GatewayServerStatus) DeepCopyInto(out *GatewayServerStatus) { *out = *in out.ServerRef = in.ServerRef - in.Endpoint.DeepCopyInto(&out.Endpoint) + if in.Endpoint != nil { + in, out := &in.Endpoint, &out.Endpoint + *out = new(EndpointStatus) + (*in).DeepCopyInto(*out) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GatewayServerStatus. @@ -655,6 +666,11 @@ func (in *GatewayServerStatus) DeepCopy() *GatewayServerStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PingSpec) DeepCopyInto(out *PingSpec) { *out = *in + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } in.Endpoint.DeepCopyInto(&out.Endpoint) } diff --git a/deployments/liqo/crds/networking.liqo.io_configurations.yaml b/deployments/liqo/crds/networking.liqo.io_configurations.yaml index 5d6f3e297c..aeb0a22994 100644 --- a/deployments/liqo/crds/networking.liqo.io_configurations.yaml +++ b/deployments/liqo/crds/networking.liqo.io_configurations.yaml @@ -20,7 +20,9 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: Configuration is the Schema for the configuration API. + description: Configuration contains the network configuration of a pair of + clusters, including the local and the remote pod and external CIDRs and + how the where remapped. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -38,7 +40,23 @@ spec: description: ConfigurationSpec defines the desired state of Configuration. properties: local: - description: Local configuration. + description: Local network configuration (the cluster where the resource + is created). + properties: + cidr: + description: CIDR of the cluster. + properties: + external: + description: External CIDR of the cluster. + type: string + pod: + description: Pod CIDR of the cluster. + type: string + type: object + type: object + localRemapped: + description: LocalRemapped network configuration, it defines how the + remote cluster sees the local cluster. properties: cidr: description: CIDR of the cluster. @@ -52,7 +70,7 @@ spec: type: object type: object remote: - description: Remote configuration. + description: Remote network configuration (the other cluster). properties: cidr: description: CIDR of the cluster. @@ -70,7 +88,8 @@ spec: description: ConfigurationStatus defines the observed state of Configuration. properties: remote: - description: Remote remapped configuration. + description: Remote remapped configuration, it defines how the local + cluster sees the remote cluster. properties: cidr: description: CIDR of the cluster. diff --git a/deployments/liqo/crds/networking.liqo.io_connections.yaml b/deployments/liqo/crds/networking.liqo.io_connections.yaml index 5845a07cb1..f395ca4e25 100644 --- a/deployments/liqo/crds/networking.liqo.io_connections.yaml +++ b/deployments/liqo/crds/networking.liqo.io_connections.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: Connection is the Schema for the connection API. + description: Connection contains the status of a connection between two clusters + (a client and a server). properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -95,9 +96,7 @@ spec: format: int32 type: integer protocol: - allOf: - - default: TCP - - default: TCP + default: TCP description: Protocol specifies the protocol of the endpoint. enum: - TCP diff --git a/deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml b/deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml index 144a587f3d..2ec7be1558 100644 --- a/deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml +++ b/deployments/liqo/crds/networking.liqo.io_firewallconfigurations.yaml @@ -20,8 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: FirewallConfiguration is the Schema for the firewallconfiguration - API. + description: FirewallConfiguration contains a rule to be applied to the firewall + in the gateway. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml b/deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml index 71702f25f2..9bb781fe46 100644 --- a/deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml +++ b/deployments/liqo/crds/networking.liqo.io_gatewayclients.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: GatewayClient is the Schema for the gatewayclient API. + description: GatewayClient defines a gateway client that needs to point to + a remote gateway server. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml b/deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml index c0ee1267a7..1d13ceaba8 100644 --- a/deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml +++ b/deployments/liqo/crds/networking.liqo.io_gatewayservers.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: GatewayServer is the Schema for the gatewayserver API. + description: GatewayServer defines a gateway server that remote gateway clients + need to point to. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -112,9 +113,7 @@ spec: format: int32 type: integer protocol: - allOf: - - default: TCP - - default: TCP + default: TCP description: Protocol specifies the protocol of the endpoint. enum: - TCP diff --git a/deployments/liqo/crds/networking.liqo.io_publickeys.yaml b/deployments/liqo/crds/networking.liqo.io_publickeys.yaml index 5f2b54160c..e154607247 100644 --- a/deployments/liqo/crds/networking.liqo.io_publickeys.yaml +++ b/deployments/liqo/crds/networking.liqo.io_publickeys.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: PublicKey is the Schema for the publickey API. + description: PublicKey contains a public key data required by some interconnection + technologies. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml b/deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml index ce33354679..2e2bb88f26 100644 --- a/deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml +++ b/deployments/liqo/crds/networking.liqo.io_wggatewayclients.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: WgGatewayClient is the Schema for the wggatewayclient API. + description: WgGatewayClient defines a wireguard gateway client that needs + to point to a remote wireguard gateway server. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml b/deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml index c3a05a4bf7..0e307758dc 100644 --- a/deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml +++ b/deployments/liqo/crds/networking.liqo.io_wggatewayclienttemplates.yaml @@ -20,8 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: WgGatewayClientTemplate is the Schema for the wggatewayclienttemplate - API. + description: WgGatewayClientTemplate contains a template for a wireguard gateway + client. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml b/deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml index c639f9ff8d..6f2b4b62a7 100644 --- a/deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml +++ b/deployments/liqo/crds/networking.liqo.io_wggatewayservers.yaml @@ -20,7 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: WgGatewayServer is the Schema for the wggatewayserver API. + description: WgGatewayServer defines a wireguard gateway server that will + accept connections from remote wireguard gateway clients. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation @@ -8973,9 +8974,7 @@ spec: format: int32 type: integer protocol: - allOf: - - default: TCP - - default: TCP + default: TCP description: Protocol specifies the protocol of the endpoint. enum: - TCP diff --git a/deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml b/deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml index 28fef0b42c..237335b019 100644 --- a/deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml +++ b/deployments/liqo/crds/networking.liqo.io_wggatewayservertemplates.yaml @@ -20,8 +20,8 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: WgGatewayServerTemplate is the Schema for the wggatewayservertemplate - API. + description: WgGatewayServerTemplate contains a template for a wireguard gateway + server. properties: apiVersion: description: 'APIVersion defines the versioned schema of this representation