-
Notifications
You must be signed in to change notification settings - Fork 15
/
workersliceconfig_types.go
127 lines (110 loc) · 4.73 KB
/
workersliceconfig_types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* 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
*
* 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.
*/
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// WorkerSliceConfigSpec defines the desired state of Slice
type WorkerSliceConfigSpec struct {
SliceName string `json:"sliceName,omitempty"`
SliceSubnet string `json:"sliceSubnet,omitempty"`
//+kubebuilder:default:=Application
SliceType string `json:"sliceType,omitempty"`
SliceGatewayProvider WorkerSliceGatewayProvider `json:"sliceGatewayProvider,omitempty"`
//+kubebuilder:default:=Local
SliceIpamType string `json:"sliceIpamType,omitempty"`
QosProfileDetails QOSProfile `json:"qosProfileDetails,omitempty"`
NamespaceIsolationProfile NamespaceIsolationProfile `json:"namespaceIsolationProfile,omitempty"`
IpamClusterOctet int `json:"ipamClusterOctet,omitempty"`
ExternalGatewayConfig ExternalGatewayConfig `json:"externalGatewayConfig,omitempty"`
}
// WorkerSliceGatewayProvider defines the configuration for slicegateway
type WorkerSliceGatewayProvider struct {
//+kubebuilder:default:=OpenVPN
SliceGatewayType string `json:"sliceGatewayType,omitempty"`
//+kubebuilder:default:=Local
SliceCaType string `json:"sliceCaType,omitempty"`
}
// QOSProfile is the QOS Profile configuration from backend
type QOSProfile struct {
//+kubebuilder:default:=HTB
QueueType string `json:"queueType,omitempty"`
Priority int `json:"priority,omitempty"`
TcType string `json:"tcType,omitempty"`
BandwidthCeilingKbps int `json:"bandwidthCeilingKbps,omitempty"`
BandwidthGuaranteedKbps int `json:"bandwidthGuaranteedKbps,omitempty"`
//+kubebuilder:validation:Enum:=Default;AF11;AF12;AF13;AF21;AF22;AF23;AF31;AF32;AF33;AF41;AF42;AF43;EF
DscpClass string `json:"dscpClass,omitempty"`
}
type NamespaceIsolationProfile struct {
//+kubebuilder:default:=false
//+kubebuilder:validation:Optional
IsolationEnabled bool `json:"isolationEnabled"`
ApplicationNamespaces []string `json:"applicationNamespaces,omitempty"`
AllowedNamespaces []string `json:"allowedNamespaces,omitempty"`
}
type ExternalGatewayConfig struct {
Ingress ExternalGatewayConfigOptions `json:"ingress,omitempty"`
Egress ExternalGatewayConfigOptions `json:"egress,omitempty"`
NsIngress ExternalGatewayConfigOptions `json:"nsIngress,omitempty"`
//+kubebuilder:validation:Enum:=none;istio
GatewayType string `json:"gatewayType,omitempty"`
}
type ExternalGatewayConfigOptions struct {
Enabled bool `json:"enabled,omitempty"`
}
// AppPod defines the app pods connected to slice
type AppPod struct {
// PodName is App Pod Name
PodName string `json:"podName,omitempty"`
// PodNamespace is App Pod Namespace
PodNamespace string `json:"podNamespace,omitempty"`
// PodIP is App Pod IP
PodIP string `json:"podIp,omitempty"`
// NsmIP is the nsm ip of App
NsmIP string `json:"nsmIp,omitempty"`
// NsmInterface is the nsm interface of App
NsmInterface string `json:"nsmInterface,omitempty"`
// PeerIp is the nsm peer ip of gateway
NsmPeerIP string `json:"nsmPeerIp,omitempty"`
}
// WorkerSliceConfigStatus defines the observed state of Slice
type WorkerSliceConfigStatus struct {
ConnectedAppPods []AppPod `json:"connectedAppPods,omitempty"`
OnboardedAppNamespaces []NamespaceConfig `json:"onboardedAppNamespaces,omitempty"`
}
type NamespaceConfig struct {
Name string `json:"name,omitempty"`
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// WorkerSliceConfig is the Schema for the slice API
type WorkerSliceConfig struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec WorkerSliceConfigSpec `json:"spec,omitempty"`
Status WorkerSliceConfigStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// WorkerSliceConfigList contains a list of Slice
type WorkerSliceConfigList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []WorkerSliceConfig `json:"items"`
}
func init() {
SchemeBuilder.Register(&WorkerSliceConfig{}, &WorkerSliceConfigList{})
}