Skip to content

Commit a7cd533

Browse files
committed
Add ingress feature to controller
1 parent 3716e5d commit a7cd533

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+4573
-31
lines changed

PROJECT

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,50 @@ resources:
2929
webhooks:
3030
defaulting: true
3131
webhookVersion: v1
32+
- api:
33+
crdVersion: v1
34+
namespaced: true
35+
controller: true
36+
domain: netbird.io
37+
kind: NBRoutingPeer
38+
path: github.com/netbirdio/kubernetes-operator/api/v1
39+
version: v1
40+
webhooks:
41+
validation: true
42+
webhookVersion: v1
43+
- controller: true
44+
external: true
45+
kind: Service
46+
path: k8s.io/api/core/v1
47+
version: v1
48+
- api:
49+
crdVersion: v1
50+
namespaced: true
51+
controller: true
52+
domain: netbird.io
53+
kind: NBResource
54+
path: github.com/netbirdio/kubernetes-operator/api/v1
55+
version: v1
56+
webhooks:
57+
validation: true
58+
webhookVersion: v1
59+
- api:
60+
crdVersion: v1
61+
namespaced: true
62+
controller: true
63+
domain: netbird.io
64+
kind: NBGroup
65+
path: github.com/netbirdio/kubernetes-operator/api/v1
66+
version: v1
67+
webhooks:
68+
validation: true
69+
webhookVersion: v1
70+
- api:
71+
crdVersion: v1
72+
namespaced: true
73+
controller: true
74+
domain: netbird.io
75+
kind: NBPolicy
76+
path: github.com/netbirdio/kubernetes-operator/api/v1
77+
version: v1
3278
version: "3"

api/v1/nbgroup_types.go

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
8+
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
9+
10+
// NBGroupSpec defines the desired state of NBGroup.
11+
type NBGroupSpec struct {
12+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
13+
Name string `json:"name"`
14+
}
15+
16+
// NBGroupStatus defines the observed state of NBGroup.
17+
type NBGroupStatus struct {
18+
// +optional
19+
GroupID *string `json:"groupID"`
20+
}
21+
22+
// +kubebuilder:object:root=true
23+
// +kubebuilder:subresource:status
24+
25+
// NBGroup is the Schema for the nbgroups API.
26+
type NBGroup struct {
27+
metav1.TypeMeta `json:",inline"`
28+
metav1.ObjectMeta `json:"metadata,omitempty"`
29+
30+
Spec NBGroupSpec `json:"spec,omitempty"`
31+
Status NBGroupStatus `json:"status,omitempty"`
32+
}
33+
34+
// +kubebuilder:object:root=true
35+
36+
// NBGroupList contains a list of NBGroup.
37+
type NBGroupList struct {
38+
metav1.TypeMeta `json:",inline"`
39+
metav1.ListMeta `json:"metadata,omitempty"`
40+
Items []NBGroup `json:"items"`
41+
}
42+
43+
func init() {
44+
SchemeBuilder.Register(&NBGroup{}, &NBGroupList{})
45+
}

api/v1/nbpolicy_types.go

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// NBPolicySpec defines the desired state of NBPolicy.
8+
type NBPolicySpec struct {
9+
// Name Policy name
10+
Name string `json:"name"`
11+
// +optional
12+
Description string `json:"description,omitempty"`
13+
// +kubebuilder:validation:MinItems=1
14+
SourceGroups []string `json:"sourceGroups,omitempty"`
15+
// +optional
16+
DestinationGroups []string `json:"destinationGroups,omitempty"`
17+
// +optional
18+
// +kubebuilder:validation:items:Enum=TCP;UDP;All
19+
Protocols []string `json:"protocols,omitempty"`
20+
// +optional
21+
// +kubebuilder:validation:items:Minimum=1
22+
// +kubebuilder:validation:items:Maximum=65536
23+
Ports []int32 `json:"ports,omitempty"`
24+
// +optional
25+
// +default:value=true
26+
Bidirectional bool `json:"bidirectional"`
27+
}
28+
29+
// NBPolicyStatus defines the observed state of NBPolicy.
30+
type NBPolicyStatus struct {
31+
// +optional
32+
TCPPolicyID *string `json:"tcpPolicyID"`
33+
// +optional
34+
UDPPolicyID *string `json:"udpPolicyID"`
35+
// +optional
36+
LastUpdatedAt *metav1.Time `json:"lastUpdatedAt"`
37+
// +optional
38+
ManagedServiceList []string `json:"managedServiceList"`
39+
}
40+
41+
// +kubebuilder:object:root=true
42+
// +kubebuilder:subresource:status
43+
// +kubebuilder:resource:scope=Cluster
44+
45+
// NBPolicy is the Schema for the nbpolicies API.
46+
type NBPolicy struct {
47+
metav1.TypeMeta `json:",inline"`
48+
metav1.ObjectMeta `json:"metadata,omitempty"`
49+
50+
Spec NBPolicySpec `json:"spec,omitempty"`
51+
Status NBPolicyStatus `json:"status,omitempty"`
52+
}
53+
54+
// +kubebuilder:object:root=true
55+
56+
// NBPolicyList contains a list of NBPolicy.
57+
type NBPolicyList struct {
58+
metav1.TypeMeta `json:",inline"`
59+
metav1.ListMeta `json:"metadata,omitempty"`
60+
Items []NBPolicy `json:"items"`
61+
}
62+
63+
func init() {
64+
SchemeBuilder.Register(&NBPolicy{}, &NBPolicyList{})
65+
}

