Skip to content

Commit

Permalink
feat(AM-11526,AM-11741): Slice Gateway External LoadBalancer (#191)
Browse files Browse the repository at this point in the history
* feat(): vpnkeyrotation apis, webhook, ITs, UTs and service layer (#151)

feat(): vpnkeyrotation apis, webhook, ITs, UTs and service layer (#151)

Signed-off-by: rahulsawra98 <[email protected]

* Update trivy.yml

Signed-off-by: Md Imran <[email protected]>

* Create codeql.yml

Signed-off-by: Md Imran <[email protected]>

* Update trivy.yml

Signed-off-by: Md Imran <[email protected]>

* Delete codeql.yml

Signed-off-by: Md Imran <[email protected]>

* feat(AM-11526,AM-11741): Slice Gateway External LoadBalancer  (#180)

* added slicegatewayServiceType field

Signed-off-by: Mridul <[email protected]>

* added slice config validation

Signed-off-by: Mridul <[email protected]>

* workerslicegw change:  adding gw connectivity type

Signed-off-by: Mridul <[email protected]>

* feat(AM-11526): reconcile logic for LB IPs

Signed-off-by: Mridul <[email protected]>

* feat(AM-11526): updating gwConnType is not allowed

Signed-off-by: Mridul <[email protected]>

* set gwSvcType during workersliceconfig creation

Signed-off-by: Mridul <[email protected]>

* feat(AM-11526): set gwSvcType during workerSliceGw creation

Signed-off-by: Mridul <[email protected]>

* feat(AM-11526):  webhook validation not needed in wsc & wsg

Signed-off-by: Mridul <[email protected]>

* feat(AM-11741): protocol specification for slice gateway load balancer (#190)

* feat(AM-11741): define protocol for gw svc type

* feat(AM-11741): reconcilation logic for gateway service protocol

* feat(AM-11741): provide gw protocol during cert generation

* fix(AM-11741): webhook validation, env var & wsc reconciler

* fix(): gwsvctype mistatch

---------

Signed-off-by: Mridul Gain <[email protected]>

* fix: edge case

Signed-off-by: Mridul <[email protected]>

* feat(AM-12018): unit test for getSliceGwSvcTypes()

Signed-off-by: Mridul <[email protected]>

* fix(AM-12018): prevent protocol update

Signed-off-by: Mridul <[email protected]>

* fix(AM-12018): unit tests for validateSlicegatewayServiceType

Signed-off-by: Mridul <[email protected]>

---------

Signed-off-by: Mridul <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>

---------

Signed-off-by: rahulsawra98 <[email protected]
Signed-off-by: Mridul <[email protected]>
Signed-off-by: Md Imran <[email protected]>
Signed-off-by: Mridul Gain <[email protected]>
Co-authored-by: rahulsawra98 <[email protected]>
Co-authored-by: Mridul <[email protected]>
  • Loading branch information
3 people authored Nov 23, 2023
1 parent e400e46 commit 14a6209
Show file tree
Hide file tree
Showing 28 changed files with 587 additions and 100 deletions.
15 changes: 15 additions & 0 deletions apis/controller/v1alpha1/sliceconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,21 @@ type WorkerSliceGatewayProvider struct {
//+kubebuilder:default:=Local
// +kubebuilder:validation:Required
SliceCaType string `json:"sliceCaType"`

SliceGatewayServiceType []SliceGatewayServiceType `json:"sliceGatewayServiceType,omitempty"`
}

type SliceGatewayServiceType struct {
// +kubebuilder:validation:Required
Cluster string `json:"cluster"`
// +kubebuilder:validation:Required
//+kubebuilder:default:=NodePort
//+kubebuilder:validation:Enum:=NodePort;LoadBalancer
Type string `json:"type"`
// +kubebuilder:validation:Required
//+kubebuilder:default:=UDP
//+kubebuilder:validation:Enum:=TCP;UDP
Protocol string `json:"protocol"`
}

// QOSProfile is the QOS Profile configuration from backend
Expand Down
22 changes: 21 additions & 1 deletion apis/controller/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions apis/worker/v1alpha1/workersliceconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ type WorkerSliceGatewayProvider struct {
SliceGatewayType string `json:"sliceGatewayType,omitempty"`
//+kubebuilder:default:=Local
SliceCaType string `json:"sliceCaType,omitempty"`
//+kubebuilder:default:=NodePort
//+kubebuilder:validation:Enum:=NodePort;LoadBalancer
SliceGatewayServiceType string `json:"sliceGatewayServiceType,omitempty"`
//+kubebuilder:default:=UDP
//+kubebuilder:validation:Enum:=TCP;UDP
SliceGatewayProtocol string `json:"sliceGatewayProtocol,omitempty"`
}

// QOSProfile is the QOS Profile configuration from backend
Expand Down
25 changes: 16 additions & 9 deletions apis/worker/v1alpha1/workerslicegateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ type WorkerSliceGatewaySpec struct {
//+kubebuilder:default:=OpenVPN
GatewayType string `json:"gatewayType,omitempty"`
//+kubebuilder:validation:Enum:=Client;Server
GatewayHostType string `json:"gatewayHostType,omitempty"`
GatewayHostType string `json:"gatewayHostType,omitempty"`
//+kubebuilder:default:=NodePort
//+kubebuilder:validation:Enum:=NodePort;LoadBalancer
GatewayConnectivityType string `json:"gatewayConnectivityType,omitempty"`
//+kubebuilder:default:=UDP
//+kubebuilder:validation:Enum:=TCP;UDP
GatewayProtocol string `json:"gatewayProtocol,omitempty"`
GatewayCredentials GatewayCredentials `json:"gatewayCredentials,omitempty"`
LocalGatewayConfig SliceGatewayConfig `json:"localGatewayConfig,omitempty"`
RemoteGatewayConfig SliceGatewayConfig `json:"remoteGatewayConfig,omitempty"`
Expand All @@ -38,14 +44,15 @@ type WorkerSliceGatewaySpec struct {

type SliceGatewayConfig struct {
//+kubebuilder:deprecatedversion:warning="worker/v1alpha1 NodeIp is deprecated...use NodeIps"
NodeIp string `json:"nodeIp,omitempty"`
NodeIps []string `json:"nodeIps,omitempty"`
NodePort int `json:"nodePort,omitempty"`
NodePorts []int `json:"nodePorts,omitempty"`
GatewayName string `json:"gatewayName,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
VpnIp string `json:"vpnIp,omitempty"`
GatewaySubnet string `json:"gatewaySubnet,omitempty"`
NodeIp string `json:"nodeIp,omitempty"`
NodeIps []string `json:"nodeIps,omitempty"`
LoadBalancerIps []string `json:"loadBalancerIps,omitempty"`
NodePort int `json:"nodePort,omitempty"`
NodePorts []int `json:"nodePorts,omitempty"`
GatewayName string `json:"gatewayName,omitempty"`
ClusterName string `json:"clusterName,omitempty"`
VpnIp string `json:"vpnIp,omitempty"`
GatewaySubnet string `json:"gatewaySubnet,omitempty"`
}

type GatewayCredentials struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/worker/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions config/crd/bases/controller.kubeslice.io_sliceconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,29 @@ spec:
sliceCaType:
default: Local
type: string
sliceGatewayServiceType:
items:
properties:
cluster:
type: string
protocol:
default: UDP
enum:
- TCP
- UDP
type: string
type:
default: NodePort
enum:
- NodePort
- LoadBalancer
type: string
required:
- cluster
- protocol
- type
type: object
type: array
sliceGatewayType:
default: OpenVPN
type: string
Expand Down
12 changes: 12 additions & 0 deletions config/crd/bases/worker.kubeslice.io_workersliceconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,18 @@ spec:
sliceCaType:
default: Local
type: string
sliceGatewayProtocol:
default: UDP
enum:
- TCP
- UDP
type: string
sliceGatewayServiceType:
default: NodePort
enum:
- NodePort
- LoadBalancer
type: string
sliceGatewayType:
default: OpenVPN
type: string
Expand Down
20 changes: 20 additions & 0 deletions config/crd/bases/worker.kubeslice.io_workerslicegateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ spec:
spec:
description: WorkerSliceGatewaySpec defines the desired state of WorkerSliceGateway
properties:
gatewayConnectivityType:
default: NodePort
enum:
- NodePort
- LoadBalancer
type: string
gatewayCredentials:
properties:
secretName:
Expand All @@ -47,6 +53,12 @@ spec:
type: string
gatewayNumber:
type: integer
gatewayProtocol:
default: UDP
enum:
- TCP
- UDP
type: string
gatewayType:
default: OpenVPN
type: string
Expand All @@ -58,6 +70,10 @@ spec:
type: string
gatewaySubnet:
type: string
loadBalancerIps:
items:
type: string
type: array
nodeIp:
type: string
nodeIps:
Expand All @@ -81,6 +97,10 @@ spec:
type: string
gatewaySubnet:
type: string
loadBalancerIps:
items:
type: string
type: array
nodeIp:
type: string
nodeIps:
Expand Down
8 changes: 5 additions & 3 deletions service/kube_slice_resource_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@ var (
)

const (
serverGateway = "Server"
clientGateway = "Client"
workerSliceGatewayType = "OpenVPN"
serverGateway = "Server"
clientGateway = "Client"
workerSliceGatewayType = "OpenVPN"
defaultSliceGatewayServiceType = "NodePort"
defaultSliceGatewayServiceProtocol = "UDP"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion service/mocks/IVpnKeyRotationService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 11 additions & 9 deletions service/mocks/IWorkerSliceConfigService.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 14a6209

Please sign in to comment.