@@ -23,24 +23,30 @@ import (
23
23
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24
24
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
25
25
26
- // EBGPStatus defines the observed state of EBGP
27
- type EBGPStatus struct {
26
+ // BGPStatus defines the observed state of BGP
27
+ type BGPStatus struct {
28
28
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
29
29
// Important: Run "make" to regenerate code after modifying this file
30
30
31
- Status string `json:"status,omitempty"`
32
- Message string `json:"message,omitempty"`
31
+ Status string `json:"status,omitempty"`
32
+ State string `json:"state,omitempty"`
33
+ ModifiedDate metav1.Time `json:"modified,omitempty"`
34
+ Message string `json:"message,omitempty"`
35
+ BGPState string `json:"bgpstate,omitempty"`
36
+ PortState string `json:"portstate,omitempty"`
37
+ TerminateOnSwitch string `json:"terminateOnSwitch,omitempty"`
38
+ VLANID string `json:"vlanID,omitempty"`
33
39
}
34
40
35
- // EBGPSpec defines the desired state of EBGP
36
- type EBGPSpec struct {
41
+ // BGPSpec defines the desired state of BGP
42
+ type BGPSpec struct {
37
43
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
38
44
// Important: Run "make" to regenerate code after modifying this file
39
45
40
- Site string `json:"site"`
41
- Softgate string `json:"softgate"`
42
- NeighborAS int `json:"neighborAs"`
43
- Transport EBGPTransport `json:"transport"`
46
+ Site string `json:"site"`
47
+ Softgate string `json:"softgate,omitempty "`
48
+ NeighborAS int `json:"neighborAs"`
49
+ Transport BGPTransport `json:"transport"`
44
50
45
51
// +kubebuilder:validation:Pattern=`(^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[12]\d|3[0-2]))?$)|(^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f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 -50,26 +56,32 @@ type EBGPSpec struct {
50
56
Description string `json:"description,omitempty"`
51
57
52
58
// +kubebuilder:validation:Enum=enabled;disabled
53
- State string `json:"state,omitempty"`
54
- TerminateOnSwitch bool `json:"terminateOnSwitch,omitempty"`
55
- Multihop EBGPMultihop `json:"multihop,omitempty"`
56
- BGPPassword string `json:"bgpPassword,omitempty"`
57
- AllowAsIn int `json:"allowAsIn,omitempty"`
58
- DefaultOriginate bool `json:"defaultOriginate,omitempty"`
59
- PrefixInboundMax int `json:"prefixInboundMax,omitempty"`
60
- InboundRouteMap string `json:"inboundRouteMap,omitempty"`
61
- OutboundRouteMap string `json:"outboundRouteMap,omitempty"`
62
- LocalPreference int `json:"localPreference,omitempty"`
63
- Weight int `json:"weight,omitempty"`
64
- PrependInbound int `json:"prependInbound,omitempty"`
65
- PrependOutbound int `json:"prependOutbound,omitempty"`
66
- PrefixListInbound []string `json:"prefixListInbound,omitempty"`
67
- PrefixListOutbound []string `json:"prefixListOutbound,omitempty"`
68
- SendBGPCommunity []string `json:"sendBGPCommunity,omitempty"`
59
+ State string `json:"state,omitempty"`
60
+ TerminateOnSwitch BGPTerminateOnSwitch `json:"terminateOnSwitch,omitempty"`
61
+ Multihop BGPMultihop `json:"multihop,omitempty"`
62
+ BGPPassword string `json:"bgpPassword,omitempty"`
63
+ AllowAsIn int `json:"allowAsIn,omitempty"`
64
+ DefaultOriginate bool `json:"defaultOriginate,omitempty"`
65
+ PrefixInboundMax int `json:"prefixInboundMax,omitempty"`
66
+ InboundRouteMap string `json:"inboundRouteMap,omitempty"`
67
+ OutboundRouteMap string `json:"outboundRouteMap,omitempty"`
68
+ LocalPreference int `json:"localPreference,omitempty"`
69
+ Weight int `json:"weight,omitempty"`
70
+ PrependInbound int `json:"prependInbound,omitempty"`
71
+ PrependOutbound int `json:"prependOutbound,omitempty"`
72
+ PrefixListInbound []string `json:"prefixListInbound,omitempty"`
73
+ PrefixListOutbound []string `json:"prefixListOutbound,omitempty"`
74
+ SendBGPCommunity []string `json:"sendBGPCommunity,omitempty"`
69
75
}
70
76
71
- // EBGPMultihop .
72
- type EBGPMultihop struct {
77
+ // BGPTerminateOnSwitch .
78
+ type BGPTerminateOnSwitch struct {
79
+ Enabled bool `json:"enabled"`
80
+ SwitchName string `json:"switchName,omitempty"`
81
+ }
82
+
83
+ // BGPMultihop .
84
+ type BGPMultihop struct {
73
85
// +kubebuilder:validation:Pattern=`(^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\/([0-9]|[12]\d|3[0-2]))?$)|(^((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?(\/([1-9]|[1-5][0-9]|6[0-4]))?$)`
74
86
NeighborAddress string `json:"neighborAddress,omitempty"`
75
87
@@ -78,36 +90,47 @@ type EBGPMultihop struct {
78
90
Hops int `json:"hops,omitempty"`
79
91
}
80
92
81
- // EBGPTransport .
82
- type EBGPTransport struct {
93
+ // BGPTransport .
94
+ type BGPTransport struct {
83
95
// +kubebuilder:validation:Enum=port;vnet
84
96
Type string `json:"type,omitempty"`
85
- // +kubebuilder:validation:Pattern=`(^[a-zA-Z0-9]+@[a-zA-Z0-9-]+$)|(^[a-z0- 9]([-a-z0- 9]*[a-z0-9])?(\.[a-z0- 9]([-a-z0- 9]*[a-z0 -9])?)*$)`
97
+ // +kubebuilder:validation:Pattern=`(^[a-zA-Z0-9]+@[a-zA-Z0-9-]+$)|(^[a-zA-Z0- 9]([-a-zA-Z0- 9]*[a-z0-9])?(\.[a-zA-Z0- 9]([-a-zA-Z0- 9]*[a-zA-Z0 -9])?)*$)`
86
98
Name string `json:"name"`
87
99
VlanID int `json:"vlanId,omitempty"`
88
100
}
89
101
90
102
// +kubebuilder:object:root=true
91
103
// +kubebuilder:subresource:status
92
-
93
- // EBGP is the Schema for the ebgps API
94
- type EBGP struct {
104
+ // +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state`
105
+ // +kubebuilder:printcolumn:name="BGP State",type=string,JSONPath=`.status.bgpstate`
106
+ // +kubebuilder:printcolumn:name="Port State",type=string,JSONPath=`.status.portstate`
107
+ // +kubebuilder:printcolumn:name="NeighborAS",type=string,JSONPath=`.spec.neighborAs`
108
+ // +kubebuilder:printcolumn:name="Local address",type=string,JSONPath=`.spec.localIP`
109
+ // +kubebuilder:printcolumn:name="Remote address",type=string,JSONPath=`.spec.remoteIP`
110
+ // +kubebuilder:printcolumn:name="Port",type=string,JSONPath=`.spec.transport.name`,priority=1
111
+ // +kubebuilder:printcolumn:name="VLANID",type=string,JSONPath=`.status.vlanID`,priority=1
112
+ // +kubebuilder:printcolumn:name="TerminatedOn",type=string,JSONPath=`.status.terminateOnSwitch`,priority=1
113
+ // +kubebuilder:printcolumn:name="Modified",type=date,JSONPath=`.status.modified`,priority=1
114
+ // +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
115
+
116
+ // BGP is the Schema for the bgps API
117
+ type BGP struct {
95
118
metav1.TypeMeta `json:",inline"`
96
119
metav1.ObjectMeta `json:"metadata,omitempty"`
97
120
98
- Spec EBGPSpec `json:"spec,omitempty"`
99
- Status EBGPStatus `json:"status,omitempty"`
121
+ Spec BGPSpec `json:"spec,omitempty"`
122
+ Status BGPStatus `json:"status,omitempty"`
100
123
}
101
124
102
125
// +kubebuilder:object:root=true
103
126
104
- // EBGPList contains a list of EBGP
105
- type EBGPList struct {
127
+ // BGPList contains a list of BGP
128
+ type BGPList struct {
106
129
metav1.TypeMeta `json:",inline"`
107
130
metav1.ListMeta `json:"metadata,omitempty"`
108
- Items []EBGP `json:"items"`
131
+ Items []BGP `json:"items"`
109
132
}
110
133
111
134
func init () {
112
- SchemeBuilder .Register (& EBGP {}, & EBGPList {})
135
+ SchemeBuilder .Register (& BGP {}, & BGPList {})
113
136
}
0 commit comments