api/v1/nbresource_types.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
)
6+
7+
// NBResourceSpec defines the desired state of NBResource.
8+
type NBResourceSpec struct {
9+
Name string `json:"name"`
10+
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="Value is immutable"
11+
NetworkID string `json:"networkID"`
12+
Address string `json:"address"`
13+
Groups []string `json:"groups"`
14+
// +optional
15+
PolicyName string `json:"policyName,omitempty"`
16+
// +optional
17+
TCPPorts []int32 `json:"tcpPorts,omitempty"`
18+
// +optional
19+
UDPPorts []int32 `json:"udpPorts,omitempty"`
20+
}
21+
22+
// NBResourceStatus defines the observed state of NBResource.
23+
type NBResourceStatus struct {
24+
// +optional
25+
NetworkResourceID *string `json:"networkResourceID,omitempty"`
26+
// +optional
27+
PolicyName *string `json:"policyName,omitempty"`
28+
// +optional
29+
TCPPorts []int32 `json:"tcpPorts,omitempty"`
30+
// +optional
31+
UDPPorts []int32 `json:"udpPorts,omitempty"`
32+
// +optional
33+
Groups []string `json:"groups,omitempty"`
34+
}
35+
36+
// +kubebuilder:object:root=true
37+
// +kubebuilder:subresource:status
38+
39+
// NBResource is the Schema for the nbresources API.
40+
type NBResource struct {
41+
metav1.TypeMeta `json:",inline"`
42+
metav1.ObjectMeta `json:"metadata,omitempty"`
43+
44+
Spec NBResourceSpec `json:"spec,omitempty"`
45+
Status NBResourceStatus `json:"status,omitempty"`
46+
}
47+
48+
// +kubebuilder:object:root=true
49+
50+
// NBResourceList contains a list of NBResource.
51+
type NBResourceList struct {
52+
metav1.TypeMeta `json:",inline"`
53+
metav1.ListMeta `json:"metadata,omitempty"`
54+
Items []NBResource `json:"items"`
55+
}
56+
57+
func init() {
58+
SchemeBuilder.Register(&NBResource{}, &NBResourceList{})
59+
}

api/v1/nbroutingpeer_types.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
package v1
2+
3+
import (
4+
corev1 "k8s.io/api/core/v1"
5+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
6+
)
7+
8+
// NBRoutingPeerSpec defines the desired state of NBRoutingPeer.
9+
type NBRoutingPeerSpec struct {
10+
// +optional
11+
Replicas *int32 `json:"replicas"`
12+
// +optional
13+
Resources corev1.ResourceRequirements `json:"resources"`
14+
// +optional
15+
Labels map[string]string `json:"labels"`
16+
// +optional
17+
Annotations map[string]string `json:"annotations"`
18+
// +optional
19+
NodeSelector map[string]string `json:"nodeSelector"`
20+
// +optional
21+
Tolerations []corev1.Toleration `json:"tolerations"`
22+
}
23+
24+
// NBRoutingPeerStatus defines the observed state of NBRoutingPeer.
25+
type NBRoutingPeerStatus struct {
26+
// +optional
27+
NetworkID *string `json:"networkID"`
28+
// +optional
29+
SetupKeyID *string `json:"setupKeyID"`
30+
// +optional
31+
RouterID *string `json:"routerID"`
32+
}
33+
34+
// +kubebuilder:object:root=true
35+
// +kubebuilder:subresource:status
36+
37+
// NBRoutingPeer is the Schema for the nbroutingpeers API.
38+
type NBRoutingPeer struct {
39+
metav1.TypeMeta `json:",inline"`
40+
metav1.ObjectMeta `json:"metadata,omitempty"`
41+
42+
Spec NBRoutingPeerSpec `json:"spec,omitempty"`
43+
Status NBRoutingPeerStatus `json:"status,omitempty"`
44+
}
45+
46+
// +kubebuilder:object:root=true
47+
48+
// NBRoutingPeerList contains a list of NBRoutingPeer.
49+
type NBRoutingPeerList struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ListMeta `json:"metadata,omitempty"`
52+
Items []NBRoutingPeer `json:"items"`
53+
}
54+
55+
func init() {
56+
SchemeBuilder.Register(&NBRoutingPeer{}, &NBRoutingPeerList{})
57+
}

api/v1/nbsetupkey_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ type NBSetupKeyConditionType string
2626

2727
// These are built-in conditions of pod. An application may use a custom condition not listed here.
2828
const (
29-
// Ready indicates whether NBSetupKey is valid and ready to use.
30-
Ready NBSetupKeyConditionType = "Ready"
29+
// NBSetupKeyReady indicates whether NBSetupKey is valid and ready to use.
30+
NBSetupKeyReady NBSetupKeyConditionType = "Ready"
3131
)
3232

3333
// NBSetupKeySpec defines the desired state of NBSetupKey.

0 commit comments

Comments
 (0)