@@ -29,6 +29,9 @@ type NetworkStatus struct {
29
29
30
30
// APIServerELB is the Kubernetes api server classic load balancer.
31
31
APIServerELB ClassicELB `json:"apiServerElb,omitempty"`
32
+
33
+ // APIServerLB is the Kubernetes api server load balancer.
34
+ APIServerLB LBSpec `json:"apiServerLb,omitempty"`
32
35
}
33
36
34
37
// ClassicELBScheme defines the scheme of a classic load balancer.
44
47
ClassicELBSchemeInternal = ClassicELBScheme ("internal" )
45
48
)
46
49
50
+ // LBScheme defines the scheme of a network load balancer.
51
+ type LBScheme string
52
+
53
+ var (
54
+ // LBSchemeInternal defines an internal-only facing
55
+ // load balancer internal to an ELB.
56
+ LBSchemeInternal = ClassicELBScheme ("internal" )
57
+
58
+ // LBSchemeIncorrectInternetFacing was inaccurately used to define an internet-facing LB in v0.6 releases > v0.6.6 and v0.7.0 release.
59
+ LBSchemeIncorrectInternetFacing = ClassicELBScheme ("Internet-facing" )
60
+ )
61
+
47
62
func (e ClassicELBScheme ) String () string {
48
63
return string (e )
49
64
}
69
84
ClassicELBProtocolHTTPS = ClassicELBProtocol ("HTTPS" )
70
85
)
71
86
87
+ // LBProtocol defines listener protocols for a classic load balancer.
88
+ type LBProtocol string
89
+
90
+ func (e LBProtocol ) String () string {
91
+ return string (e )
92
+ }
93
+
94
+ var (
95
+ // LBProtocolTCP defines the NLB API string representing the TCP protocol.
96
+ LBProtocolTCP = LBProtocol ("TCP" )
97
+ // LBProtocolTLS defines the NLB API string representing the TLS protocol.
98
+ LBProtocolTLS = LBProtocol ("TLS" )
99
+ // LBProtocolUDP defines the NLB API string representing the UPD protocol.
100
+ LBProtocolUDP = LBProtocol ("UDP" )
101
+ )
102
+
103
+ // TargetGroupHealthCheck defines health check settings for the target group.
104
+ // TODO: Create default values for these.
105
+ type TargetGroupHealthCheck struct {
106
+ HealthCheckProtocol * string `json:"healthCheckProtocol"`
107
+ HealthCheckPath * string `json:"healthCheckPath"`
108
+ HealthCheckIntervalSeconds * int64 `json:"healthCheckIntervalSeconds"`
109
+ HealthCheckTimeoutSeconds * int64 `json:"healthCheckTimeoutSeconds"`
110
+ HealthyThresholdCount * int64 `json:"healthyThresholdCount"`
111
+ }
112
+
113
+ // LBTargetGroupSpec specifies target group settings for a given listener.
114
+ // This is created first, and the ARN is then passed to the listener.
115
+ type LBTargetGroupSpec struct {
116
+ Name * string `json:"name"`
117
+ Port * int64 `json:"port"`
118
+ // +kubebuilder:validation:Enum=tcp;tls;upd
119
+ Protocol LBProtocol `json:"protocol"`
120
+ VpcID * string `json:"vpcId"`
121
+ // HealthCheck is the classic elb health check associated with the load balancer.
122
+ HealthCheck * TargetGroupHealthCheck `json:"targetGroupHealthCheck,omitempty"`
123
+ }
124
+
125
+ // LBListener defines an AWS network load balancer listener.
126
+ type LBListener struct {
127
+ Protocol LBProtocol `json:"protocol"`
128
+ Port int64 `json:"port"`
129
+ TargetGroup LBTargetGroupSpec `json:"targetGroup"`
130
+ }
131
+
72
132
// ClassicELB defines an AWS classic load balancer.
73
133
type ClassicELB struct {
74
134
// The name of the load balancer. It must be unique within the set of load balancers
@@ -104,6 +164,41 @@ type ClassicELB struct {
104
164
Tags map [string ]string `json:"tags,omitempty"`
105
165
}
106
166
167
+ // LBSpec defines an AWS network load balancer.
168
+ type LBSpec struct {
169
+ // ARN of the load balancer. Unlike the ClassicLB, ARN is used mostly
170
+ // to define and get it.
171
+ ARN string `json:"arn,omitempty"`
172
+ // The name of the load balancer. It must be unique within the set of load balancers
173
+ // defined in the region. It also serves as identifier.
174
+ // +optional
175
+ Name string `json:"name,omitempty"`
176
+
177
+ // Scheme is the load balancer scheme, either internet-facing or private.
178
+ Scheme LBScheme `json:"scheme,omitempty"`
179
+
180
+ // DNSName is the dns name of the load balancer.
181
+ DNSName string `json:"dnsName,omitempty"`
182
+
183
+ // AvailabilityZones is an array of availability zones in the VPC attached to the load balancer.
184
+ AvailabilityZones []string `json:"availabilityZones,omitempty"`
185
+
186
+ // SubnetIDs is an array of subnets in the VPC attached to the load balancer.
187
+ SubnetIDs []string `json:"subnetIds,omitempty"`
188
+
189
+ // SecurityGroupIDs is an array of security groups assigned to the load balancer.
190
+ SecurityGroupIDs []string `json:"securityGroupIds,omitempty"`
191
+
192
+ // Listeners is an array of classic elb listeners associated with the load balancer. There must be at least one.
193
+ Listeners []LBListener `json:"listeners,omitempty"`
194
+
195
+ // Attributes defines extra attributes associated with the load balancer.
196
+ Attributes map [string ]* string `json:"attributes,omitempty"`
197
+
198
+ // Tags is a map of tags associated with the load balancer.
199
+ Tags map [string ]string `json:"tags,omitempty"`
200
+ }
201
+
107
202
// IsUnmanaged returns true if the Classic ELB is unmanaged.
108
203
func (b * ClassicELB ) IsUnmanaged (clusterName string ) bool {
109
204
return b .Name != "" && ! Tags (b .Tags ).HasOwned (clusterName )
@@ -114,6 +209,16 @@ func (b *ClassicELB) IsManaged(clusterName string) bool {
114
209
return ! b .IsUnmanaged (clusterName )
115
210
}
116
211
212
+ // IsManaged returns true if LB is managed.
213
+ func (lb * LBSpec ) IsManaged (clusterName string ) bool {
214
+ return ! lb .IsUnmanaged (clusterName )
215
+ }
216
+
217
+ // IsUnmanaged returns true if the LB is unmanaged.
218
+ func (lb * LBSpec ) IsUnmanaged (clusterName string ) bool {
219
+ return lb .Name != "" && ! Tags (lb .Tags ).HasOwned (clusterName )
220
+ }
221
+
117
222
// ClassicELBAttributes defines extra attributes associated with a classic load balancer.
118
223
type ClassicELBAttributes struct {
119
224
// IdleTimeout is time that the connection is allowed to be idle (no data
0 commit comments