|
| 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 | +} |
0 commit comments