Skip to content

Commit c5fa378

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

36 files changed

+3374
-31
lines changed

PROJECT

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,39 @@ 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+
webhooks:
54+
validation: true
55+
webhookVersion: v1
56+
- api:
57+
crdVersion: v1
58+
namespaced: true
59+
controller: true
60+
domain: netbird.io
61+
kind: NBGroup
62+
path: github.com/netbirdio/kubernetes-operator/api/v1
63+
version: v1
64+
webhooks:
65+
validation: true
66+
webhookVersion: v1
3267
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/nbresource_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+
// 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+
}
15+
16+
// NBResourceStatus defines the observed state of NBResource.
17+
type NBResourceStatus struct {
18+
// +optional
19+
NetworkResourceID *string `json:"networkResourceID"`
20+
}
21+
22+
// +kubebuilder:object:root=true
23+
// +kubebuilder:subresource:status
24+
25+
// NBResource is the Schema for the nbresources API.
26+
type NBResource struct {
27+
metav1.TypeMeta `json:",inline"`
28+
metav1.ObjectMeta `json:"metadata,omitempty"`
29+
30+
Spec NBResourceSpec `json:"spec,omitempty"`
31+
Status NBResourceStatus `json:"status,omitempty"`
32+
}
33+
34+
// +kubebuilder:object:root=true
35+
36+
// NBResourceList contains a list of NBResource.
37+
type NBResourceList struct {
38+
metav1.TypeMeta `json:",inline"`
39+
metav1.ListMeta `json:"metadata,omitempty"`
40+
Items []NBResource `json:"items"`
41+
}
42+
43+
func init() {
44+
SchemeBuilder.Register(&NBResource{}, &NBResourceList{})
45+
}

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)