@@ -22,6 +22,13 @@ import (
22
22
"time"
23
23
)
24
24
25
+ const (
26
+ // DefaultAPIServerPort defines the API server port when defining a Load Balancer.
27
+ DefaultAPIServerPort = 6443
28
+ // DefaultAPIServerPortString defines the API server port as a string for convenience.
29
+ DefaultAPIServerPortString = "6443"
30
+ )
31
+
25
32
// NetworkStatus encapsulates AWS networking resources.
26
33
type NetworkStatus struct {
27
34
// SecurityGroups is a map from the role/kind of the security group to its unique name, if any.
@@ -31,57 +38,53 @@ type NetworkStatus struct {
31
38
APIServerELB LoadBalancer `json:"apiServerElb,omitempty"`
32
39
}
33
40
34
- // ElbScheme defines the scheme of a load balancer.
35
- type ElbScheme string
41
+ // ELBScheme defines the scheme of a load balancer.
42
+ type ELBScheme string
36
43
37
44
var (
38
- // ElbSchemeInternetFacing defines an internet-facing, publicly
45
+ // ELBSchemeInternetFacing defines an internet-facing, publicly
39
46
// accessible AWS ELB scheme.
40
- ElbSchemeInternetFacing = ElbScheme ("internet-facing" )
47
+ ELBSchemeInternetFacing = ELBScheme ("internet-facing" )
41
48
42
- // ElbSchemeInternal defines an internal-only facing
49
+ // ELBSchemeInternal defines an internal-only facing
43
50
// load balancer internal to an ELB.
44
- ElbSchemeInternal = ElbScheme ("internal" )
51
+ ELBSchemeInternal = ELBScheme ("internal" )
45
52
)
46
53
47
- func (e ElbScheme ) String () string {
54
+ func (e ELBScheme ) String () string {
48
55
return string (e )
49
56
}
50
57
51
- // ElbProtocol defines listener protocols for a load balancer.
52
- type ElbProtocol string
58
+ // ELBProtocol defines listener protocols for a load balancer.
59
+ type ELBProtocol string
53
60
54
- func (e ElbProtocol ) String () string {
61
+ func (e ELBProtocol ) String () string {
55
62
return string (e )
56
63
}
57
64
58
65
var (
59
- // ElbProtocolTCP defines the ELB API string representing the TCP protocol.
60
- ElbProtocolTCP = ElbProtocol ("TCP" )
61
-
62
- // ElbProtocolSSL defines the ELB API string representing the TLS protocol.
63
- ElbProtocolSSL = ElbProtocol ("SSL" )
64
-
65
- // ElbProtocolHTTP defines the ELB API string representing the HTTP protocol at L7.
66
- ElbProtocolHTTP = ElbProtocol ("HTTP" )
67
-
68
- // ElbProtocolHTTPS defines the ELB API string representing the HTTP protocol at L7.
69
- ElbProtocolHTTPS = ElbProtocol ("HTTPS" )
70
-
71
- // ElbProtocolTLS defines the NLB API string representing the TLS protocol.
72
- ElbProtocolTLS = ElbProtocol ("TLS" )
73
- // ElbProtocolUDP defines the NLB API string representing the UPD protocol.
74
- ElbProtocolUDP = ElbProtocol ("UDP" )
66
+ // ELBProtocolTCP defines the ELB API string representing the TCP protocol.
67
+ ELBProtocolTCP = ELBProtocol ("TCP" )
68
+ // ELBProtocolSSL defines the ELB API string representing the TLS protocol.
69
+ ELBProtocolSSL = ELBProtocol ("SSL" )
70
+ // ELBProtocolHTTP defines the ELB API string representing the HTTP protocol at L7.
71
+ ELBProtocolHTTP = ELBProtocol ("HTTP" )
72
+ // ELBProtocolHTTPS defines the ELB API string representing the HTTP protocol at L7.
73
+ ELBProtocolHTTPS = ELBProtocol ("HTTPS" )
74
+ // ELBProtocolTLS defines the NLB API string representing the TLS protocol.
75
+ ELBProtocolTLS = ELBProtocol ("TLS" )
76
+ // ELBProtocolUDP defines the NLB API string representing the UPD protocol.
77
+ ELBProtocolUDP = ELBProtocol ("UDP" )
75
78
)
76
79
77
80
// TargetGroupHealthCheck defines health check settings for the target group.
78
81
type TargetGroupHealthCheck struct {
79
- HealthCheckProtocol * string `json:"healthCheckProtocol ,omitempty"`
80
- HealthCheckPath * string `json:"healthCheckPath ,omitempty"`
81
- HealthCheckPort * string `json:"healthCheckPort ,omitempty"`
82
- HealthCheckIntervalSeconds * int64 `json:"healthCheckIntervalSeconds ,omitempty"`
83
- HealthCheckTimeoutSeconds * int64 `json:"healthCheckTimeoutSeconds ,omitempty"`
84
- HealthyThresholdCount * int64 `json:"healthyThresholdCount ,omitempty"`
82
+ Protocol * string `json:"protocol ,omitempty"`
83
+ Path * string `json:"path ,omitempty"`
84
+ Port * string `json:"port ,omitempty"`
85
+ IntervalSeconds * int64 `json:"intervalSeconds ,omitempty"`
86
+ TimeoutSeconds * int64 `json:"timeoutSeconds ,omitempty"`
87
+ ThresholdCount * int64 `json:"thresholdCount ,omitempty"`
85
88
}
86
89
87
90
// TargetGroupAttribute defines attribute key values for V2 Load Balancer Attributes.
@@ -95,25 +98,28 @@ var (
95
98
type LoadBalancerAttribute string
96
99
97
100
var (
98
- LoadBalancerAttributeEnableLoadBalancingCrossZone = "load_balancing.cross_zone.enabled"
99
- LoadBalancerAttributeIdleTimeTimeoutSeconds = "idle_timeout.timeout_seconds"
101
+ LoadBalancerAttributeEnableLoadBalancingCrossZone = "load_balancing.cross_zone.enabled"
102
+ LoadBalancerAttributeIdleTimeTimeoutSeconds = "idle_timeout.timeout_seconds"
103
+ LoadBalancerAttributeIdleTimeDefaultTimeoutSecondsInSeconds = "60"
100
104
)
101
105
102
106
// TargetGroupSpec specifies target group settings for a given listener.
103
107
// This is created first, and the ARN is then passed to the listener.
104
108
type TargetGroupSpec struct {
105
- Name * string `json:"name"`
106
- Port * int64 `json:"port"`
109
+ // Name of the TargetGroup. Must be unique over the same group of listeners.
110
+ Name string `json:"name"`
111
+ // Port is the exposed port
112
+ Port int64 `json:"port"`
107
113
// +kubebuilder:validation:Enum=tcp;tls;upd
108
- Protocol ElbProtocol `json:"protocol"`
109
- VpcID * string `json:"vpcId"`
114
+ Protocol ELBProtocol `json:"protocol"`
115
+ VpcID string `json:"vpcId"`
110
116
// HealthCheck is the elb health check associated with the load balancer.
111
117
HealthCheck * TargetGroupHealthCheck `json:"targetGroupHealthCheck,omitempty"`
112
118
}
113
119
114
120
// Listener defines an AWS network load balancer listener.
115
121
type Listener struct {
116
- Protocol ElbProtocol `json:"protocol"`
122
+ Protocol ELBProtocol `json:"protocol"`
117
123
Port int64 `json:"port"`
118
124
TargetGroup TargetGroupSpec `json:"targetGroup"`
119
125
}
@@ -132,7 +138,7 @@ type LoadBalancer struct {
132
138
DNSName string `json:"dnsName,omitempty"`
133
139
134
140
// Scheme is the load balancer scheme, either internet-facing or private.
135
- Scheme ElbScheme `json:"scheme,omitempty"`
141
+ Scheme ELBScheme `json:"scheme,omitempty"`
136
142
137
143
// AvailabilityZones is an array of availability zones in the VPC attached to the load balancer.
138
144
AvailabilityZones []string `json:"availabilityZones,omitempty"`
@@ -155,14 +161,14 @@ type LoadBalancer struct {
155
161
// Tags is a map of tags associated with the load balancer.
156
162
Tags map [string ]string `json:"tags,omitempty"`
157
163
158
- // V2Listeners is an array of listeners associated with the load balancer. There must be at least one.
159
- V2Listeners []Listener `json:"v2Listeners ,omitempty"`
164
+ // ELBListeners is an array of listeners associated with the load balancer. There must be at least one.
165
+ ELBListeners []Listener `json:"elbListeners ,omitempty"`
160
166
161
- // V2Attributes defines extra attributes associated with v2 load balancers.
162
- V2Attributes map [string ]* string `json:"v2Attributes ,omitempty"`
167
+ // ELBAttributes defines extra attributes associated with v2 load balancers.
168
+ ELBAttributes map [string ]* string `json:"elbAttributes ,omitempty"`
163
169
164
- // LoadBalancerType defines the type of the Load Balancer .
165
- // +kubebuilder:validation:Enum=classic;nlb ;alb;elb
170
+ // LoadBalancerType sets the type for a load balancer. The default type is classic .
171
+ // +kubebuilder:validation:Enum: =classic;elb ;alb;nlb
166
172
LoadBalancerType LoadBalancerType `json:"loadBalancerType"`
167
173
}
168
174
@@ -189,9 +195,9 @@ type ClassicELBAttributes struct {
189
195
190
196
// ClassicELBListener defines an AWS classic load balancer listener.
191
197
type ClassicELBListener struct {
192
- Protocol ElbProtocol `json:"protocol"`
198
+ Protocol ELBProtocol `json:"protocol"`
193
199
Port int64 `json:"port"`
194
- InstanceProtocol ElbProtocol `json:"instanceProtocol"`
200
+ InstanceProtocol ELBProtocol `json:"instanceProtocol"`
195
201
InstancePort int64 `json:"instancePort"`
196
202
}
197
203
0 commit comments