Skip to content

Commit 736d10a

Browse files
committed
Add ingress feature to controller
1 parent 74f9959 commit 736d10a

31 files changed

+3074
-29
lines changed

PROJECT

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,33 @@ 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+
- controller: true
41+
external: true
42+
kind: Service
43+
path: k8s.io/api/core/v1
44+
version: v1
45+
- api:
46+
crdVersion: v1
47+
namespaced: true
48+
controller: true
49+
domain: netbird.io
50+
kind: NBResource
51+
path: github.com/netbirdio/kubernetes-operator/api/v1
52+
version: v1
53+
- api:
54+
crdVersion: v1
55+
namespaced: true
56+
controller: true
57+
domain: netbird.io
58+
kind: NBGroup
59+
path: github.com/netbirdio/kubernetes-operator/api/v1
60+
version: v1
3261
version: "3"

api/v1/nbgroup_types.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
Name string `json:"name"`
13+
}
14+
15+
// NBGroupStatus defines the observed state of NBGroup.
16+
type NBGroupStatus struct {
17+
// +optional
18+
GroupID *string `json:"groupID"`
19+
}
20+
21+
// +kubebuilder:object:root=true
22+
// +kubebuilder:subresource:status
23+
24+
// NBGroup is the Schema for the nbgroups API.
25+
type NBGroup struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ObjectMeta `json:"metadata,omitempty"`
28+
29+
Spec NBGroupSpec `json:"spec,omitempty"`
30+
Status NBGroupStatus `json:"status,omitempty"`
31+
}
32+
33+
// +kubebuilder:object:root=true
34+
35+
// NBGroupList contains a list of NBGroup.
36+
type NBGroupList struct {
37+
metav1.TypeMeta `json:",inline"`
38+
metav1.ListMeta `json:"metadata,omitempty"`
39+
Items []NBGroup `json:"items"`
40+
}
41+
42+
func init() {
43+
SchemeBuilder.Register(&NBGroup{}, &NBGroupList{})
44+
}

api/v1/nbresource_types.go

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
NetworkID string `json:"networkID"`
11+
Address string `json:"address"`
12+
Groups []string `json:"groups"`
13+
}
14+
15+
// NBResourceStatus defines the observed state of NBResource.
16+
type NBResourceStatus struct {
17+
// +optional
18+
NetworkResourceID *string `json:"networkResourceID"`
19+
}
20+
21+
// +kubebuilder:object:root=true
22+
// +kubebuilder:subresource:status
23+
24+
// NBResource is the Schema for the nbresources API.
25+
type NBResource struct {
26+
metav1.TypeMeta `json:",inline"`
27+
metav1.ObjectMeta `json:"metadata,omitempty"`
28+
29+
Spec NBResourceSpec `json:"spec,omitempty"`
30+
Status NBResourceStatus `json:"status,omitempty"`
31+
}
32+
33+
// +kubebuilder:object:root=true
34+
35+
// NBResourceList contains a list of NBResource.
36+
type NBResourceList struct {
37+
metav1.TypeMeta `json:",inline"`
38+
metav1.ListMeta `json:"metadata,omitempty"`
39+
Items []NBResource `json:"items"`
40+
}
41+
42+
func init() {
43+
SchemeBuilder.Register(&NBResource{}, &NBResourceList{})
44+
}

api/v1/nbroutingpeer_types.go

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
// NBRoutingPeerConditionType is a valid value for NBRoutingPeerCondition.Type
9+
type NBRoutingPeerConditionType string
10+
11+
const (
12+
// RoutingPeerReady indicates whether NBRoutingPeer is valid and ready to use.
13+
RoutingPeerReady NBRoutingPeerConditionType = "Ready"
14+
// RoutingPeerNetworkReady indicates whether NetBird network is ready and found.
15+
RoutingPeerNetworkReady NBRoutingPeerConditionType = "NetworkReady"
16+
)
17+
18+
// NBRoutingPeerSpec defines the desired state of NBRoutingPeer.
19+
type NBRoutingPeerSpec struct {
20+
// +optional
21+
Replicas *int32 `json:"replicas"`
22+
// +optional
23+
Resources corev1.ResourceRequirements `json:"resources"`
24+
// +optional
25+
Labels map[string]string `json:"labels"`
26+
// +optional
27+
Annotations map[string]string `json:"annotations"`
28+
// +optional
29+
NodeSelector map[string]string `json:"nodeSelector"`
30+
// +optional
31+
Tolerations []corev1.Toleration `json:"tolerations"`
32+
}
33+
34+
// NBRoutingPeerStatus defines the observed state of NBRoutingPeer.
35+
type NBRoutingPeerStatus struct {
36+
// +optional
37+
Conditions []NBRoutingPeerCondition `json:"conditions"`
38+
// +optional
39+
NetworkID *string `json:"networkID"`
40+
// +optional
41+
SetupKeyID *string `json:"setupKeyID"`
42+
// +optional
43+
RouterID *string `json:"routerID"`
44+
}
45+
46+
// NBRoutingPeerCondition defines a condition in NBRoutingPeer status.
47+
type NBRoutingPeerCondition struct {
48+
// Type is the type of the condition.
49+
Type NBRoutingPeerConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=NBRoutingPeerConditionType"`
50+
// Status is the status of the condition.
51+
// Can be True, False, Unknown.
52+
Status corev1.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=ConditionStatus"`
53+
// Last time we probed the condition.
54+
// +optional
55+
LastProbeTime metav1.Time `json:"lastProbeTime,omitempty" protobuf:"bytes,3,opt,name=lastProbeTime"`
56+
// Last time the condition transitioned from one status to another.
57+
// +optional
58+
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
59+
// Unique, one-word, CamelCase reason for the condition's last transition.
60+
// +optional
61+
Reason string `json:"reason,omitempty" protobuf:"bytes,5,opt,name=reason"`
62+
// Human-readable message indicating details about last transition.
63+
// +optional
64+
Message string `json:"message,omitempty" protobuf:"bytes,6,opt,name=message"`
65+
}
66+
67+
// +kubebuilder:object:root=true
68+
// +kubebuilder:subresource:status
69+
70+
// NBRoutingPeer is the Schema for the nbroutingpeers API.
71+
type NBRoutingPeer struct {
72+
metav1.TypeMeta `json:",inline"`
73+
metav1.ObjectMeta `json:"metadata,omitempty"`
74+
75+
Spec NBRoutingPeerSpec `json:"spec,omitempty"`
76+
Status NBRoutingPeerStatus `json:"status,omitempty"`
77+
}
78+
79+
// +kubebuilder:object:root=true
80+
81+
// NBRoutingPeerList contains a list of NBRoutingPeer.
82+
type NBRoutingPeerList struct {
83+
metav1.TypeMeta `json:",inline"`
84+
metav1.ListMeta `json:"metadata,omitempty"`
85+
Items []NBRoutingPeer `json:"items"`
86+
}
87+
88+
func init() {
89+
SchemeBuilder.Register(&NBRoutingPeer{}, &NBRoutingPeerList{})
90+
}

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)