sigs.k8s.io/cluster-api-provider-aws@v1.5.5/bootstrap/eks/api/v1beta1/eksconfig_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  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  
    22  	clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
    23  )
    24  
    25  // EKSConfigSpec defines the desired state of Amazon EKS Bootstrap Configuration.
    26  type EKSConfigSpec struct {
    27  	// KubeletExtraArgs passes the specified kubelet args into the Amazon EKS machine bootstrap script
    28  	// +optional
    29  	KubeletExtraArgs map[string]string `json:"kubeletExtraArgs,omitempty"`
    30  	// ContainerRuntime specify the container runtime to use when bootstrapping EKS.
    31  	// +optional
    32  	ContainerRuntime *string `json:"containerRuntime,omitempty"`
    33  	//  DNSClusterIP overrides the IP address to use for DNS queries within the cluster.
    34  	// +optional
    35  	DNSClusterIP *string `json:"dnsClusterIP,omitempty"`
    36  	// DockerConfigJson is used for the contents of the /etc/docker/daemon.json file. Useful if you want a custom config differing from the default one in the AMI.
    37  	// This is expected to be a json string.
    38  	// +optional
    39  	DockerConfigJSON *string `json:"dockerConfigJson,omitempty"`
    40  	// APIRetryAttempts is the number of retry attempts for AWS API call.
    41  	// +optional
    42  	APIRetryAttempts *int `json:"apiRetryAttempts,omitempty"`
    43  	// PauseContainer allows customization of the pause container to use.
    44  	// +optional
    45  	PauseContainer *PauseContainer `json:"pauseContainer,omitempty"`
    46  	// UseMaxPods  sets --max-pods for the kubelet when true.
    47  	// +optional
    48  	UseMaxPods *bool `json:"useMaxPods,omitempty"`
    49  
    50  	// TODO(richardcase): this can be uncommented when we get to the ipv6/dual-stack implementation
    51  	// ServiceIPV6Cidr is the ipv6 cidr range of the cluster. If this is specified then
    52  	// the ip family will be set to ipv6.
    53  	// +optional
    54  	// ServiceIPV6Cidr *string `json:"serviceIPV6Cidr,omitempty"`
    55  }
    56  
    57  // PauseContainer contains details of pause container.
    58  type PauseContainer struct {
    59  	//  AccountNumber is the AWS account number to pull the pause container from.
    60  	AccountNumber string `json:"accountNumber"`
    61  	// Version is the tag of the pause container to use.
    62  	Version string `json:"version"`
    63  }
    64  
    65  // EKSConfigStatus defines the observed state of the Amazon EKS Bootstrap Configuration.
    66  type EKSConfigStatus struct {
    67  	// Ready indicates the BootstrapData secret is ready to be consumed
    68  	Ready bool `json:"ready,omitempty"`
    69  
    70  	// DataSecretName is the name of the secret that stores the bootstrap data script.
    71  	// +optional
    72  	DataSecretName *string `json:"dataSecretName,omitempty"`
    73  
    74  	// FailureReason will be set on non-retryable errors
    75  	// +optional
    76  	FailureReason string `json:"failureReason,omitempty"`
    77  
    78  	// FailureMessage will be set on non-retryable errors
    79  	// +optional
    80  	FailureMessage string `json:"failureMessage,omitempty"`
    81  
    82  	// ObservedGeneration is the latest generation observed by the controller.
    83  	// +optional
    84  	ObservedGeneration int64 `json:"observedGeneration,omitempty"`
    85  
    86  	// Conditions defines current service state of the EKSConfig.
    87  	// +optional
    88  	Conditions clusterv1.Conditions `json:"conditions,omitempty"`
    89  }
    90  
    91  // +kubebuilder:object:root=true
    92  // +kubebuilder:resource:path=eksconfigs,scope=Namespaced,categories=cluster-api,shortName=eksc
    93  // +kubebuilder:storageversion
    94  // +kubebuilder:subresource:status
    95  // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Bootstrap configuration is ready"
    96  // +kubebuilder:printcolumn:name="DataSecretName",type="string",JSONPath=".status.dataSecretName",description="Name of Secret containing bootstrap data"
    97  
    98  // EKSConfig is the schema for the Amazon EKS Machine Bootstrap Configuration API.
    99  type EKSConfig struct {
   100  	metav1.TypeMeta   `json:",inline"`
   101  	metav1.ObjectMeta `json:"metadata,omitempty"`
   102  
   103  	Spec   EKSConfigSpec   `json:"spec,omitempty"`
   104  	Status EKSConfigStatus `json:"status,omitempty"`
   105  }
   106  
   107  // GetConditions returns the observations of the operational state of the EKSConfig resource.
   108  func (r *EKSConfig) GetConditions() clusterv1.Conditions {
   109  	return r.Status.Conditions
   110  }
   111  
   112  // SetConditions sets the underlying service state of the EKSConfig to the predescribed clusterv1.Conditions.
   113  func (r *EKSConfig) SetConditions(conditions clusterv1.Conditions) {
   114  	r.Status.Conditions = conditions
   115  }
   116  
   117  // +kubebuilder:object:root=true
   118  
   119  // EKSConfigList contains a list of EKSConfig.
   120  type EKSConfigList struct {
   121  	metav1.TypeMeta `json:",inline"`
   122  	metav1.ListMeta `json:"metadata,omitempty"`
   123  	Items           []EKSConfig `json:"items"`
   124  }
   125  
   126  func init() {
   127  	SchemeBuilder.Register(&EKSConfig{}, &EKSConfigList{})
   128  }