From 115db7183179395f0738f0b839923b8f38036a0d Mon Sep 17 00:00:00 2001 From: Mridul Gain Date: Thu, 15 Feb 2024 18:09:10 +0530 Subject: [PATCH] feat(AM-12243): api changes for envoy gw (#31) * feat(AM-12243): api changes for envoy gw Signed-off-by: Mridul * service discovery port change for multinet slice Signed-off-by: Mridul Gain --------- Signed-off-by: Mridul Signed-off-by: Mridul Gain --- .../v1alpha1/serviceexportconfig_types.go | 26 +++++++++++-------- pkg/controller/v1alpha1/sliceconfig_types.go | 5 +++- .../v1alpha1/zz_generated.deepcopy.go | 22 +++++++++++++++- .../v1alpha1/workerserviceimport_types.go | 26 +++++++++++-------- .../v1alpha1/workersliceconfig_types.go | 3 +++ pkg/worker/v1alpha1/zz_generated.deepcopy.go | 5 ++++ 6 files changed, 63 insertions(+), 24 deletions(-) diff --git a/pkg/controller/v1alpha1/serviceexportconfig_types.go b/pkg/controller/v1alpha1/serviceexportconfig_types.go index 7559c80..6f78129 100644 --- a/pkg/controller/v1alpha1/serviceexportconfig_types.go +++ b/pkg/controller/v1alpha1/serviceexportconfig_types.go @@ -1,17 +1,17 @@ /* - * Copyright (c) 2022 Avesha, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 + * Copyright (c) 2022 Avesha, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package v1alpha1 @@ -57,10 +57,14 @@ type ServiceDiscoveryEndpoint struct { type ServiceDiscoveryPort struct { // The name of the port. Name string `json:"name,omitempty"` - // The port number. + // The target port number. Port int32 `json:"port,omitempty"` // The protocol. Protocol string `json:"protocol,omitempty"` + // The port exposed by service + ServicePort int32 `json:"servicePort,omitempty"` + // The service protocol + ServiceProtocol string `json:"serviceProtocol,omitempty"` } type ServiceExportConfigStatus struct { diff --git a/pkg/controller/v1alpha1/sliceconfig_types.go b/pkg/controller/v1alpha1/sliceconfig_types.go index ce16514..28e1443 100644 --- a/pkg/controller/v1alpha1/sliceconfig_types.go +++ b/pkg/controller/v1alpha1/sliceconfig_types.go @@ -25,7 +25,10 @@ import ( // SliceConfigSpec defines the desired state of SliceConfig type SliceConfigSpec struct { - SliceSubnet string `json:"sliceSubnet,omitempty"` + //+kubebuilder:default:=single-network + //+kubebuilder:validation:Enum:=single-network;multi-network + OverlayNetworkDeploymentMode string `json:"overlayNetworkDeploymentMode,omitempty"` + SliceSubnet string `json:"sliceSubnet,omitempty"` //+kubebuilder:default:=Application SliceType string `json:"sliceType,omitempty"` // +kubebuilder:validation:Required diff --git a/pkg/controller/v1alpha1/zz_generated.deepcopy.go b/pkg/controller/v1alpha1/zz_generated.deepcopy.go index ac80f71..cff3686 100644 --- a/pkg/controller/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/controller/v1alpha1/zz_generated.deepcopy.go @@ -673,7 +673,7 @@ 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 - out.SliceGatewayProvider = in.SliceGatewayProvider + in.SliceGatewayProvider.DeepCopyInto(&out.SliceGatewayProvider) if in.Clusters != nil { in, out := &in.Clusters, &out.Clusters *out = make([]string, len(*in)) @@ -735,6 +735,21 @@ func (in *SliceConfigStatus) DeepCopy() *SliceConfigStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SliceGatewayServiceType) DeepCopyInto(out *SliceGatewayServiceType) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SliceGatewayServiceType. +func (in *SliceGatewayServiceType) DeepCopy() *SliceGatewayServiceType { + if in == nil { + return nil + } + out := new(SliceGatewayServiceType) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SliceNamespaceSelection) DeepCopyInto(out *SliceNamespaceSelection) { *out = *in @@ -1050,6 +1065,11 @@ func (in *VpnKeyRotationStatus) DeepCopy() *VpnKeyRotationStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkerSliceGatewayProvider) DeepCopyInto(out *WorkerSliceGatewayProvider) { *out = *in + if in.SliceGatewayServiceType != nil { + in, out := &in.SliceGatewayServiceType, &out.SliceGatewayServiceType + *out = make([]SliceGatewayServiceType, len(*in)) + copy(*out, *in) + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkerSliceGatewayProvider. diff --git a/pkg/worker/v1alpha1/workerserviceimport_types.go b/pkg/worker/v1alpha1/workerserviceimport_types.go index fb74b4b..325c339 100644 --- a/pkg/worker/v1alpha1/workerserviceimport_types.go +++ b/pkg/worker/v1alpha1/workerserviceimport_types.go @@ -1,17 +1,17 @@ /* - * Copyright (c) 2022 Avesha, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 + * Copyright (c) 2022 Avesha, Inc. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 + * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package v1alpha1 @@ -58,10 +58,14 @@ type ServiceDiscoveryEndpoint struct { type ServiceDiscoveryPort struct { // The name of the port. Name string `json:"name,omitempty"` - // The port number. + // The target port number. Port int32 `json:"port,omitempty"` // The protocol. Protocol string `json:"protocol,omitempty"` + // The port exposed by service + ServicePort int32 `json:"servicePort,omitempty"` + // The service protocol + ServiceProtocol string `json:"serviceProtocol,omitempty"` } // WorkerServiceImportStatus defines the observed state of WorkerServiceImport diff --git a/pkg/worker/v1alpha1/workersliceconfig_types.go b/pkg/worker/v1alpha1/workersliceconfig_types.go index 3215b92..7e6c368 100644 --- a/pkg/worker/v1alpha1/workersliceconfig_types.go +++ b/pkg/worker/v1alpha1/workersliceconfig_types.go @@ -51,6 +51,9 @@ type WorkerSliceConfigSpec struct { Octet *int `json:"octet"` 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"` } // WorkerSliceGatewayProvider defines the configuration for slicegateway diff --git a/pkg/worker/v1alpha1/zz_generated.deepcopy.go b/pkg/worker/v1alpha1/zz_generated.deepcopy.go index 3e7d17d..bda9ca3 100644 --- a/pkg/worker/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/worker/v1alpha1/zz_generated.deepcopy.go @@ -225,6 +225,11 @@ func (in *SliceGatewayConfig) DeepCopyInto(out *SliceGatewayConfig) { *out = make([]string, len(*in)) copy(*out, *in) } + if in.LoadBalancerIps != nil { + in, out := &in.LoadBalancerIps, &out.LoadBalancerIps + *out = make([]string, len(*in)) + copy(*out, *in) + } if in.NodePorts != nil { in, out := &in.NodePorts, &out.NodePorts *out = make([]int, len(*in))