|
| 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 | + corev1 "k8s.io/api/core/v1" |
| 21 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 22 | +) |
| 23 | + |
| 24 | +// ALBTargetControlConfigSpec defines the desired state of ALBTargetControlConfig |
| 25 | +type ALBTargetControlConfigSpec struct { |
| 26 | + // Image specifies the container image for the ALB target control agent sidecar. |
| 27 | + // The agent is available as a Docker image at: public.ecr.aws/aws-elb/target-optimizer/target-control-agent:latest |
| 28 | + // +kubebuilder:validation:Required |
| 29 | + Image string `json:"image"` |
| 30 | + |
| 31 | + // DataAddress specifies the socket (IP:port) where the agent receives application traffic from the load balancer. |
| 32 | + // The port in this socket is the application traffic port you configure for your target group. |
| 33 | + // +kubebuilder:validation:Required |
| 34 | + // +kubebuilder:validation:Pattern=`^.+:[0-9]+$` |
| 35 | + DataAddress string `json:"dataAddress"` |
| 36 | + |
| 37 | + // ControlAddress specifies the socket (IP:port) where the load balancer exchanges management traffic with agents. |
| 38 | + // The port in the socket is the target control port you configure for the target group. |
| 39 | + // +kubebuilder:validation:Required |
| 40 | + // +kubebuilder:validation:Pattern=`^.+:[0-9]+$` |
| 41 | + ControlAddress string `json:"controlAddress"` |
| 42 | + |
| 43 | + // DestinationAddress specifies the socket (IP:port) where the agent proxies application traffic. |
| 44 | + // Your application should be listening on this port. |
| 45 | + // +kubebuilder:validation:Required |
| 46 | + // +kubebuilder:validation:Pattern=`^.+:[0-9]+$` |
| 47 | + DestinationAddress string `json:"destinationAddress"` |
| 48 | + |
| 49 | + // MaxConcurrency specifies the maximum number of concurrent requests that the target receives from the load balancer. |
| 50 | + // +kubebuilder:validation:Minimum=0 |
| 51 | + // +kubebuilder:validation:Maximum=1000 |
| 52 | + // +kubebuilder:default=1 |
| 53 | + MaxConcurrency int32 `json:"maxConcurrency,omitempty"` |
| 54 | + |
| 55 | + // TLSCertPath specifies the location of the TLS certificate that the agent provides to the load balancer during TLS handshake. |
| 56 | + // By default, the agent generates a self-signed certificate in-memory. |
| 57 | + // +optional |
| 58 | + TLSCertPath *string `json:"tlsCertPath,omitempty"` |
| 59 | + |
| 60 | + // TLSKeyPath specifies the location of the private key corresponding to the TLS certificate that the agent provides to the load balancer during TLS handshake. |
| 61 | + // By default, the agent generates a private key in memory. |
| 62 | + // +optional |
| 63 | + TLSKeyPath *string `json:"tlsKeyPath,omitempty"` |
| 64 | + |
| 65 | + // TLSSecurityPolicy specifies the ELB security policy that you configure for the target group. |
| 66 | + // +optional |
| 67 | + TLSSecurityPolicy *string `json:"tlsSecurityPolicy,omitempty"` |
| 68 | + |
| 69 | + // ProtocolVersion specifies the protocol through which the load balancer communicates with the agent. |
| 70 | + // Possible values are HTTP1, HTTP2, GRPC. |
| 71 | + // +optional |
| 72 | + // +kubebuilder:validation:Enum=HTTP1;HTTP2;GRPC |
| 73 | + ProtocolVersion *string `json:"protocolVersion,omitempty"` |
| 74 | + |
| 75 | + // RustLog specifies the log level of the agent process. The agent software is written in Rust. |
| 76 | + // Possible values are debug, info, and error. |
| 77 | + // +optional |
| 78 | + // +kubebuilder:validation:Enum=debug;info;error |
| 79 | + RustLog *string `json:"rustLog,omitempty"` |
| 80 | + |
| 81 | + // Resources specifies the resource requirements for the ALB target control agent sidecar |
| 82 | + // +optional |
| 83 | + Resources *corev1.ResourceRequirements `json:"resources,omitempty"` |
| 84 | +} |
| 85 | + |
| 86 | +// +kubebuilder:object:root=true |
| 87 | +// +kubebuilder:object:generate=true |
| 88 | +// +kubebuilder:resource:scope=Namespaced |
| 89 | +// +kubebuilder:storageversion |
| 90 | +// +kubebuilder:printcolumn:name="IMAGE",type="string",JSONPath=".spec.image",description="The ALB target control agent sidecar image" |
| 91 | +// +kubebuilder:printcolumn:name="DESTINATION",type="string",JSONPath=".spec.destinationAddress",description="Application destination address" |
| 92 | +// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp" |
| 93 | + |
| 94 | +// ALBTargetControlConfig is the Schema for the albtargetcontrolconfigs API |
| 95 | +type ALBTargetControlConfig struct { |
| 96 | + metav1.TypeMeta `json:",inline"` |
| 97 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 98 | + |
| 99 | + Spec ALBTargetControlConfigSpec `json:"spec,omitempty"` |
| 100 | +} |
| 101 | + |
| 102 | +// +kubebuilder:object:root=true |
| 103 | + |
| 104 | +// ALBTargetControlConfigList contains a list of ALBTargetControlConfig |
| 105 | +type ALBTargetControlConfigList struct { |
| 106 | + metav1.TypeMeta `json:",inline"` |
| 107 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 108 | + Items []ALBTargetControlConfig `json:"items"` |
| 109 | +} |
| 110 | + |
| 111 | +func init() { |
| 112 | + SchemeBuilder.Register(&ALBTargetControlConfig{}, &ALBTargetControlConfigList{}) |
| 113 | +} |
0 commit comments