| 
 | 1 | +/*  | 
 | 2 | +
  | 
 | 3 | +
  | 
 | 4 | +Licensed under the Apache License, Version 2.0 (the "License");  | 
 | 5 | +you may not use this file except in compliance with the License.  | 
 | 6 | +You may obtain a copy of the License at  | 
 | 7 | +
  | 
 | 8 | +    http://www.apache.org/licenses/LICENSE-2.0  | 
 | 9 | +
  | 
 | 10 | +Unless required by applicable law or agreed to in writing, software  | 
 | 11 | +distributed under the License is distributed on an "AS IS" BASIS,  | 
 | 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  | 
 | 13 | +See the License for the specific language governing permissions and  | 
 | 14 | +limitations under the License.  | 
 | 15 | +*/  | 
 | 16 | + | 
 | 17 | +package v1beta1  | 
 | 18 | + | 
 | 19 | +import (  | 
 | 20 | +	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"  | 
 | 21 | +	"k8s.io/apimachinery/pkg/util/intstr"  | 
 | 22 | +)  | 
 | 23 | + | 
 | 24 | +// +kubebuilder:validation:Enum=STANDARD;CUSTOM_ROUTING  | 
 | 25 | +// AcceleratorType is the type of Global Accelerator.  | 
 | 26 | +type AcceleratorType string  | 
 | 27 | + | 
 | 28 | +const (  | 
 | 29 | +	AcceleratorTypeStandard      AcceleratorType = "STANDARD"  | 
 | 30 | +	AcceleratorTypeCustomRouting AcceleratorType = "CUSTOM_ROUTING"  | 
 | 31 | +)  | 
 | 32 | + | 
 | 33 | +// +kubebuilder:validation:Enum=TCP;UDP  | 
 | 34 | +// GlobalAcceleratorProtocol defines the protocol for Global Accelerator listeners.  | 
 | 35 | +type GlobalAcceleratorProtocol string  | 
 | 36 | + | 
 | 37 | +const (  | 
 | 38 | +	GlobalAcceleratorProtocolTCP GlobalAcceleratorProtocol = "TCP"  | 
 | 39 | +	GlobalAcceleratorProtocolUDP GlobalAcceleratorProtocol = "UDP"  | 
 | 40 | +)  | 
 | 41 | + | 
 | 42 | +// +kubebuilder:validation:Enum=SOURCE_IP;NONE  | 
 | 43 | +// ClientAffinityType defines the client affinity for Global Accelerator listeners.  | 
 | 44 | +type ClientAffinityType string  | 
 | 45 | + | 
 | 46 | +const (  | 
 | 47 | +	ClientAffinitySourceIP ClientAffinityType = "SOURCE_IP"  | 
 | 48 | +	ClientAffinityNone     ClientAffinityType = "NONE"  | 
 | 49 | +)  | 
 | 50 | + | 
 | 51 | +// PortRange defines the port range for Global Accelerator listeners.  | 
 | 52 | +type PortRange struct {  | 
 | 53 | +	// FromPort is the first port in the range of ports.  | 
 | 54 | +	FromPort int32 `json:"fromPort"`  | 
 | 55 | + | 
 | 56 | +	// ToPort is the last port in the range of ports.  | 
 | 57 | +	ToPort int32 `json:"toPort"`  | 
 | 58 | +}  | 
 | 59 | + | 
 | 60 | +// GlobalAcceleratorListener defines a listener for the Global Accelerator.  | 
 | 61 | +type GlobalAcceleratorListener struct {  | 
 | 62 | +	// Protocol is the protocol for the connections from clients to the accelerator.  | 
 | 63 | +	Protocol GlobalAcceleratorProtocol `json:"protocol"`  | 
 | 64 | + | 
 | 65 | +	// PortRanges is the list of port ranges to support for connections from clients to the accelerator.  | 
 | 66 | +	PortRanges []PortRange `json:"portRanges"`  | 
 | 67 | + | 
 | 68 | +	// ClientAffinity controls whether traffic from the same client IP is routed to the same endpoint.  | 
 | 69 | +	// +optional  | 
 | 70 | +	ClientAffinity *ClientAffinityType `json:"clientAffinity,omitempty"`  | 
 | 71 | +}  | 
 | 72 | + | 
 | 73 | +// EndpointGroup defines an endpoint group for a Global Accelerator listener.  | 
 | 74 | +type EndpointGroup struct {  | 
 | 75 | +	// Region is the AWS Region where the endpoint group is located.  | 
 | 76 | +	Region string `json:"region"`  | 
 | 77 | + | 
 | 78 | +	// TrafficDialPercentage is the percentage of traffic to send to this endpoint group.  | 
 | 79 | +	// +kubebuilder:validation:Minimum=0  | 
 | 80 | +	// +kubebuilder:validation:Maximum=100  | 
 | 81 | +	// +optional  | 
 | 82 | +	TrafficDialPercentage *int32 `json:"trafficDialPercentage,omitempty"`  | 
 | 83 | + | 
 | 84 | +	// HealthCheckIntervalSeconds is the interval in seconds between health checks.  | 
 | 85 | +	// +kubebuilder:validation:Minimum=10  | 
 | 86 | +	// +kubebuilder:validation:Maximum=30  | 
 | 87 | +	// +optional  | 
 | 88 | +	HealthCheckIntervalSeconds *int32 `json:"healthCheckIntervalSeconds,omitempty"`  | 
 | 89 | + | 
 | 90 | +	// HealthCheckPath is the path that you want to use for health checks.  | 
 | 91 | +	// +optional  | 
 | 92 | +	HealthCheckPath *string `json:"healthCheckPath,omitempty"`  | 
 | 93 | + | 
 | 94 | +	// ThresholdCount is the number of consecutive health check failures required before considering the endpoint unhealthy.  | 
 | 95 | +	// +kubebuilder:validation:Minimum=1  | 
 | 96 | +	// +kubebuilder:validation:Maximum=10  | 
 | 97 | +	// +optional  | 
 | 98 | +	ThresholdCount *int32 `json:"thresholdCount,omitempty"`  | 
 | 99 | + | 
 | 100 | +	// PortOverrides is a list of endpoint port overrides.  | 
 | 101 | +	// +optional  | 
 | 102 | +	PortOverrides []PortOverride `json:"portOverrides,omitempty"`  | 
 | 103 | + | 
 | 104 | +	// Endpoints is the list of endpoint configurations for this endpoint group.  | 
 | 105 | +	Endpoints []GlobalAcceleratorEndpoint `json:"endpoints"`  | 
 | 106 | +}  | 
 | 107 | + | 
 | 108 | +// PortOverride defines a port override for an endpoint group.  | 
 | 109 | +type PortOverride struct {  | 
 | 110 | +	// ListenerPort is the listener port that you want to map to a specific endpoint port.  | 
 | 111 | +	ListenerPort int32 `json:"listenerPort"`  | 
 | 112 | + | 
 | 113 | +	// EndpointPort is the endpoint port that you want traffic to be routed to.  | 
 | 114 | +	EndpointPort int32 `json:"endpointPort"`  | 
 | 115 | +}  | 
 | 116 | + | 
 | 117 | +// GlobalAcceleratorEndpoint defines an endpoint for a Global Accelerator endpoint group.  | 
 | 118 | +type GlobalAcceleratorEndpoint struct {  | 
 | 119 | +	// EndpointID is the ID of the endpoint.  | 
 | 120 | +	// For Application Load Balancers, this is the ARN.  | 
 | 121 | +	// For Network Load Balancers, this is the ARN.  | 
 | 122 | +	// For EC2 instances, this is the instance ID.  | 
 | 123 | +	// For Elastic IP addresses, this is the allocation ID.  | 
 | 124 | +	EndpointID string `json:"endpointID"`  | 
 | 125 | + | 
 | 126 | +	// Weight is used to determine the proportion of traffic that is directed to an endpoint.  | 
 | 127 | +	// +kubebuilder:validation:Minimum=0  | 
 | 128 | +	// +kubebuilder:validation:Maximum=255  | 
 | 129 | +	// +optional  | 
 | 130 | +	Weight *int32 `json:"weight,omitempty"`  | 
 | 131 | + | 
 | 132 | +	// ClientIPPreservationEnabled indicates whether client IP address preservation is enabled.  | 
 | 133 | +	// +optional  | 
 | 134 | +	ClientIPPreservationEnabled *bool `json:"clientIPPreservationEnabled,omitempty"`  | 
 | 135 | +}  | 
 | 136 | + | 
 | 137 | +// ServiceEndpointReference defines a reference to a Kubernetes Service that should be used as an endpoint.  | 
 | 138 | +type ServiceEndpointReference struct {  | 
 | 139 | +	// Name is the name of the Service.  | 
 | 140 | +	Name string `json:"name"`  | 
 | 141 | + | 
 | 142 | +	// Namespace is the namespace of the Service.  | 
 | 143 | +	// +optional  | 
 | 144 | +	Namespace *string `json:"namespace,omitempty"`  | 
 | 145 | + | 
 | 146 | +	// Port is the port of the ServicePort.  | 
 | 147 | +	Port intstr.IntOrString `json:"port"`  | 
 | 148 | + | 
 | 149 | +	// Weight is used to determine the proportion of traffic that is directed to this service endpoint.  | 
 | 150 | +	// +kubebuilder:validation:Minimum=0  | 
 | 151 | +	// +kubebuilder:validation:Maximum=255  | 
 | 152 | +	// +optional  | 
 | 153 | +	Weight *int32 `json:"weight,omitempty"`  | 
 | 154 | +}  | 
 | 155 | + | 
 | 156 | +// GlobalAcceleratorSpec defines the desired state of GlobalAccelerator  | 
 | 157 | +type GlobalAcceleratorSpec struct {  | 
 | 158 | +	// Name is the name of the Global Accelerator.  | 
 | 159 | +	// +optional  | 
 | 160 | +	Name *string `json:"name,omitempty"`  | 
 | 161 | + | 
 | 162 | +	// Type is the type of accelerator.  | 
 | 163 | +	// +optional  | 
 | 164 | +	Type *AcceleratorType `json:"type,omitempty"`  | 
 | 165 | + | 
 | 166 | +	// IPAddressType is the value for the address type.  | 
 | 167 | +	// +kubebuilder:validation:Enum=IPV4;DUAL_STACK  | 
 | 168 | +	// +optional  | 
 | 169 | +	IPAddressType *string `json:"ipAddressType,omitempty"`  | 
 | 170 | + | 
 | 171 | +	// Enabled indicates whether the accelerator is enabled.  | 
 | 172 | +	// +optional  | 
 | 173 | +	Enabled *bool `json:"enabled,omitempty"`  | 
 | 174 | + | 
 | 175 | +	// Attributes define the custom attributes to Global Accelerator.  | 
 | 176 | +	// +optional  | 
 | 177 | +	Attributes []Attribute `json:"attributes,omitempty"`  | 
 | 178 | + | 
 | 179 | +	// Tags defines list of Tags on the Global Accelerator.  | 
 | 180 | +	// +optional  | 
 | 181 | +	Tags []Tag `json:"tags,omitempty"`  | 
 | 182 | + | 
 | 183 | +	// Listeners defines the listeners for the Global Accelerator.  | 
 | 184 | +	Listeners []GlobalAcceleratorListener `json:"listeners"`  | 
 | 185 | + | 
 | 186 | +	// EndpointGroups defines the endpoint groups for the Global Accelerator listeners.  | 
 | 187 | +	EndpointGroups []EndpointGroup `json:"endpointGroups"`  | 
 | 188 | + | 
 | 189 | +	// ServiceEndpoints defines Kubernetes services that should be automatically configured as endpoints.  | 
 | 190 | +	// +optional  | 
 | 191 | +	ServiceEndpoints []ServiceEndpointReference `json:"serviceEndpoints,omitempty"`  | 
 | 192 | + | 
 | 193 | +	// IAM Role ARN to assume when calling AWS APIs.  | 
 | 194 | +	// +optional  | 
 | 195 | +	IamRoleArnToAssume *string `json:"iamRoleArnToAssume,omitempty"`  | 
 | 196 | + | 
 | 197 | +	// AssumeRoleExternalId is the external ID for assume role operations.  | 
 | 198 | +	// +optional  | 
 | 199 | +	AssumeRoleExternalId *string `json:"assumeRoleExternalId,omitempty"`  | 
 | 200 | +}  | 
 | 201 | + | 
 | 202 | +// GlobalAcceleratorStatus defines the observed state of GlobalAccelerator  | 
 | 203 | +type GlobalAcceleratorStatus struct {  | 
 | 204 | +	// The generation observed by the GlobalAccelerator controller.  | 
 | 205 | +	// +optional  | 
 | 206 | +	ObservedGeneration *int64 `json:"observedGeneration,omitempty"`  | 
 | 207 | + | 
 | 208 | +	// AcceleratorARN is the Amazon Resource Name (ARN) of the accelerator.  | 
 | 209 | +	// +optional  | 
 | 210 | +	AcceleratorARN *string `json:"acceleratorARN,omitempty"`  | 
 | 211 | + | 
 | 212 | +	// DNSName is the Domain Name System (DNS) name that Global Accelerator creates that points to your accelerator's static IP addresses.  | 
 | 213 | +	// +optional  | 
 | 214 | +	DNSName *string `json:"dnsName,omitempty"`  | 
 | 215 | + | 
 | 216 | +	// IPSets is information about the IP address type.  | 
 | 217 | +	// +optional  | 
 | 218 | +	IPSets []IPSet `json:"ipSets,omitempty"`  | 
 | 219 | + | 
 | 220 | +	// Status is the current status of the accelerator.  | 
 | 221 | +	// +optional  | 
 | 222 | +	Status *string `json:"status,omitempty"`  | 
 | 223 | + | 
 | 224 | +	// Conditions represent the current conditions of the GlobalAccelerator.  | 
 | 225 | +	// +optional  | 
 | 226 | +	Conditions []metav1.Condition `json:"conditions,omitempty"`  | 
 | 227 | +}  | 
 | 228 | + | 
 | 229 | +// IPSet contains information about the IP address type.  | 
 | 230 | +type IPSet struct {  | 
 | 231 | +	// IpFamily is the IP address version.  | 
 | 232 | +	// +optional  | 
 | 233 | +	IpFamily *string `json:"ipFamily,omitempty"`  | 
 | 234 | + | 
 | 235 | +	// IpAddresses is the array of IP addresses in the IP address set.  | 
 | 236 | +	// +optional  | 
 | 237 | +	IpAddresses []string `json:"ipAddresses,omitempty"`  | 
 | 238 | + | 
 | 239 | +	// IpAddressFamily is the types of IP addresses included in this IP set.  | 
 | 240 | +	// +optional  | 
 | 241 | +	IpAddressFamily *string `json:"ipAddressFamily,omitempty"`  | 
 | 242 | +}  | 
 | 243 | + | 
 | 244 | +// +kubebuilder:object:root=true  | 
 | 245 | +// +kubebuilder:subresource:status  | 
 | 246 | +// +kubebuilder:storageversion  | 
 | 247 | +// +kubebuilder:printcolumn:name="NAME",type="string",JSONPath=".spec.name",description="The Global Accelerator name"  | 
 | 248 | +// +kubebuilder:printcolumn:name="DNS-NAME",type="string",JSONPath=".status.dnsName",description="The Global Accelerator DNS name"  | 
 | 249 | +// +kubebuilder:printcolumn:name="TYPE",type="string",JSONPath=".spec.type",description="The Global Accelerator type"  | 
 | 250 | +// +kubebuilder:printcolumn:name="STATUS",type="string",JSONPath=".status.status",description="The Global Accelerator status"  | 
 | 251 | +// +kubebuilder:printcolumn:name="ARN",type="string",JSONPath=".status.acceleratorARN",description="The Global Accelerator ARN",priority=1  | 
 | 252 | +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"  | 
 | 253 | +// GlobalAccelerator is the Schema for the GlobalAccelerator API  | 
 | 254 | +type GlobalAccelerator struct {  | 
 | 255 | +	metav1.TypeMeta   `json:",inline"`  | 
 | 256 | +	metav1.ObjectMeta `json:"metadata,omitempty"`  | 
 | 257 | + | 
 | 258 | +	Spec   GlobalAcceleratorSpec   `json:"spec,omitempty"`  | 
 | 259 | +	Status GlobalAcceleratorStatus `json:"status,omitempty"`  | 
 | 260 | +}  | 
 | 261 | + | 
 | 262 | +// +kubebuilder:object:root=true  | 
 | 263 | + | 
 | 264 | +// GlobalAcceleratorList contains a list of GlobalAccelerator  | 
 | 265 | +type GlobalAcceleratorList struct {  | 
 | 266 | +	metav1.TypeMeta `json:",inline"`  | 
 | 267 | +	metav1.ListMeta `json:"metadata,omitempty"`  | 
 | 268 | +	Items           []GlobalAccelerator `json:"items"`  | 
 | 269 | +}  | 
 | 270 | + | 
 | 271 | +func init() {  | 
 | 272 | +	SchemeBuilder.Register(&GlobalAccelerator{}, &GlobalAcceleratorList{})  | 
 | 273 | +}  | 
0 commit comments