sigs.k8s.io/cluster-api-provider-aws@v1.5.5/exp/api/v1beta1/awsfargateprofile_types.go (about) 1 /* 2 Copyright 2021 The Kubernetes Authors. 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 "fmt" 21 22 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 23 24 infrav1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" 25 iamv1 "sigs.k8s.io/cluster-api-provider-aws/iam/api/v1beta1" 26 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 27 "sigs.k8s.io/cluster-api/errors" 28 ) 29 30 var ( 31 // DefaultEKSFargateRole is the name of the default IAM role to use for fargate 32 // profiles if no other role is supplied in the spec and if iam role creation 33 // is not enabled. The default can be created using clusterawsadm or created manually. 34 DefaultEKSFargateRole = fmt.Sprintf("eks-fargate%s", iamv1.DefaultNameSuffix) 35 ) 36 37 // FargateProfileSpec defines the desired state of FargateProfile. 38 type FargateProfileSpec struct { 39 // ClusterName is the name of the Cluster this object belongs to. 40 // +kubebuilder:validation:MinLength=1 41 ClusterName string `json:"clusterName"` 42 43 // ProfileName specifies the profile name. 44 ProfileName string `json:"profileName,omitempty"` 45 46 // SubnetIDs specifies which subnets are used for the 47 // auto scaling group of this nodegroup. 48 // +optional 49 SubnetIDs []string `json:"subnetIDs,omitempty"` 50 51 // AdditionalTags is an optional set of tags to add to AWS resources managed by the AWS provider, in addition to the 52 // ones added by default. 53 // +optional 54 AdditionalTags infrav1.Tags `json:"additionalTags,omitempty"` 55 56 // RoleName specifies the name of IAM role for this fargate pool 57 // If the role is pre-existing we will treat it as unmanaged 58 // and not delete it on deletion. If the EKSEnableIAM feature 59 // flag is true and no name is supplied then a role is created. 60 // +optional 61 RoleName string `json:"roleName,omitempty"` 62 63 // Selectors specify fargate pod selectors. 64 Selectors []FargateSelector `json:"selectors,omitempty"` 65 } 66 67 // FargateSelector specifies a selector for pods that should run on this fargate pool. 68 type FargateSelector struct { 69 // Labels specifies which pod labels this selector should match. 70 Labels map[string]string `json:"labels,omitempty"` 71 72 // Namespace specifies which namespace this selector should match. 73 Namespace string `json:"namespace,omitempty"` 74 } 75 76 // FargateProfileStatus defines the observed state of FargateProfile. 77 type FargateProfileStatus struct { 78 // Ready denotes that the FargateProfile is available. 79 // +kubebuilder:default=false 80 Ready bool `json:"ready"` 81 82 // FailureReason will be set in the event that there is a terminal problem 83 // reconciling the FargateProfile and will contain a succinct value suitable 84 // for machine interpretation. 85 // 86 // This field should not be set for transitive errors that a controller 87 // faces that are expected to be fixed automatically over 88 // time (like service outages), but instead indicate that something is 89 // fundamentally wrong with the FargateProfile's spec or the configuration of 90 // the controller, and that manual intervention is required. Examples 91 // of terminal errors would be invalid combinations of settings in the 92 // spec, values that are unsupported by the controller, or the 93 // responsible controller itself being critically misconfigured. 94 // 95 // Any transient errors that occur during the reconciliation of 96 // FargateProfiles can be added as events to the FargateProfile object 97 // and/or logged in the controller's output. 98 // +optional 99 FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` 100 101 // FailureMessage will be set in the event that there is a terminal problem 102 // reconciling the FargateProfile and will contain a more verbose string suitable 103 // for logging and human consumption. 104 // 105 // This field should not be set for transitive errors that a controller 106 // faces that are expected to be fixed automatically over 107 // time (like service outages), but instead indicate that something is 108 // fundamentally wrong with the FargateProfile's spec or the configuration of 109 // the controller, and that manual intervention is required. Examples 110 // of terminal errors would be invalid combinations of settings in the 111 // spec, values that are unsupported by the controller, or the 112 // responsible controller itself being critically misconfigured. 113 // 114 // Any transient errors that occur during the reconciliation of 115 // FargateProfiles can be added as events to the FargateProfile 116 // object and/or logged in the controller's output. 117 // +optional 118 FailureMessage *string `json:"failureMessage,omitempty"` 119 120 // Conditions defines current state of the Fargate profile. 121 // +optional 122 Conditions clusterv1.Conditions `json:"conditions,omitempty"` 123 } 124 125 // +kubebuilder:object:root=true 126 // +kubebuilder:resource:path=awsfargateprofiles,scope=Namespaced,categories=cluster-api,shortName=awsfp 127 // +kubebuilder:storageversion 128 // +kubebuilder:subresource:status 129 // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="AWSFargateProfile ready status" 130 // +kubebuilder:printcolumn:name="ProfileName",type="string",JSONPath=".spec.profileName",description="EKS Fargate profile name" 131 // +kubebuilder:printcolumn:name="FailureReason",type="string",JSONPath=".status.failureReason",description="Failure reason" 132 133 // AWSFargateProfile is the Schema for the awsfargateprofiles API. 134 type AWSFargateProfile struct { 135 metav1.TypeMeta `json:",inline"` 136 metav1.ObjectMeta `json:"metadata,omitempty"` 137 138 Spec FargateProfileSpec `json:"spec,omitempty"` 139 Status FargateProfileStatus `json:"status,omitempty"` 140 } 141 142 // GetConditions returns the observations of the operational state of the AWSFargateProfile resource. 143 func (r *AWSFargateProfile) GetConditions() clusterv1.Conditions { 144 return r.Status.Conditions 145 } 146 147 // SetConditions sets the underlying service state of the AWSFargateProfile to the predescribed clusterv1.Conditions. 148 func (r *AWSFargateProfile) SetConditions(conditions clusterv1.Conditions) { 149 r.Status.Conditions = conditions 150 } 151 152 // +kubebuilder:object:root=true 153 154 // AWSFargateProfileList contains a list of FargateProfiles. 155 type AWSFargateProfileList struct { 156 metav1.TypeMeta `json:",inline"` 157 metav1.ListMeta `json:"metadata,omitempty"` 158 Items []AWSFargateProfile `json:"items"` 159 } 160 161 func init() { 162 SchemeBuilder.Register(&AWSFargateProfile{}, &AWSFargateProfileList{}) 163 }