/
bgppeer_types.go
124 lines (96 loc) · 3.67 KB
/
bgppeer_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
/*
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 v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
type MatchExpression struct {
Key string `json:"key"`
Operator string `json:"operator"`
// +kubebuilder:validation:MinItems:=1
Values []string `json:"values"`
}
type NodeSelector struct {
// +optional
MatchLabels map[string]string `json:"matchLabels,omitempty"`
// +optional
MatchExpressions []MatchExpression `json:"matchExpressions,omitempty"`
}
// BGPPeerSpec defines the desired state of Peer.
type BGPPeerSpec struct {
// AS number to use for the local end of the session.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=4294967295
MyASN uint32 `json:"myASN"`
// AS number to expect from the remote end of the session.
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=4294967295
ASN uint32 `json:"peerASN"`
// Address to dial when establishing the session.
Address string `json:"peerAddress"`
// Source address to use when establishing the session.
// +optional
SrcAddress string `json:"sourceAddress,omitempty"`
// Port to dial when establishing the session.
// +optional
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=16384
Port uint16 `json:"peerPort,omitempty"`
// Requested BGP hold time, per RFC4271.
// +optional
HoldTime metav1.Duration `json:"holdTime,omitempty"`
// Requested BGP keepalive time, per RFC4271.
// +optional
KeepaliveTime metav1.Duration `json:"keepaliveTime,omitempty"`
// BGP router ID to advertise to the peer
// +optional
RouterID string `json:"routerID,omitempty"`
// Only connect to this peer on nodes that match one of these
// selectors.
// +optional
NodeSelectors []NodeSelector `json:"nodeSelectors,omitempty"`
// Authentication password for routers enforcing TCP MD5 authenticated sessions
// +optional
Password string `json:"password,omitempty"`
BFDProfile string `json:"bfdProfile,omitempty"`
// EBGP peer is multi-hops away
EBGPMultiHop bool `json:"ebgpMultiHop,omitempty"`
// Add future BGP configuration here
}
// BGPPeerStatus defines the observed state of Peer.
type BGPPeerStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
}
//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="Address",type=string,JSONPath=`.spec.peerAddress`
//+kubebuilder:printcolumn:name="ASN",type=string,JSONPath=`.spec.peerASN`
//+kubebuilder:printcolumn:name="BFD Profile",type=string,JSONPath=`.spec.bfdProfile`
//+kubebuilder:printcolumn:name="Multi Hops",type=string,JSONPath=`.spec.ebgpMultiHop`
// BGPPeer is the Schema for the peers API.
type BGPPeer struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec BGPPeerSpec `json:"spec,omitempty"`
Status BGPPeerStatus `json:"status,omitempty"`
}
//+kubebuilder:object:root=true
// PeerList contains a list of Peer.
type BGPPeerList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BGPPeer `json:"items"`
}
func init() {
SchemeBuilder.Register(&BGPPeer{}, &BGPPeerList{})
}