sigs.k8s.io/cluster-api-provider-azure@v1.14.3/exp/api/v1beta1/azuremachinepoolmachine_types.go (about) 1 /* 2 Copyright 2020 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 corev1 "k8s.io/api/core/v1" 21 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 22 infrav1 "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1" 23 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" 24 "sigs.k8s.io/cluster-api/errors" 25 ) 26 27 const ( 28 // AzureMachinePoolMachineFinalizer is used to ensure deletion of dependencies (nodes, infra). 29 AzureMachinePoolMachineFinalizer = "azuremachinepoolmachine.infrastructure.cluster.x-k8s.io" 30 31 // AzureMachinePoolMachineKind indicates the kind of an AzureMachinePoolMachine. 32 AzureMachinePoolMachineKind = "AzureMachinePoolMachine" 33 ) 34 35 type ( 36 37 // AzureMachinePoolMachineSpec defines the desired state of AzureMachinePoolMachine. 38 AzureMachinePoolMachineSpec struct { 39 // ProviderID is the identification ID of the Virtual Machine Scale Set 40 ProviderID string `json:"providerID"` 41 42 // InstanceID is the identification of the Machine Instance within the VMSS 43 // +optional 44 InstanceID string `json:"instanceID,omitempty"` 45 } 46 47 // AzureMachinePoolMachineStatus defines the observed state of AzureMachinePoolMachine. 48 AzureMachinePoolMachineStatus struct { 49 // NodeRef will point to the corresponding Node if it exists. 50 // +optional 51 NodeRef *corev1.ObjectReference `json:"nodeRef,omitempty"` 52 53 // Version defines the Kubernetes version for the VM Instance 54 // +optional 55 Version string `json:"version"` 56 57 // ProvisioningState is the provisioning state of the Azure virtual machine instance. 58 // +optional 59 ProvisioningState *infrav1.ProvisioningState `json:"provisioningState"` 60 61 // InstanceName is the name of the Machine Instance within the VMSS 62 // +optional 63 InstanceName string `json:"instanceName"` 64 65 // FailureReason will be set in the event that there is a terminal problem 66 // reconciling the MachinePool machine and will contain a succinct value suitable 67 // for machine interpretation. 68 // 69 // Any transient errors that occur during the reconciliation of MachinePools 70 // can be added as events to the MachinePool object and/or logged in the 71 // controller's output. 72 // +optional 73 FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` 74 75 // FailureMessage will be set in the event that there is a terminal problem 76 // reconciling the MachinePool and will contain a more verbose string suitable 77 // for logging and human consumption. 78 // 79 // Any transient errors that occur during the reconciliation of MachinePools 80 // can be added as events to the MachinePool object and/or logged in the 81 // controller's output. 82 // +optional 83 FailureMessage *string `json:"failureMessage,omitempty"` 84 85 // Conditions defines current service state of the AzureMachinePool. 86 // +optional 87 Conditions clusterv1.Conditions `json:"conditions,omitempty"` 88 89 // LongRunningOperationStates saves the state for Azure long running operations so they can be continued on the 90 // next reconciliation loop. 91 // +optional 92 LongRunningOperationStates infrav1.Futures `json:"longRunningOperationStates,omitempty"` 93 94 // LatestModelApplied indicates the instance is running the most up-to-date VMSS model. A VMSS model describes 95 // the image version the VM is running. If the instance is not running the latest model, it means the instance 96 // may not be running the version of Kubernetes the Machine Pool has specified and needs to be updated. 97 // +optional 98 LatestModelApplied bool `json:"latestModelApplied,omitempty"` 99 100 // Ready is true when the provider resource is ready. 101 // +optional 102 Ready bool `json:"ready"` 103 } 104 105 // +kubebuilder:object:root=true 106 // +kubebuilder:subresource:status 107 // +kubebuilder:resource:path=azuremachinepoolmachines,scope=Namespaced,categories=cluster-api,shortName=ampm 108 // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".status.version",description="Kubernetes version" 109 // +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="Flag indicating infrastructure is successfully provisioned" 110 // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.provisioningState",description="Azure VMSS VM provisioning state" 111 // +kubebuilder:printcolumn:name="Cluster",type="string",priority=1,JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this AzureMachinePoolMachine belongs" 112 // +kubebuilder:printcolumn:name="VMSS VM ID",type="string",priority=1,JSONPath=".spec.providerID",description="Azure VMSS VM ID" 113 // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of this AzureMachinePoolMachine" 114 // +kubebuilder:storageversion 115 116 // AzureMachinePoolMachine is the Schema for the azuremachinepoolmachines API. 117 AzureMachinePoolMachine struct { 118 metav1.TypeMeta `json:",inline"` 119 metav1.ObjectMeta `json:"metadata,omitempty"` 120 121 Spec AzureMachinePoolMachineSpec `json:"spec,omitempty"` 122 Status AzureMachinePoolMachineStatus `json:"status,omitempty"` 123 } 124 125 // +kubebuilder:object:root=true 126 127 // AzureMachinePoolMachineList contains a list of AzureMachinePoolMachines. 128 AzureMachinePoolMachineList struct { 129 metav1.TypeMeta `json:",inline"` 130 metav1.ListMeta `json:"metadata,omitempty"` 131 Items []AzureMachinePoolMachine `json:"items"` 132 } 133 ) 134 135 // GetConditions returns the list of conditions for an AzureMachinePool API object. 136 func (ampm *AzureMachinePoolMachine) GetConditions() clusterv1.Conditions { 137 return ampm.Status.Conditions 138 } 139 140 // SetConditions will set the given conditions on an AzureMachinePool object. 141 func (ampm *AzureMachinePoolMachine) SetConditions(conditions clusterv1.Conditions) { 142 ampm.Status.Conditions = conditions 143 } 144 145 // GetFutures returns the list of long running operation states for an AzureMachinePoolMachine API object. 146 func (ampm *AzureMachinePoolMachine) GetFutures() infrav1.Futures { 147 return ampm.Status.LongRunningOperationStates 148 } 149 150 // SetFutures will set the given long running operation states on an AzureMachinePoolMachine object. 151 func (ampm *AzureMachinePoolMachine) SetFutures(futures infrav1.Futures) { 152 ampm.Status.LongRunningOperationStates = futures 153 } 154 155 func init() { 156 SchemeBuilder.Register(&AzureMachinePoolMachine{}, &AzureMachinePoolMachineList{}) 157 }