sigs.k8s.io/cluster-api-provider-azure@v1.17.0/api/v1alpha1/azureasomanagedmachinepool_types.go (about)

     1  /*
     2  Copyright 2024 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 v1alpha1
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  )
    22  
    23  const (
    24  	// AzureASOManagedMachinePoolKind is the kind for AzureASOManagedMachinePool.
    25  	AzureASOManagedMachinePoolKind = "AzureASOManagedMachinePool"
    26  
    27  	// ReplicasManagedByAKS is the value of the CAPI replica manager annotation that maps to the AKS built-in autoscaler.
    28  	ReplicasManagedByAKS = "aks"
    29  )
    30  
    31  // AzureASOManagedMachinePoolSpec defines the desired state of AzureASOManagedMachinePool.
    32  type AzureASOManagedMachinePoolSpec struct {
    33  	AzureASOManagedMachinePoolTemplateResourceSpec `json:",inline"`
    34  }
    35  
    36  // AzureASOManagedMachinePoolStatus defines the observed state of AzureASOManagedMachinePool.
    37  type AzureASOManagedMachinePoolStatus struct {
    38  	// Replicas is the current number of provisioned replicas. It fulfills Cluster API's machine pool
    39  	// infrastructure provider contract.
    40  	//+optional
    41  	Replicas int32 `json:"replicas"`
    42  
    43  	// Ready represents whether or not the infrastructure is ready to be used. It fulfills Cluster API's
    44  	// machine pool infrastructure provider contract.
    45  	//+optional
    46  	Ready bool `json:"ready"`
    47  
    48  	//+optional
    49  	Resources []ResourceStatus `json:"resources,omitempty"`
    50  }
    51  
    52  //+kubebuilder:object:root=true
    53  //+kubebuilder:subresource:status
    54  
    55  // AzureASOManagedMachinePool is the Schema for the azureasomanagedmachinepools API.
    56  type AzureASOManagedMachinePool struct {
    57  	metav1.TypeMeta   `json:",inline"`
    58  	metav1.ObjectMeta `json:"metadata,omitempty"`
    59  
    60  	Spec   AzureASOManagedMachinePoolSpec   `json:"spec,omitempty"`
    61  	Status AzureASOManagedMachinePoolStatus `json:"status,omitempty"`
    62  }
    63  
    64  // GetResourceStatuses returns the status of resources.
    65  func (a *AzureASOManagedMachinePool) GetResourceStatuses() []ResourceStatus {
    66  	return a.Status.Resources
    67  }
    68  
    69  // SetResourceStatuses sets the status of resources.
    70  func (a *AzureASOManagedMachinePool) SetResourceStatuses(r []ResourceStatus) {
    71  	a.Status.Resources = r
    72  }
    73  
    74  //+kubebuilder:object:root=true
    75  
    76  // AzureASOManagedMachinePoolList contains a list of AzureASOManagedMachinePool.
    77  type AzureASOManagedMachinePoolList struct {
    78  	metav1.TypeMeta `json:",inline"`
    79  	metav1.ListMeta `json:"metadata,omitempty"`
    80  	Items           []AzureASOManagedMachinePool `json:"items"`
    81  }
    82  
    83  func init() {
    84  	SchemeBuilder.Register(&AzureASOManagedMachinePool{}, &AzureASOManagedMachinePoolList{})
    85  }