|
| 1 | +package v1beta1 |
| 2 | + |
| 3 | +import ( |
| 4 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 5 | +) |
| 6 | + |
| 7 | +// +kubebuilder:validation:Enum=internal;internet-facing |
| 8 | +// LoadBalancerScheme is the scheme of your LB |
| 9 | +// |
| 10 | +// * with `internal` scheme, the LB is only accessible within the VPC. |
| 11 | +// * with `internet-facing` scheme, the LB is accesible via the public internet. |
| 12 | +type LoadBalancerScheme string |
| 13 | + |
| 14 | +const ( |
| 15 | + LoadBalancerSchemeInternal LoadBalancerScheme = "internal" |
| 16 | + LoadBalancerSchemeInternetFacing LoadBalancerScheme = "internet-facing" |
| 17 | +) |
| 18 | + |
| 19 | +// +kubebuilder:validation:Enum=ipv4;dualstack;dualstack-without-public-ipv4 |
| 20 | +// LoadBalancerIpAddressType is the IP Address type of your LB. |
| 21 | +type LoadBalancerIpAddressType string |
| 22 | + |
| 23 | +const ( |
| 24 | + LoadBalancerIpAddressTypeIPv4 LoadBalancerIpAddressType = "ipv4" |
| 25 | + LoadBalancerIpAddressTypeDualstack LoadBalancerIpAddressType = "dualstack" |
| 26 | + LoadBalancerIpAddressTypeDualstackWithoutPublicIpv4 LoadBalancerIpAddressType = "dualstack-without-public-ipv4" |
| 27 | +) |
| 28 | + |
| 29 | +// +kubebuilder:validation:Enum=on;off |
| 30 | +// EnablePrefixForIpv6SourceNatEnum defines the enum values for EnablePrefixForIpv6SourceNat |
| 31 | +type EnablePrefixForIpv6SourceNatEnum string |
| 32 | + |
| 33 | +const ( |
| 34 | + EnablePrefixForIpv6SourceNatEnumOn EnablePrefixForIpv6SourceNatEnum = "on" |
| 35 | + EnablePrefixForIpv6SourceNatEnumOff EnablePrefixForIpv6SourceNatEnum = "off" |
| 36 | +) |
| 37 | + |
| 38 | +// LoadBalancerAttribute defines LB attribute. |
| 39 | +type LoadBalancerAttribute struct { |
| 40 | + // The key of the attribute. |
| 41 | + Key string `json:"key"` |
| 42 | + |
| 43 | + // The value of the attribute. |
| 44 | + Value string `json:"value"` |
| 45 | +} |
| 46 | + |
| 47 | +// ListenerAttribute defines listener attribute. |
| 48 | +type ListenerAttribute struct { |
| 49 | + // The key of the attribute. |
| 50 | + Key string `json:"key"` |
| 51 | + |
| 52 | + // The value of the attribute. |
| 53 | + Value string `json:"value"` |
| 54 | +} |
| 55 | + |
| 56 | +// Tag defines a AWS Tag on resources. |
| 57 | +type LoadBalancerTag struct { |
| 58 | + // The key of the tag. |
| 59 | + Key string `json:"key"` |
| 60 | + |
| 61 | + // The value of the tag. |
| 62 | + Value string `json:"value"` |
| 63 | +} |
| 64 | + |
| 65 | +// SubnetConfiguration defines the subnet settings for a Load Balancer. |
| 66 | +type SubnetConfiguration struct { |
| 67 | + // identifier name or id for the subnet |
| 68 | + Identifier string `json:"identifier"` |
| 69 | + |
| 70 | + // eipAllocation the EIP name for this subnet. |
| 71 | + // +optional |
| 72 | + EIPAllocation *string `json:"eipAllocation,omitempty"` |
| 73 | + |
| 74 | + // privateIPv4Allocation the private ipv4 address to assign to this subnet. |
| 75 | + // +optional |
| 76 | + PrivateIPv4Allocation *string `json:"privateIPv4Allocation,omitempty"` |
| 77 | + |
| 78 | + // privateIPv6Allocation the private ipv6 address to assign to this subnet. |
| 79 | + // +optional |
| 80 | + PrivateIPv6Allocation *string `json:"privateIPv6Allocation,omitempty"` |
| 81 | +} |
| 82 | + |
| 83 | +// +kubebuilder:validation:Enum=HTTP1Only;HTTP2Only;HTTP2Optional;HTTP2Preferred;None |
| 84 | +// ALPNPolicy defines the ALPN policy configuration for TLS listeners forwarding to TLS target groups |
| 85 | +// HTTP1Only Negotiate only HTTP/1.*. The ALPN preference list is http/1.1, http/1.0. |
| 86 | +// HTTP2Only Negotiate only HTTP/2. The ALPN preference list is h2. |
| 87 | +// HTTP2Optional Prefer HTTP/1.* over HTTP/2 (which can be useful for HTTP/2 testing). The ALPN preference list is http/1.1, http/1.0, h2. |
| 88 | +// HTTP2Preferred Prefer HTTP/2 over HTTP/1.*. The ALPN preference list is h2, http/1.1, http/1.0. |
| 89 | +// None Do not negotiate ALPN. This is the default. |
| 90 | +type ALPNPolicy string |
| 91 | + |
| 92 | +// Supported ALPN policies |
| 93 | +const ( |
| 94 | + ALPNPolicyNone ALPNPolicy = "None" |
| 95 | + ALPNPolicyHTTP1Only ALPNPolicy = "HTTP1Only" |
| 96 | + ALPNPolicyHTTP2Only ALPNPolicy = "HTTP2Only" |
| 97 | + ALPNPolicyHTTP2Optional ALPNPolicy = "HTTP2Optional" |
| 98 | + ALPNPolicyHTTP2Preferred ALPNPolicy = "HTTP2Preferred" |
| 99 | +) |
| 100 | + |
| 101 | +// +kubebuilder:validation:Enum=on;off |
| 102 | +type AdvertiseTrustStoreCaNamesEnum string |
| 103 | + |
| 104 | +// Enum values for AdvertiseTrustStoreCaNamesEnum |
| 105 | +const ( |
| 106 | + AdvertiseTrustStoreCaNamesEnumOn AdvertiseTrustStoreCaNamesEnum = "on" |
| 107 | + AdvertiseTrustStoreCaNamesEnumOff AdvertiseTrustStoreCaNamesEnum = "off" |
| 108 | +) |
| 109 | + |
| 110 | +// +kubebuilder:validation:Enum=off;passthrough;verify |
| 111 | +// MutualAuthenticationMode mTLS mode for mutual TLS authentication config for listener |
| 112 | +type MutualAuthenticationMode string |
| 113 | + |
| 114 | +// Supported mTLS modes |
| 115 | +const ( |
| 116 | + MutualAuthenticationOffMode MutualAuthenticationMode = "off" |
| 117 | + MutualAuthenticationPassthroughMode MutualAuthenticationMode = "passthrough" |
| 118 | + MutualAuthenticationVerifyMode MutualAuthenticationMode = "verify" |
| 119 | +) |
| 120 | + |
| 121 | +// Information about the mutual authentication attributes of a listener. |
| 122 | +type MutualAuthenticationAttributes struct { |
| 123 | + |
| 124 | + // Indicates whether trust store CA certificate names are advertised. |
| 125 | + // +optional |
| 126 | + AdvertiseTrustStoreCaNames *AdvertiseTrustStoreCaNamesEnum `json:"advertiseTrustStoreCaNames,omitempty"` |
| 127 | + |
| 128 | + // Indicates whether expired client certificates are ignored. |
| 129 | + // +optional |
| 130 | + IgnoreClientCertificateExpiry *bool `json:"ignoreClientCertificateExpiry,omitempty"` |
| 131 | + |
| 132 | + // The client certificate handling method. Options are off , passthrough or verify |
| 133 | + Mode MutualAuthenticationMode `json:"mode"` |
| 134 | + |
| 135 | + // The Name or ARN of the trust store. |
| 136 | + // +optional |
| 137 | + TrustStore *string `json:"trustStore,omitempty"` |
| 138 | +} |
| 139 | + |
| 140 | +// +kubebuilder:validation:Pattern="^(HTTP|HTTPS|TLS|TCP|UDP)?:(6553[0-5]|655[0-2]\\d|65[0-4]\\d{2}|6[0-4]\\d{3}|[1-5]\\d{4}|[1-9]\\d{0,3})?$" |
| 141 | +type ProtocolPort string |
| 142 | +type ListenerConfiguration struct { |
| 143 | + // protocolPort is identifier for the listener on load balancer. It should be of the form PROTOCOL:PORT |
| 144 | + ProtocolPort ProtocolPort `json:"protocolPort"` |
| 145 | + |
| 146 | + // TODO: Add validation in admission webhook to make it required for secure protocols |
| 147 | + // defaultCertificate the cert arn to be used by default. |
| 148 | + DefaultCertificate *string `json:"defaultCertificate,omitempty"` |
| 149 | + |
| 150 | + // certificates is the list of other certificates to add to the listener. |
| 151 | + // +optional |
| 152 | + Certificates []*string `json:"certificates,omitempty"` |
| 153 | + |
| 154 | + // sslPolicy is the security policy that defines which protocols and ciphers are supported for secure listeners [HTTPS or TLS listener]. |
| 155 | + SslPolicy *string `json:"sslPolicy,omitempty"` |
| 156 | + |
| 157 | + // alpnPolicy an optional string that allows you to configure ALPN policies on your Load Balancer |
| 158 | + // +optional |
| 159 | + ALPNPolicy *ALPNPolicy `json:"alpnPolicy,omitempty"` |
| 160 | + |
| 161 | + // mutualAuthentication defines the mutual authentication configuration information. |
| 162 | + // +optional |
| 163 | + MutualAuthentication *MutualAuthenticationAttributes `json:"mutualAuthentication,omitempty"` |
| 164 | + |
| 165 | + // listenerAttributes defines the attributes for the listener |
| 166 | + // +optional |
| 167 | + ListenerAttributes []ListenerAttribute `json:"listenerAttributes,omitempty"` |
| 168 | +} |
| 169 | + |
| 170 | +// LoadBalancerConfigurationSpec defines the desired state of LoadBalancerConfiguration |
| 171 | +type LoadBalancerConfigurationSpec struct { |
| 172 | + // +kubebuilder:validation:MinLength=1 |
| 173 | + // +kubebuilder:validation:MaxLength=32 |
| 174 | + // loadBalancerName defines the name of the LB to provision. If unspecified, it will be automatically generated. |
| 175 | + // +optional |
| 176 | + LoadBalancerName *string `json:"loadBalancerName,omitempty"` |
| 177 | + |
| 178 | + // scheme defines the type of LB to provision. If unspecified, it will be automatically inferred. |
| 179 | + // +optional |
| 180 | + Scheme *LoadBalancerScheme `json:"scheme,omitempty"` |
| 181 | + |
| 182 | + // loadBalancerIPType defines what kind of load balancer to provision (ipv4, dual stack) |
| 183 | + // +optional |
| 184 | + IpAddressType *LoadBalancerIpAddressType `json:"ipAddressType,omitempty"` |
| 185 | + |
| 186 | + // enablePrefixForIpv6SourceNat indicates whether to use an IPv6 prefix from each subnet for source NAT for Network Load Balancers with UDP listeners. |
| 187 | + // +optional |
| 188 | + EnablePrefixForIpv6SourceNat *EnablePrefixForIpv6SourceNatEnum `json:"enablePrefixForIpv6SourceNat,omitempty"` |
| 189 | + |
| 190 | + // enforceSecurityGroupInboundRulesOnPrivateLinkTraffic Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink. |
| 191 | + // +optional |
| 192 | + EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic *string `json:"enforceSecurityGroupInboundRulesOnPrivateLinkTraffic,omitempty"` |
| 193 | + |
| 194 | + // customerOwnedIpv4Pool is the ID of the customer-owned address for Application Load Balancers on Outposts pool. |
| 195 | + // +optional |
| 196 | + CustomerOwnedIpv4Pool *string `json:"customerOwnedIpv4Pool,omitempty"` |
| 197 | + |
| 198 | + // loadBalancerSubnets is an optional list of subnet configurations to be used in the LB |
| 199 | + // +optional |
| 200 | + LoadBalancerSubnets *[]SubnetConfiguration `json:"loadBalancerSubnets,omitempty"` |
| 201 | + |
| 202 | + // listenerConfigurations is an optional list of configurations for each listener on LB |
| 203 | + // +optional |
| 204 | + ListenerConfigurations *[]ListenerConfiguration `json:"listenerConfigurations,omitempty"` |
| 205 | + |
| 206 | + // securityGroups an optional list of security group ids or names to apply to the LB |
| 207 | + // +optional |
| 208 | + SecurityGroups *[]string `json:"securityGroups,omitempty"` |
| 209 | + |
| 210 | + // securityGroupPrefixes an optional list of prefixes that are allowed to access the LB. |
| 211 | + // +optional |
| 212 | + SecurityGroupPrefixes *[]string `json:"securityGroupPrefixes,omitempty"` |
| 213 | + |
| 214 | + // sourceRanges an optional list of CIDRs that are allowed to access the LB. |
| 215 | + // +optional |
| 216 | + SourceRanges *[]string `json:"sourceRanges,omitempty"` |
| 217 | + |
| 218 | + // vpcId is the ID of the VPC for the load balancer. |
| 219 | + // +optional |
| 220 | + VpcId *string `json:"vpcId,omitempty"` |
| 221 | + |
| 222 | + // LoadBalancerAttributes defines the attribute of LB |
| 223 | + // +optional |
| 224 | + LoadBalancerAttributes []LoadBalancerAttribute `json:"loadBalancerAttributes,omitempty"` |
| 225 | + |
| 226 | + // Tags defines list of Tags on LB. |
| 227 | + // +optional |
| 228 | + Tags []LoadBalancerTag `json:"tags,omitempty"` |
| 229 | +} |
| 230 | + |
| 231 | +// TODO -- these can be used to set what generation the gateway is currently on to track progress on reconcile. |
| 232 | + |
| 233 | +// LoadBalancerConfigurationStatus defines the observed state of TargetGroupBinding |
| 234 | +type LoadBalancerConfigurationStatus struct { |
| 235 | + // The generation of the Gateway Configuration attached to the Gateway object. |
| 236 | + // +optional |
| 237 | + ObservedGatewayConfigurationGeneration *int64 `json:"observedGatewayConfigurationGeneration,omitempty"` |
| 238 | + // The generation of the Gateway Configuration attached to the GatewayClass object. |
| 239 | + // +optional |
| 240 | + ObservedGatewayClassConfigurationGeneration *int64 `json:"observedGatewayClassConfigurationGeneration,omitempty"` |
| 241 | +} |
| 242 | + |
| 243 | +// +kubebuilder:object:root=true |
| 244 | +// +kubebuilder:subresource:status |
| 245 | +// +kubebuilder:storageversion |
| 246 | +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" |
| 247 | +// LoadBalancerConfiguration is the Schema for the LoadBalancerConfiguration API |
| 248 | +type LoadBalancerConfiguration struct { |
| 249 | + metav1.TypeMeta `json:",inline"` |
| 250 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 251 | + |
| 252 | + Spec LoadBalancerConfigurationSpec `json:"spec,omitempty"` |
| 253 | + Status LoadBalancerConfigurationStatus `json:"status,omitempty"` |
| 254 | +} |
| 255 | + |
| 256 | +// +kubebuilder:object:root=true |
| 257 | + |
| 258 | +// LoadBalancerConfigurationList contains a list of LoadBalancerConfiguration |
| 259 | +type LoadBalancerConfigurationList struct { |
| 260 | + metav1.TypeMeta `json:",inline"` |
| 261 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 262 | + Items []LoadBalancerConfiguration `json:"items"` |
| 263 | +} |
| 264 | + |
| 265 | +func init() { |
| 266 | + SchemeBuilder.Register(&LoadBalancerConfiguration{}, &LoadBalancerConfigurationList{}) |
| 267 | +} |
0 commit comments