diff --git a/Makefile b/Makefile index 4fa59340..428d68f7 100644 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ export PATH := $(TOOLS_BIN_DIR):$(PATH) OUTPUT_BASE := --output-base=$(ROOT_DIR) # the current cluster API version -CAPI_VERSION := v1.10.3 +CAPI_VERSION := v1.11.1 # Binaries. GO_INSTALL = ./scripts/go_install.sh @@ -74,11 +74,11 @@ CLUSTERCTL_VER := $(CAPI_VERSION) CLUSTERCTL_BIN := clusterctl CLUSTERCTL := $(TOOLS_BIN_DIR)/$(CLUSTERCTL_BIN)-$(CLUSTERCTL_VER) -CONTROLLER_GEN_VER := v0.17.2 +CONTROLLER_GEN_VER := v0.19.0 CONTROLLER_GEN_BIN := controller-gen CONTROLLER_GEN := $(TOOLS_BIN_DIR)/$(CONTROLLER_GEN_BIN)-$(CONTROLLER_GEN_VER) -CONVERSION_GEN_VER := v0.30.0 +CONVERSION_GEN_VER := v0.34.0 CONVERSION_GEN_BIN := conversion-gen CONVERSION_GEN := $(TOOLS_BIN_DIR)/$(CONVERSION_GEN_BIN)-$(CONVERSION_GEN_VER) @@ -86,12 +86,12 @@ ENVSUBST_VER := v2.0.0-20210730161058-179042472c46 ENVSUBST_BIN := envsubst ENVSUBST := $(TOOLS_BIN_DIR)/$(ENVSUBST_BIN)-$(ENVSUBST_VER) -GOLANGCI_LINT_VER := v2.2.2 +GOLANGCI_LINT_VER := v2.4.0 GOLANGCI_LINT_BIN := golangci-lint GOLANGCI_LINT := $(TOOLS_BIN_DIR)/$(GOLANGCI_LINT_BIN)-$(GOLANGCI_LINT_VER) GOLANGCI_LINT_PKG := github.com/golangci/golangci-lint/v2/cmd/golangci-lint -KUSTOMIZE_VER := v5.6.0 +KUSTOMIZE_VER := v5.7.0 KUSTOMIZE_BIN := kustomize KUSTOMIZE := $(TOOLS_BIN_DIR)/$(KUSTOMIZE_BIN)-$(KUSTOMIZE_VER) @@ -103,7 +103,7 @@ RELEASE_NOTES_VER := v0.12.0 RELEASE_NOTES_BIN := release-notes RELEASE_NOTES := $(TOOLS_BIN_DIR)/$(RELEASE_NOTES_BIN)-$(RELEASE_NOTES_VER) -GO_APIDIFF_VER := v0.8.2 +GO_APIDIFF_VER := v0.8.3 GO_APIDIFF_BIN := go-apidiff GO_APIDIFF := $(TOOLS_BIN_DIR)/$(GO_APIDIFF_BIN) @@ -111,7 +111,7 @@ GINKGO_VER := v2.19.0 GINKGO_BIN := ginkgo GINKGO := $(TOOLS_BIN_DIR)/$(GINKGO_BIN)-$(GINKGO_VER) -KUBECTL_VER := v1.31.0 +KUBECTL_VER := v1.32.6 KUBECTL_BIN := kubectl KUBECTL := $(TOOLS_BIN_DIR)/$(KUBECTL_BIN)-$(KUBECTL_VER) @@ -123,7 +123,7 @@ SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST # # Kubebuilder # -export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.26.0 +export KUBEBUILDER_ENVTEST_KUBERNETES_VERSION ?= 1.32.6 export KUBEBUILDER_CONTROLPLANE_START_TIMEOUT ?= 60s export KUBEBUILDER_CONTROLPLANE_STOP_TIMEOUT ?= 60s @@ -132,7 +132,7 @@ KUBEBUILDER_ASSETS ?= $(shell $(SETUP_ENVTEST) use --use-env -p path $(KUBEBUILD # Version MAJOR_VER ?= 1 MINOR_VER ?= 1 -PATCH_VER ?= 21 +PATCH_VER ?= 23 # Define Docker related variables. Releases should modify and double check these vars. REGISTRY ?= mocimages.azurecr.io @@ -292,13 +292,13 @@ generate: ## Generate code generate-go: $(CONTROLLER_GEN) $(MOCKGEN) $(CONVERSION_GEN) ## Runs Go related generate targets go generate ./... $(CONTROLLER_GEN) \ - paths=./api/v1beta1 \ + paths=./api/v1beta2 \ object:headerFile=./hack/boilerplate/boilerplate.generatego.txt .PHONY: generate-manifests generate-manifests: $(CONTROLLER_GEN) ## Generate manifests e.g. CRD, RBAC etc. $(CONTROLLER_GEN) \ - paths=./api/v1beta1 \ + paths=./api/v1beta2 \ crd:crdVersions=v1 \ rbac:roleName=manager-role \ output:crd:dir=$(CRD_ROOT) \ diff --git a/PROJECT b/PROJECT index c98b53a5..129c958f 100644 --- a/PROJECT +++ b/PROJECT @@ -46,4 +46,19 @@ resources: - group: infrastructure kind: AzureStackHCILoadBalancer version: v1beta1 +- group: infrastructure + kind: AzureStackHCICluster + version: v1beta2 +- group: infrastructure + kind: AzureStackHCIMachine + version: v1beta2 +- group: infrastructure + kind: AzureStackHCIMachineTemplate + version: v1beta2 +- group: infrastructure + kind: AzureStackHCIVirtualMachine + version: v1beta2 +- group: infrastructure + kind: AzureStackHCILoadBalancer + version: v1beta2 version: "3" diff --git a/api/v1beta1/azurestackhcicluster_types.go b/api/v1beta1/azurestackhcicluster_types.go index b02b06f5..c534ce09 100644 --- a/api/v1beta1/azurestackhcicluster_types.go +++ b/api/v1beta1/azurestackhcicluster_types.go @@ -19,7 +19,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" ) const ( diff --git a/api/v1beta1/azurestackhciloadbalancer_types.go b/api/v1beta1/azurestackhciloadbalancer_types.go index 80deba4a..bf8afbc9 100644 --- a/api/v1beta1/azurestackhciloadbalancer_types.go +++ b/api/v1beta1/azurestackhciloadbalancer_types.go @@ -19,7 +19,7 @@ package v1beta1 import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" "sigs.k8s.io/cluster-api/errors" ) diff --git a/api/v1beta1/azurestackhcimachine_types.go b/api/v1beta1/azurestackhcimachine_types.go index dcbcccc5..731a7cfa 100644 --- a/api/v1beta1/azurestackhcimachine_types.go +++ b/api/v1beta1/azurestackhcimachine_types.go @@ -20,7 +20,7 @@ package v1beta1 import ( v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" "sigs.k8s.io/cluster-api/errors" ) diff --git a/api/v1beta1/azurestackhcivirtualmachine_types.go b/api/v1beta1/azurestackhcivirtualmachine_types.go index 923b3108..cea8805b 100644 --- a/api/v1beta1/azurestackhcivirtualmachine_types.go +++ b/api/v1beta1/azurestackhcivirtualmachine_types.go @@ -20,7 +20,7 @@ package v1beta1 import ( v1core "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" "sigs.k8s.io/cluster-api/errors" ) diff --git a/api/v1beta1/conditions_consts.go b/api/v1beta1/conditions_consts.go index ea60e82c..c26f0b94 100644 --- a/api/v1beta1/conditions_consts.go +++ b/api/v1beta1/conditions_consts.go @@ -17,7 +17,7 @@ limitations under the License. package v1beta1 -import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" +import clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1" // Conditions and condition Reasons for the AzureStackHCIVirtualMachine object diff --git a/api/v1beta1/zz_generated.deepcopy.go b/api/v1beta1/zz_generated.deepcopy.go index 6404f2cb..03e6d87d 100644 --- a/api/v1beta1/zz_generated.deepcopy.go +++ b/api/v1beta1/zz_generated.deepcopy.go @@ -24,7 +24,7 @@ package v1beta1 import ( "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" - apiv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1" + corev1beta1 "sigs.k8s.io/cluster-api/api/core/v1beta1" "sigs.k8s.io/cluster-api/errors" ) @@ -145,7 +145,7 @@ func (in *AzureStackHCIClusterStatus) DeepCopyInto(out *AzureStackHCIClusterStat in.Bastion.DeepCopyInto(&out.Bastion) if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) + *out = make(corev1beta1.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -337,7 +337,7 @@ func (in *AzureStackHCILoadBalancerStatus) DeepCopyInto(out *AzureStackHCILoadBa *out = *in if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) + *out = make(corev1beta1.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -494,7 +494,7 @@ func (in *AzureStackHCIMachineStatus) DeepCopyInto(out *AzureStackHCIMachineStat } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) + *out = make(corev1beta1.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -759,7 +759,7 @@ func (in *AzureStackHCIVirtualMachineStatus) DeepCopyInto(out *AzureStackHCIVirt } if in.Conditions != nil { in, out := &in.Conditions, &out.Conditions - *out = make(apiv1beta1.Conditions, len(*in)) + *out = make(corev1beta1.Conditions, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } diff --git a/api/v1beta2/azurestackhcicluster_conversion.go b/api/v1beta2/azurestackhcicluster_conversion.go new file mode 100644 index 00000000..9d72d92e --- /dev/null +++ b/api/v1beta2/azurestackhcicluster_conversion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Hub marks AzureStackHCICluster as a conversion hub. +func (*AzureStackHCICluster) Hub() {} + +// Hub marks AzureStackHCIClusterList as a conversion hub. +func (*AzureStackHCIClusterList) Hub() {} diff --git a/api/v1beta2/azurestackhcicluster_types.go b/api/v1beta2/azurestackhcicluster_types.go new file mode 100644 index 00000000..5f3d77fd --- /dev/null +++ b/api/v1beta2/azurestackhcicluster_types.go @@ -0,0 +1,132 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +const ( + // ClusterFinalizer allows ReconcileAzureStackHCICluster to clean up Azure resources associated with AzureStackHCICluster before + // removing it from the apiserver. + ClusterFinalizer = "azurestackhcicluster.infrastructure.cluster.x-k8s.io" +) + +// AzureStackHCIClusterSpec defines the desired state of AzureStackHCICluster +type AzureStackHCIClusterSpec struct { + // NetworkSpec encapsulates all things related to Azure network. + NetworkSpec NetworkSpec `json:"networkSpec,omitempty"` + + ResourceGroup string `json:"resourceGroup"` + + Location string `json:"location"` + + // AzureStackHCILoadBalancer is used to declare the AzureStackHCILoadBalancerSpec if a LoadBalancer is desired for the AzureStackHCICluster. + AzureStackHCILoadBalancer *AzureStackHCILoadBalancerSpec `json:"azureStackHCILoadBalancer,omitempty"` + + // ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + // +optional + ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"` + + // Version indicates the desired Kubernetes version of the cluster. + Version *string `json:"version"` + + // Management is true when the cluster is a Management Cluster. + Management bool `json:"management,omitempty"` +} + +// AzureStackHCIClusterStatus defines the observed state of AzureStackHCICluster +type AzureStackHCIClusterStatus struct { + Bastion VM `json:"bastion,omitempty"` + + // Phase represents the current phase of cluster actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase string `json:"phase,omitempty"` + + // Conditions defines current service state of the AzureStackHCICluster. + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // Initialization provides observations of the Cluster initialization process. + // NOTE: fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning. + // The value of those fields is never updated after provisioning is completed. + // Use conditions to monitor the operational state of the Cluster's BootstrapSecret. + // +optional + Initialization *clusterv1.ClusterInitializationStatus `json:"initialization,omitempty"` +} + +// SetTypedPhase sets the Phase field to the string representation of AzureStackHCIClusterPhase. +func (c *AzureStackHCIClusterStatus) SetTypedPhase(p AzureStackHCIClusterPhase) { + c.Phase = string(p) +} + +// GetTypedPhase attempts to parse the Phase field and return +// the typed AzureStackHCIClusterPhase representation as described in `types.go`. +func (c *AzureStackHCIClusterStatus) GetTypedPhase() AzureStackHCIClusterPhase { + switch phase := AzureStackHCIClusterPhase(c.Phase); phase { + case + AzureStackHCIClusterPhasePending, + AzureStackHCIClusterPhaseProvisioning, + AzureStackHCIClusterPhaseProvisioned, + AzureStackHCIClusterPhaseDeleting, + AzureStackHCIClusterPhaseFailed: + return phase + default: + return AzureStackHCIClusterPhaseUnknown + } +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=azurestackhciclusters,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="AzureStackHCICluster status such as Pending/Provisioning/Provisioned/Deleting/Failed" + +// AzureStackHCICluster is the Schema for the azurestackhciclusters API +type AzureStackHCICluster struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCIClusterSpec `json:"spec,omitempty"` + Status AzureStackHCIClusterStatus `json:"status,omitempty"` +} + +// GetConditions returns the list of conditions for AzureStackHCICluster. +func (c *AzureStackHCICluster) GetConditions() []metav1.Condition { + return c.Status.Conditions +} + +// SetConditions sets the conditions for AzureStackHCICluster. +func (c *AzureStackHCICluster) SetConditions(conditions []metav1.Condition) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// AzureStackHCIClusterList contains a list of AzureStackHCICluster +type AzureStackHCIClusterList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCICluster `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCICluster{}, &AzureStackHCIClusterList{}) +} diff --git a/api/v1beta2/azurestackhcicluster_webhook.go b/api/v1beta2/azurestackhcicluster_webhook.go new file mode 100644 index 00000000..a8355c54 --- /dev/null +++ b/api/v1beta2/azurestackhcicluster_webhook.go @@ -0,0 +1,28 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *AzureStackHCICluster) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/api/v1beta2/azurestackhciclustertemplate_types.go b/api/v1beta2/azurestackhciclustertemplate_types.go new file mode 100644 index 00000000..df8a8410 --- /dev/null +++ b/api/v1beta2/azurestackhciclustertemplate_types.go @@ -0,0 +1,55 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AzureStackHCIClusterTemplateSpec defines the desired state of AzureStackHCIClusterTemplate +type AzureStackHCIClusterTemplateSpec struct { + Template AzureStackHCIClusterTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true + +// AzureStackHCIClusterTemplate is the Schema for the azurestackhciclustertemplates API +type AzureStackHCIClusterTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCIClusterTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// AzureStackHCIClusterTemplateList contains a list of AzureStackHCIClusterTemplate +type AzureStackHCIClusterTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCIClusterTemplate `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCIClusterTemplate{}, &AzureStackHCIClusterTemplateList{}) +} + +// AzureStackHCIClusterTemplateResource describes the data needed to create an AzureStackHCICluster from a template +type AzureStackHCIClusterTemplateResource struct { + Spec AzureStackHCIClusterSpec `json:"spec"` +} diff --git a/api/v1beta2/azurestackhciloadbalancer_conversion.go b/api/v1beta2/azurestackhciloadbalancer_conversion.go new file mode 100644 index 00000000..ebfb1732 --- /dev/null +++ b/api/v1beta2/azurestackhciloadbalancer_conversion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Hub marks AzureStackHCILoadBalancer as a conversion hub. +func (*AzureStackHCILoadBalancer) Hub() {} + +// Hub marks AzureStackHCILoadBalancerList as a conversion hub. +func (*AzureStackHCILoadBalancerList) Hub() {} diff --git a/api/v1beta2/azurestackhciloadbalancer_types.go b/api/v1beta2/azurestackhciloadbalancer_types.go new file mode 100644 index 00000000..d29ce474 --- /dev/null +++ b/api/v1beta2/azurestackhciloadbalancer_types.go @@ -0,0 +1,190 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/cluster-api/errors" +) + +const ( + // AzureStackHCILoadBalancerFinalizer allows ReconcileLoadBalancer to clean up the load balancer resources before removing it from the apiserver. + AzureStackHCILoadBalancerFinalizer = "azurestackhciloadbalancer.infrastructure.cluster.x-k8s.io" +) + +type AzureStackHCILoadBalancerSpec struct { + SSHPublicKey string `json:"sshPublicKey"` + Image Image `json:"image"` + VMSize string `json:"vmSize"` + + // +optional + StorageContainer string `json:"storageContainer"` + + // Number of desired loadbalancer machines. Defaults to 1. + // This is a pointer to distinguish between explicit zero and not specified. + // +optional + // +kubebuilder:default=1 + Replicas *int32 `json:"replicas,omitempty"` +} + +type AzureStackHCILoadBalancerStatus struct { + // +optional + Ready bool `json:"ready,omitempty"` + + // Total number of non-terminated replicas for this loadbalancer + // +optional + Replicas int32 `json:"replicas,omitempty"` + + // Total number of ready (service connected) replicas for this loadbalancer + // +optional + ReadyReplicas int32 `json:"readyReplicas,omitempty"` + + // Total number of failed replicas for this loadbalancer. + // +optional + FailedReplicas int32 `json:"failedReplicas,omitempty"` + + // Address is the IP address of the load balancer. + // +optional + Address string `json:"address,omitempty"` + + // Port is the port of the azureStackHCIloadbalancers frontend. + Port int32 `json:"port,omitempty"` + + // Phase represents the current phase of loadbalancer actuation. + // E.g. Pending, Running, Terminating, Failed etc. + // +optional + Phase string `json:"phase,omitempty"` + + // Conditions defines current service state of the AzureStackHCILoadBalancer. + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` + + // ErrorReason will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a succinct value suitable + // for machine interpretation. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorReason *errors.MachineStatusError `json:"errorReason,omitempty"` + + // ErrorMessage will be set in the event that there is a terminal problem + // reconciling the Machine and will contain a more verbose string suitable + // for logging and human consumption. + // + // This field should not be set for transitive errors that a controller + // faces that are expected to be fixed automatically over + // time (like service outages), but instead indicate that something is + // fundamentally wrong with the Machine's spec or the configuration of + // the controller, and that manual intervention is required. Examples + // of terminal errors would be invalid combinations of settings in the + // spec, values that are unsupported by the controller, or the + // responsible controller itself being critically misconfigured. + // + // Any transient errors that occur during the reconciliation of Machines + // can be added as events to the Machine object and/or logged in the + // controller's output. + // +optional + ErrorMessage *string `json:"errorMessage,omitempty"` + + // Selector is the label selector in string format to avoid introspection + // by clients, and is used to provide the CRD-based integration for the + // scale subresource and additional integrations for things like kubectl + // describe.. The string will be in the same format as the query-param syntax. + // More info about label selectors: http://kubernetes.io/docs/user-guide/labels#label-selectors + // +optional + Selector string `json:"selector,omitempty"` +} + +// SetTypedPhase sets the Phase field to the string representation of AzureStackHCILoadBalancerPhase +func (c *AzureStackHCILoadBalancerStatus) SetTypedPhase(p AzureStackHCILoadBalancerPhase) { + c.Phase = string(p) +} + +// GetTypedPhase attempts to parse the Phase field and return +// the typed AzureStackHCILoadBalancerPhase representation as described in `types.go`. +func (c *AzureStackHCILoadBalancerStatus) GetTypedPhase() AzureStackHCILoadBalancerPhase { + switch phase := AzureStackHCILoadBalancerPhase(c.Phase); phase { + case + AzureStackHCILoadBalancerPhasePending, + AzureStackHCILoadBalancerPhaseProvisioning, + AzureStackHCILoadBalancerPhaseProvisioned, + AzureStackHCILoadBalancerPhaseScaling, + AzureStackHCILoadBalancerPhaseUpgrading, + AzureStackHCILoadBalancerPhaseDeleting, + AzureStackHCILoadBalancerPhaseFailed: + return phase + default: + return AzureStackHCILoadBalancerPhaseUnknown + } +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=azurestackhciloadbalancers,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion +// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.selector +// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase",description="The current phase/status of the loadbalancer" +// +kubebuilder:printcolumn:name="IP",type="string",JSONPath=".status.address",description="The frontend VIP address assigned to the loadbalancer" +// +kubebuilder:printcolumn:name="Port",type="integer",JSONPath=".status.port",description="The frontend port assigned to the loadbalancer" +// +kubebuilder:printcolumn:name="Replicas",type="integer",JSONPath=".spec.replicas",description="Total number of desired machine replicas for this loadbalancer" +// +kubebuilder:printcolumn:name="Created",type="integer",JSONPath=".status.replicas",description="Total number of machine replicas created to service this loadbalancer" +// +kubebuilder:printcolumn:name="Ready",type="integer",JSONPath=".status.readyReplicas",description="Total number of machine replicas that are actively connected to the loadbalancer service" +// +kubebuilder:printcolumn:name="Unavailable",type="integer",JSONPath=".status.failedReplicas",description="Total number of machine replicas that are in a failed or unavailable state" + +// AzureStackHCILoadBalancer is the Schema for the azurestackhciloadbalancers API +type AzureStackHCILoadBalancer struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCILoadBalancerSpec `json:"spec,omitempty"` + Status AzureStackHCILoadBalancerStatus `json:"status,omitempty"` +} + +// GetConditions returns the list of conditions for AzureStackHCILoadBalancer. +func (c *AzureStackHCILoadBalancer) GetConditions() []metav1.Condition { + return c.Status.Conditions +} + +// SetConditions sets the conditions for AzureStackHCILoadBalancer. +func (c *AzureStackHCILoadBalancer) SetConditions(conditions []metav1.Condition) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// AzureStackHCILoadBalancerList contains a list of AzureStackHCILoadBalancers +type AzureStackHCILoadBalancerList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCILoadBalancer `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCILoadBalancer{}, &AzureStackHCILoadBalancerList{}) +} diff --git a/api/v1beta2/azurestackhciloadbalancer_webhook.go b/api/v1beta2/azurestackhciloadbalancer_webhook.go new file mode 100644 index 00000000..1571e983 --- /dev/null +++ b/api/v1beta2/azurestackhciloadbalancer_webhook.go @@ -0,0 +1,28 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *AzureStackHCILoadBalancer) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/api/v1beta2/azurestackhcimachine_conversion.go b/api/v1beta2/azurestackhcimachine_conversion.go new file mode 100644 index 00000000..c43cd215 --- /dev/null +++ b/api/v1beta2/azurestackhcimachine_conversion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Hub marks AzureStackHCIMachine as a conversion hub. +func (*AzureStackHCIMachine) Hub() {} + +// Hub marks AzureStackHCIMachineList as a conversion hub. +func (*AzureStackHCIMachineList) Hub() {} diff --git a/api/v1beta2/azurestackhcimachine_types.go b/api/v1beta2/azurestackhcimachine_types.go new file mode 100644 index 00000000..82dc5cb6 --- /dev/null +++ b/api/v1beta2/azurestackhcimachine_types.go @@ -0,0 +1,124 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" +) + +const ( + // MachineFinalizer allows ReconcileAzureStackHCIMachine to clean up Azure resources associated with AzureStackHCIMachine before + // removing it from the apiserver. + MachineFinalizer = "azurestackhcimachine.infrastructure.cluster.x-k8s.io" +) + +// AzureStackHCIMachineSpec defines the desired state of AzureStackHCIMachine +type AzureStackHCIMachineSpec struct { + // ProviderID is the unique identifier as specified by the cloud provider. + // +optional + ProviderID *string `json:"providerID,omitempty"` + + VMSize string `json:"vmSize"` + + AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` + + Image Image `json:"image,omitempty"` + + OSDisk OSDisk `json:"osDisk,omitempty"` + + Location string `json:"location"` + + SSHPublicKey string `json:"sshPublicKey"` + + // +optional + StorageContainer string `json:"storageContainer"` + + GpuCount int32 `json:"gpuCount,omitempty"` + + // AllocatePublicIP allows the ability to create dynamic public ips for machines where this value is true. + // +optional + AllocatePublicIP bool `json:"allocatePublicIP,omitempty"` + + AdditionalSSHKeys []string `json:"additionalSSHKeys,omitempty"` + + // +optional + NetworkInterfaces NetworkInterfaces `json:"networkInterfaces,omitempty"` + + // +optional + AvailabilitySetName string `json:"availabilitySetName,omitempty"` + + // +optional + PlacementGroupName string `json:"placementGroupName,omitempty"` +} + +// AzureStackHCIMachineStatus defines the observed state of AzureStackHCIMachine +type AzureStackHCIMachineStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready"` + + // Addresses contains the Azure instance associated addresses. + Addresses []v1.NodeAddress `json:"addresses,omitempty"` + + // VMState is the provisioning state of the Azure virtual machine. + // +optional + VMState *VMState `json:"vmState,omitempty"` + + // Conditions defines current service state of the AzureStackHCIMachine. + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` + + Initialization *clusterv1.MachineInitializationStatus `json:"initialization,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=azurestackhcimachines,scope=Namespaced,categories=cluster-api +// +kubebuilder:storageversion +// +kubebuilder:subresource:status + +// AzureStackHCIMachine is the Schema for the azurestackhcimachines API +type AzureStackHCIMachine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCIMachineSpec `json:"spec,omitempty"` + Status AzureStackHCIMachineStatus `json:"status,omitempty"` +} + +func (c *AzureStackHCIMachine) GetConditions() []metav1.Condition { + return c.Status.Conditions +} + +func (c *AzureStackHCIMachine) SetConditions(conditions []metav1.Condition) { + c.Status.Conditions = conditions +} + +// +kubebuilder:object:root=true + +// AzureStackHCIMachineList contains a list of AzureStackHCIMachine +type AzureStackHCIMachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCIMachine `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCIMachine{}, &AzureStackHCIMachineList{}) +} diff --git a/api/v1beta2/azurestackhcimachine_webhook.go b/api/v1beta2/azurestackhcimachine_webhook.go new file mode 100644 index 00000000..244f7255 --- /dev/null +++ b/api/v1beta2/azurestackhcimachine_webhook.go @@ -0,0 +1,29 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +// SetupWebhookWithManager will setup and register the webhook with the controller mnager +func (m *AzureStackHCIMachine) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(m). + Complete() +} diff --git a/api/v1beta2/azurestackhcimachinetemplate_conversion.go b/api/v1beta2/azurestackhcimachinetemplate_conversion.go new file mode 100644 index 00000000..a77285a1 --- /dev/null +++ b/api/v1beta2/azurestackhcimachinetemplate_conversion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Hub marks AzureStackHCIMachineTemplate as a conversion hub. +func (*AzureStackHCIMachineTemplate) Hub() {} + +// Hub marks AzureStackHCIMachineTemplateList as a conversion hub. +func (*AzureStackHCIMachineTemplateList) Hub() {} diff --git a/api/v1beta2/azurestackhcimachinetemplate_types.go b/api/v1beta2/azurestackhcimachinetemplate_types.go new file mode 100644 index 00000000..49e4aba0 --- /dev/null +++ b/api/v1beta2/azurestackhcimachinetemplate_types.go @@ -0,0 +1,58 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AzureStackHCIMachineTemplateSpec defines the desired state of AzureStackHCIMachineTemplate +type AzureStackHCIMachineTemplateSpec struct { + Template AzureStackHCIMachineTemplateResource `json:"template"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:storageversion +// +kubebuilder:resource:path=azurestackhcimachinetemplates,scope=Namespaced,categories=cluster-api + +// AzureStackHCIMachineTemplate is the Schema for the azurestackhcimachinetemplates API +type AzureStackHCIMachineTemplate struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCIMachineTemplateSpec `json:"spec,omitempty"` +} + +// +kubebuilder:object:root=true + +// AzureStackHCIMachineTemplateList contains a list of AzureStackHCIMachineTemplate +type AzureStackHCIMachineTemplateList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCIMachineTemplate `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCIMachineTemplate{}, &AzureStackHCIMachineTemplateList{}) +} + +// AzureStackHCIMachineTemplateResource describes the data needed to create an AzureStackHCIMachine from a template +type AzureStackHCIMachineTemplateResource struct { + // Spec is the specification of the desired behavior of the machine. + Spec AzureStackHCIMachineSpec `json:"spec"` +} diff --git a/api/v1beta2/azurestackhcimachinetemplate_webhook.go b/api/v1beta2/azurestackhcimachinetemplate_webhook.go new file mode 100644 index 00000000..2bd56e48 --- /dev/null +++ b/api/v1beta2/azurestackhcimachinetemplate_webhook.go @@ -0,0 +1,28 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *AzureStackHCIMachineTemplate) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/api/v1beta2/azurestackhcivirtualmachine_conversion.go b/api/v1beta2/azurestackhcivirtualmachine_conversion.go new file mode 100644 index 00000000..baafd6b0 --- /dev/null +++ b/api/v1beta2/azurestackhcivirtualmachine_conversion.go @@ -0,0 +1,24 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Hub marks AzureStackHCIVirtualMachine as a conversion hub. +func (*AzureStackHCIVirtualMachine) Hub() {} + +// Hub marks AzureStackHCIVirtualMachineList as a conversion hub. +func (*AzureStackHCIVirtualMachineList) Hub() {} diff --git a/api/v1beta2/azurestackhcivirtualmachine_types.go b/api/v1beta2/azurestackhcivirtualmachine_types.go new file mode 100644 index 00000000..a321702a --- /dev/null +++ b/api/v1beta2/azurestackhcivirtualmachine_types.go @@ -0,0 +1,138 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + v1core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "sigs.k8s.io/cluster-api/errors" +) + +const ( + // VirtualMachineFinalizer allows ReconcileVirtualAzureStackHCIMachine to clean up AzureStackHCI resources associated with VirtualAzureStackHCIMachine before + // removing it from the apiserver. + VirtualMachineFinalizer = "azurestackhcivirtualmachine.infrastructure.cluster.x-k8s.io" +) + +// AzureStackHCIVirtualMachineSpec defines the desired state of AzureStackHCIVirtualMachine +type AzureStackHCIVirtualMachineSpec struct { + VMSize string `json:"vmSize"` + AvailabilityZone AvailabilityZone `json:"availabilityZone,omitempty"` + Image Image `json:"image"` + OSDisk OSDisk `json:"osDisk,omitempty"` + BootstrapData *string `json:"bootstrapData,omitempty"` + Identity VMIdentity `json:"identity,omitempty"` + Location string `json:"location"` // does location belong here? + SSHPublicKey string `json:"sshPublicKey"` + + // +optional + StorageContainer string `json:"storageContainer"` + // if not specified, it's a vm without gpu + GpuCount int32 `json:"gpuCount,omitempty"` + + // come from the cluster scope for machine and lb controller creation path + ResourceGroup string `json:"resourceGroup"` + VnetName string `json:"vnetName"` + ClusterName string `json:"clusterName"` + SubnetName string `json:"subnetName"` + BackendPoolNames []string `json:"backendPoolNames,omitempty"` + + AdditionalSSHKeys []string `json:"additionalSSHKeys,omitempty"` + + // +optional + NetworkInterfaces NetworkInterfaces `json:"networkInterfaces,omitempty"` + + // +optional + AvailabilitySetName string `json:"availabilitySetName,omitempty"` + + // +optional + PlacementGroupName string `json:"placementGroupName,omitempty"` +} + +// AzureStackHCIVirtualMachineStatus defines the observed state of AzureStackHCIVirtualMachine +type AzureStackHCIVirtualMachineStatus struct { + // Ready is true when the provider resource is ready. + // +optional + Ready bool `json:"ready"` + + // Addresses contains the AzureStackHCI instance associated addresses. + Addresses []v1core.NodeAddress `json:"addresses,omitempty"` + + // VMState is the provisioning state of the AzureStackHCI virtual machine. + // +optional + VMState *VMState `json:"vmState,omitempty"` + + // +optional + FailureReason *errors.MachineStatusError `json:"failureReason,omitempty"` + + // +optional + FailureMessage *string `json:"failureMessage,omitempty"` + + // Conditions defines current service state of the AzureStackHCIVirtualMachine. + // +optional + Conditions []metav1.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=azurestackhcivirtualmachines,scope=Namespaced,categories=cluster-api +// +kubebuilder:subresource:status +// +kubebuilder:storageversion + +// AzureStackHCIVirtualMachine is the Schema for the azurestackhcivirtualmachines API +type AzureStackHCIVirtualMachine struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec AzureStackHCIVirtualMachineSpec `json:"spec,omitempty"` + Status AzureStackHCIVirtualMachineStatus `json:"status,omitempty"` +} + +// GetConditions returns the list of conditions for the AzureStackHCIVirtualMachine. +func (m *AzureStackHCIVirtualMachine) GetConditions() []metav1.Condition { + return m.Status.Conditions +} + +// SetConditions sets the conditions for the AzureStackHCIVirtualMachine. +func (m *AzureStackHCIVirtualMachine) SetConditions(conditions []metav1.Condition) { + m.Status.Conditions = conditions +} + +// VirtualMachinesByCreationTimestamp sorts a list of AzureStackHCIVirtualMachine by creation timestamp, using their names as a tie breaker. +type VirtualMachinesByCreationTimestamp []*AzureStackHCIVirtualMachine + +func (o VirtualMachinesByCreationTimestamp) Len() int { return len(o) } +func (o VirtualMachinesByCreationTimestamp) Swap(i, j int) { o[i], o[j] = o[j], o[i] } +func (o VirtualMachinesByCreationTimestamp) Less(i, j int) bool { + if o[i].CreationTimestamp.Equal(&o[j].CreationTimestamp) { + return o[i].Name < o[j].Name + } + return o[i].CreationTimestamp.Before(&o[j].CreationTimestamp) +} + +// +kubebuilder:object:root=true + +// AzureStackHCIVirtualMachineList contains a list of AzureStackHCIVirtualMachine +type AzureStackHCIVirtualMachineList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []AzureStackHCIVirtualMachine `json:"items"` +} + +func init() { + objectTypes = append(objectTypes, &AzureStackHCIVirtualMachine{}, &AzureStackHCIVirtualMachineList{}) +} diff --git a/api/v1beta2/azurestackhcivirtualmachine_webhook.go b/api/v1beta2/azurestackhcivirtualmachine_webhook.go new file mode 100644 index 00000000..bd213600 --- /dev/null +++ b/api/v1beta2/azurestackhcivirtualmachine_webhook.go @@ -0,0 +1,28 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + ctrl "sigs.k8s.io/controller-runtime" +) + +func (r *AzureStackHCIVirtualMachine) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(r). + Complete() +} diff --git a/api/v1beta2/conditions_consts.go b/api/v1beta2/conditions_consts.go new file mode 100644 index 00000000..521e136a --- /dev/null +++ b/api/v1beta2/conditions_consts.go @@ -0,0 +1,86 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +// Conditions and condition Reasons for the AzureStackHCIVirtualMachine object + +const ( + // VMRunningCondition reports on current status of the AzureStackHCIVirtualMachine. + VMRunningCondition = "VMRunning" + // VMUpdatingReason used when the vm updating is in progress. + VMUpdatingReason = "VMUpdating" + // VMProvisionFailedReason used for failures during vm provisioning. + VMProvisionFailedReason = "VMProvisionFailed" + // VMNotFoundReason used when the vm couldn't be retrieved. + VMNotFoundReason = "VMNotFound" + // OutOfMemoryReason used when the AzureStackHCI resource is out of memory. + OutOfMemoryReason = "OutOfMemory" + // OutOfCapacityReason used when the AzureStackHCI resource is out of capacity. + OutOfCapacityReason = "OutOfCapacity" + // OutOfNodeCapacityReason used when the AzureStackHCI node is out of capacity. + OutOfNodeCapacityReason = "OutOfNodeCapacity" + // PathNotFoundReason used when the AzureStackHCI GalleryImage is not found. + PathNotFoundReason = "PathNotFound" + // NotFoundReason used as a generic error reason when a resource is not found. + NotFoundReason = "NotFound" +) + +// Conditions and condition Reasons for the AzureStackHCICluster object + +const ( + // NetworkInfrastructureReadyCondition reports on current status of the AzureStackHCICluster + NetworkInfrastructureReadyCondition = "NetworkInfrastructureReady" + // ClusterReconciliationFailedReason used for failures during cluster reconciliation. + ClusterReconciliationFailedReason = "ClusterReconciliationFailed" + // LoadBalancerProvisioningReason used for provisioning of lb + LoadBalancerProvisioningReason = "LoadBalancerProvisioning" + // LoadBalancerDeletingReason used when waiting on lbs to be deleted + LoadBalancerDeletingReason = "LoadBalancerDeleting" + // AzureStackHCIMachinesDeletingReason used when waiting on machines to be deleted + AzureStackHCIMachinesDeletingReason = "AzureStackHCIMachineDeleting" +) + +// Conditions and condition Reasons for the AzureStackHCILoadBalancer object + +const ( + // LoadBalancerInfrastructureReadyCondition reports on current status of the AzureStackHCILoadBalancer + LoadBalancerInfrastructureReadyCondition = "LoadBalancerInfrastructureReady" + // LoadBalancerServiceReconciliationFailedReason used for service failures during loadbalancer reconciliation. + LoadBalancerServiceReconciliationFailedReason = "ServiceReconciliationFailed" + // LoadBalancerServiceStatusFailedReason used for service status failures. + LoadBalancerServiceStatusFailedReason = "ServiceStatusFailed" + // LoadBalancerMachineReconciliationFailedReason used for machine failures during loadbalancer reconciliation. + LoadBalancerMachineReconciliationFailedReason = "MachineReconciliationFailed" + // LoadBalancerAddressUnavailableReason used when waiting for loadbalancer to have an address. + LoadBalancerAddressUnavailableReason = "AddressUnavailable" + // LoadBalancerNoReplicasReadyReason used when no replicas are in a ready state. + LoadBalancerNoReplicasReadyReason = "NoReplicasReady" + + // LoadBalancerReplicasReadyCondition reports on current status of the AzureStackHCILoadBalancer machine replicas + LoadBalancerReplicasReadyCondition = "LoadBalancerReplicasReady" + // LoadBalancerWaitingForReplicasReadyReason used when we are waiting for replicas to be ready. + LoadBalancerWaitingForReplicasReadyReason = "WaitingForReplicasToBeReady" + // LoadBalancerReplicasScalingUpReason used when we are scaling up the replicas. + LoadBalancerReplicasScalingUpReason = "ScalingUp" + // LoadBalancerReplicasScalingDownReason used when we are scaling down the replicas. + LoadBalancerReplicasScalingDownReason = "ScalingDown" + // LoadBalancerReplicasUpgradingReason used when we are upgrading the replicas. + LoadBalancerReplicasUpgradingReason = "Upgrading" + // LoadBalancerReplicasFailedReason used when we have failed replicas. + LoadBalancerReplicasFailedReason = "FailedReplicas" +) diff --git a/api/v1beta2/groupversion_info.go b/api/v1beta2/groupversion_info.go new file mode 100644 index 00000000..f91523ee --- /dev/null +++ b/api/v1beta2/groupversion_info.go @@ -0,0 +1,46 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// package v1beta2 contains API Schema definitions for the infrastructure v1beta2 API group +// +kubebuilder:object:generate=true +// +groupName=infrastructure.cluster.x-k8s.io +package v1beta2 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // GroupVersion is group version used to register these objects + GroupVersion = schema.GroupVersion{Group: "infrastructure.cluster.x-k8s.io", Version: "v1beta2"} + + // schemeBuilder is used to add go types to the GroupVersionKind scheme. + schemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + + // AddToScheme adds the types in this group-version to the given scheme. + AddToScheme = schemeBuilder.AddToScheme + + objectTypes = []runtime.Object{} +) + +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(GroupVersion, objectTypes...) + metav1.AddToGroupVersion(scheme, GroupVersion) + return nil +} diff --git a/api/v1beta2/phase_types.go b/api/v1beta2/phase_types.go new file mode 100644 index 00000000..ed06b3f2 --- /dev/null +++ b/api/v1beta2/phase_types.go @@ -0,0 +1,82 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +type AzureStackHCIClusterPhase string + +const ( + // AzureStackHCIClusterPhasePending is the first state a Cluster is assigned by + // Cluster API Cluster controller after being created. + AzureStackHCIClusterPhasePending = AzureStackHCIClusterPhase("pending") + + // AzureStackHCIClusterPhaseProvisioning is the state when the Cluster has a provider infrastructure + // object associated and can start provisioning. + AzureStackHCIClusterPhaseProvisioning = AzureStackHCIClusterPhase("provisioning") + + // AzureStackHCIClusterPhaseProvisioned is the state when its + // infrastructure has been created and configured. + AzureStackHCIClusterPhaseProvisioned = AzureStackHCIClusterPhase("provisioned") + + // AzureStackHCIClusterPhaseDeleting is the Cluster state when a delete + // request has been sent to the API Server, + // but its infrastructure has not yet been fully deleted. + AzureStackHCIClusterPhaseDeleting = AzureStackHCIClusterPhase("deleting") + + // AzureStackHCIClusterPhaseFailed is the Cluster state when the system + // might require user intervention. + AzureStackHCIClusterPhaseFailed = AzureStackHCIClusterPhase("failed") + + // AzureStackHCIClusterPhaseUpgrading is the Cluster state when the system + // is in the middle of a update. + AzureStackHCIClusterPhaseUpgrading = AzureStackHCIClusterPhase("upgrading") + + // AzureStackHCIClusterPhaseUnknown is returned if the Cluster state cannot be determined. + AzureStackHCIClusterPhaseUnknown = AzureStackHCIClusterPhase("") +) + +type AzureStackHCILoadBalancerPhase string + +const ( + // AzureStackHCILoadBalancerPhasePending is the first state a LoadBalancer is assigned by + // the controller after being created. + AzureStackHCILoadBalancerPhasePending = AzureStackHCILoadBalancerPhase("pending") + + // AzureStackHCILoadBalancerPhaseProvisioning is the state when the LoadBalancer is waiting for the + // first replica to be ready. + AzureStackHCILoadBalancerPhaseProvisioning = AzureStackHCILoadBalancerPhase("provisioning") + + // AzureStackHCILoadBalancerPhaseProvisioned is the state when its infrastructure has been created + // and configured. All replicas are ready and we have the desired number of replicas. + AzureStackHCILoadBalancerPhaseProvisioned = AzureStackHCILoadBalancerPhase("provisioned") + + // AzureStackHCILoadBalancerPhaseScaling is the state when replicas are being scaled. + AzureStackHCILoadBalancerPhaseScaling = AzureStackHCILoadBalancerPhase("scaling") + + // AzureStackHCILoadBalancerPhaseUpgrading is the state when the system is in the middle of a update. + AzureStackHCILoadBalancerPhaseUpgrading = AzureStackHCILoadBalancerPhase("upgrading") + + // AzureStackHCILoadBalancerPhaseDeleting is the state when a delete request has been sent to + // the API Server, but its infrastructure has not yet been fully deleted. + AzureStackHCILoadBalancerPhaseDeleting = AzureStackHCILoadBalancerPhase("deleting") + + // AzureStackHCILoadBalancerPhaseFailed is the state when the system might require user intervention. + AzureStackHCILoadBalancerPhaseFailed = AzureStackHCILoadBalancerPhase("failed") + + // AzureStackHCILoadBalancerPhaseUnknown is returned if the state cannot be determined. + AzureStackHCILoadBalancerPhaseUnknown = AzureStackHCILoadBalancerPhase("") +) diff --git a/api/v1beta2/types.go b/api/v1beta2/types.go new file mode 100644 index 00000000..8f108109 --- /dev/null +++ b/api/v1beta2/types.go @@ -0,0 +1,267 @@ +/* +Copyright 2020 The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// AzureStackHCIResourceReference is a reference to a specific Azure resource by ID +type AzureStackHCIResourceReference struct { + // ID of resource + // +optional + ID *string `json:"id,omitempty"` +} + +// AzureStackHCIMachineProviderConditionType is a valid value for AzureStackHCIMachineProviderCondition.Type +type AzureStackHCIMachineProviderConditionType string + +// Valid conditions for an Azure machine instance +const ( + // MachineCreated indicates whether the machine has been created or not. If not, + // it should include a reason and message for the failure. + MachineCreated AzureStackHCIMachineProviderConditionType = "MachineCreated" +) + +// AzureStackHCIMachineProviderCondition is a condition in a AzureStackHCIMachineProviderStatus +type AzureStackHCIMachineProviderCondition struct { + // Type is the type of the condition. + Type AzureStackHCIMachineProviderConditionType `json:"type"` + // Status is the status of the condition. + Status corev1.ConditionStatus `json:"status"` + // LastProbeTime is the last time we probed the condition. + // +optional + LastProbeTime metav1.Time `json:"lastProbeTime"` + // LastTransitionTime is the last time the condition transitioned from one status to another. + // +optional + LastTransitionTime metav1.Time `json:"lastTransitionTime"` + // Reason is a unique, one-word, CamelCase reason for the condition's last transition. + // +optional + Reason string `json:"reason"` + // Message is a human-readable message indicating details about last transition. + // +optional + Message string `json:"message"` +} + +const ( + // ControlPlane machine label + ControlPlane string = "control-plane" + // Node machine label + Node string = "node" +) + +// NetworkSpec encapsulates all things related to Azure network. +type NetworkSpec struct { + // Vnet is the configuration for the Azure virtual network. + // +optional + Vnet VnetSpec `json:"vnet,omitempty"` + + // Subnets is the configuration for the control-plane subnet and the node subnet. + // +optional + Subnets Subnets `json:"subnets,omitempty"` +} + +// VnetSpec configures an Azure virtual network. +type VnetSpec struct { + // ID is the identifier of the virtual network this provider should use to create resources. + ID string `json:"id,omitempty"` + + // Name defines a name for the virtual network resource. + Name string `json:"name"` + + // CidrBlock is the CIDR block to be used when the provider creates a managed virtual network. + CidrBlock string `json:"cidrBlock,omitempty"` + + // Group is the resource group the vnet should use. + Group string `json:"group,omitempty"` +} + +// Subnets is a slice of Subnet. +type Subnets []*SubnetSpec + +// ToMap returns a map from id to subnet. +func (s Subnets) ToMap() map[string]*SubnetSpec { + res := make(map[string]*SubnetSpec) + for _, x := range s { + res[x.ID] = x + } + return res +} + +type IPAllocationMethod int32 + +// nolint: golint +const ( + IPAllocationMethod_Invalid IPAllocationMethod = 0 + IPAllocationMethod_Dynamic IPAllocationMethod = 1 + IPAllocationMethod_Static IPAllocationMethod = 2 +) + +// nolint: golint +type IpConfigurationSpec struct { + Name string `json:"name,omitempty"` + // +optional + Primary bool `json:"primary,omitempty"` + // +optional + Allocation IPAllocationMethod `json:"allocation,omitempty"` + // below fields are unused, but adding for completeness + // +optional + IpAddress string `json:"ipAddress,omitempty"` + // +optional + PrefixLength string `json:"prefixLength,omitempty"` + // +optional + SubnetId string `json:"subnetId,omitempty"` + // +optional + Gateway string `json:"gateway,omitempty"` +} + +// nolint: golint +type IpConfigurations []*IpConfigurationSpec + +type NetworkInterfaceSpec struct { + // +optional + Name string `json:"name,omitempty"` + // +optional + IPConfigurations IpConfigurations `json:"ipConfigurations,omitempty"` +} + +type NetworkInterfaces []*NetworkInterfaceSpec + +const ( + // OSVersionLabelName is the label set on resources to identify their os version + OSVersionLabelName = "msft.microsoft/os-version" + // LoadBalancerLabel is the label set on load balancer replica machines + LoadBalancerLabel = "msft.microsoft/load-balancer" +) + +// VMState describes the state of an Azure virtual machine. +type VMState string + +var ( + // VMStateCreating ... + VMStateCreating = VMState("Creating") + // VMStateDeleting ... + VMStateDeleting = VMState("Deleting") + // VMStateFailed ... + VMStateFailed = VMState("Failed") + // VMStateMigrating ... + VMStateMigrating = VMState("Migrating") + // VMStateSucceeded ... + VMStateSucceeded = VMState("Succeeded") + // VMStateUpdating ... + VMStateUpdating = VMState("Updating") +) + +// VM describes an Azure virtual machine. +type VM struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + + AvailabilityZone string `json:"availabilityZone,omitempty"` + + // Hardware profile + VMSize string `json:"vmSize,omitempty"` + + // Storage profile + Image Image `json:"image,omitempty"` + OSDisk OSDisk `json:"osDisk,omitempty"` + + BootstrapData string `json:"bootstrapData,omitempty"` + + // State - The provisioning state, which only appears in the response. + State VMState `json:"vmState,omitempty"` + Identity VMIdentity `json:"identity,omitempty"` +} + +// Image defines information about the image to use for VM creation. +// There are three ways to specify an image: by ID, by publisher, or by Shared Image Gallery. +// If specifying an image by ID, only the ID field needs to be set. +// If specifying an image by publisher, the Publisher, Offer, SKU, and Version fields must be set. +// If specifying an image from a Shared Image Gallery, the SubscriptionID, ResourceGroup, +// Gallery, Name, and Version fields must be set. +type Image struct { + Publisher *string `json:"publisher,omitempty"` + Offer *string `json:"offer,omitempty"` + SKU *string `json:"sku,omitempty"` + + ID *string `json:"id,omitempty"` + + SubscriptionID *string `json:"subscriptionID,omitempty"` + ResourceGroup *string `json:"resourceGroup,omitempty"` + Gallery *string `json:"gallery,omitempty"` + Name *string `json:"name,omitempty"` + + Version *string `json:"version,omitempty"` + OSType OSType `json:"osType"` +} + +type AvailabilityZone struct { + ID *string `json:"id,omitempty"` + Enabled *bool `json:"enabled,omitempty"` +} + +// VMIdentity defines the identity of the virtual machine, if configured. +type VMIdentity string + +// OSType describes the OS type of a disk. +type OSType string + +const ( + // OSTypeLinux + OSTypeLinux = OSType("Linux") + // OSTypeWindows + OSTypeWindows = OSType("Windows") + // OSTypeWindows2022 + OSTypeWindows2022 = OSType("Windows2022") +) + +type OSDisk struct { + Name string `json:"name"` + Source string `json:"source"` + OSType OSType `json:"osType"` + DiskSizeGB int32 `json:"diskSizeGB"` + ManagedDisk ManagedDisk `json:"managedDisk"` +} + +type ManagedDisk struct { + StorageAccountType string `json:"storageAccountType"` +} + +// SubnetSpec configures an Azure subnet. +type SubnetSpec struct { + // ID defines a unique identifier to reference this resource. + ID string `json:"id,omitempty"` + + // Name defines a name for the subnet resource. + Name string `json:"name"` + + // VnetID defines the ID of the virtual network this subnet should be built in. + VnetID string `json:"vnetId"` + + // CidrBlock is the CIDR block to be used when the provider creates a managed Vnet. + CidrBlock string `json:"cidrBlock,omitempty"` +} + +const ( + AnnotationClusterInfrastructureReady = "azurestackhci.cluster.sigs.k8s.io/infrastructure-ready" + ValueReady = "true" + AnnotationControlPlaneReady = "azurestackhci.cluster.sigs.k8s.io/control-plane-ready" + AzureOperationIDAnnotationKey = "management.azure.com/operationId" + AzureCorrelationIDAnnotationKey = "management.azure.com/correlationId" +) diff --git a/api/v1beta2/zz_generated.deepcopy.go b/api/v1beta2/zz_generated.deepcopy.go new file mode 100644 index 00000000..247175c0 --- /dev/null +++ b/api/v1beta2/zz_generated.deepcopy.go @@ -0,0 +1,1084 @@ +//go:build !ignore_autogenerated + +/* +Copyright The Kubernetes Authors. +Portions Copyright © Microsoft Corporation. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by controller-gen. DO NOT EDIT. + +package v1beta2 + +import ( + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + corev1beta2 "sigs.k8s.io/cluster-api/api/core/v1beta2" + "sigs.k8s.io/cluster-api/errors" +) + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AvailabilityZone) DeepCopyInto(out *AvailabilityZone) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.Enabled != nil { + in, out := &in.Enabled, &out.Enabled + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AvailabilityZone. +func (in *AvailabilityZone) DeepCopy() *AvailabilityZone { + if in == nil { + return nil + } + out := new(AvailabilityZone) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCICluster) DeepCopyInto(out *AzureStackHCICluster) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCICluster. +func (in *AzureStackHCICluster) DeepCopy() *AzureStackHCICluster { + if in == nil { + return nil + } + out := new(AzureStackHCICluster) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCICluster) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterList) DeepCopyInto(out *AzureStackHCIClusterList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCICluster, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterList. +func (in *AzureStackHCIClusterList) DeepCopy() *AzureStackHCIClusterList { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIClusterList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterSpec) DeepCopyInto(out *AzureStackHCIClusterSpec) { + *out = *in + in.NetworkSpec.DeepCopyInto(&out.NetworkSpec) + if in.AzureStackHCILoadBalancer != nil { + in, out := &in.AzureStackHCILoadBalancer, &out.AzureStackHCILoadBalancer + *out = new(AzureStackHCILoadBalancerSpec) + (*in).DeepCopyInto(*out) + } + out.ControlPlaneEndpoint = in.ControlPlaneEndpoint + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterSpec. +func (in *AzureStackHCIClusterSpec) DeepCopy() *AzureStackHCIClusterSpec { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterStatus) DeepCopyInto(out *AzureStackHCIClusterStatus) { + *out = *in + in.Bastion.DeepCopyInto(&out.Bastion) + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Initialization != nil { + in, out := &in.Initialization, &out.Initialization + *out = new(corev1beta2.ClusterInitializationStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterStatus. +func (in *AzureStackHCIClusterStatus) DeepCopy() *AzureStackHCIClusterStatus { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterTemplate) DeepCopyInto(out *AzureStackHCIClusterTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterTemplate. +func (in *AzureStackHCIClusterTemplate) DeepCopy() *AzureStackHCIClusterTemplate { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIClusterTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterTemplateList) DeepCopyInto(out *AzureStackHCIClusterTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCIClusterTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterTemplateList. +func (in *AzureStackHCIClusterTemplateList) DeepCopy() *AzureStackHCIClusterTemplateList { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIClusterTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterTemplateResource) DeepCopyInto(out *AzureStackHCIClusterTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterTemplateResource. +func (in *AzureStackHCIClusterTemplateResource) DeepCopy() *AzureStackHCIClusterTemplateResource { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIClusterTemplateSpec) DeepCopyInto(out *AzureStackHCIClusterTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIClusterTemplateSpec. +func (in *AzureStackHCIClusterTemplateSpec) DeepCopy() *AzureStackHCIClusterTemplateSpec { + if in == nil { + return nil + } + out := new(AzureStackHCIClusterTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCILoadBalancer) DeepCopyInto(out *AzureStackHCILoadBalancer) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCILoadBalancer. +func (in *AzureStackHCILoadBalancer) DeepCopy() *AzureStackHCILoadBalancer { + if in == nil { + return nil + } + out := new(AzureStackHCILoadBalancer) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCILoadBalancer) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCILoadBalancerList) DeepCopyInto(out *AzureStackHCILoadBalancerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCILoadBalancer, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCILoadBalancerList. +func (in *AzureStackHCILoadBalancerList) DeepCopy() *AzureStackHCILoadBalancerList { + if in == nil { + return nil + } + out := new(AzureStackHCILoadBalancerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCILoadBalancerList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCILoadBalancerSpec) DeepCopyInto(out *AzureStackHCILoadBalancerSpec) { + *out = *in + in.Image.DeepCopyInto(&out.Image) + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCILoadBalancerSpec. +func (in *AzureStackHCILoadBalancerSpec) DeepCopy() *AzureStackHCILoadBalancerSpec { + if in == nil { + return nil + } + out := new(AzureStackHCILoadBalancerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCILoadBalancerStatus) DeepCopyInto(out *AzureStackHCILoadBalancerStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ErrorReason != nil { + in, out := &in.ErrorReason, &out.ErrorReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.ErrorMessage != nil { + in, out := &in.ErrorMessage, &out.ErrorMessage + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCILoadBalancerStatus. +func (in *AzureStackHCILoadBalancerStatus) DeepCopy() *AzureStackHCILoadBalancerStatus { + if in == nil { + return nil + } + out := new(AzureStackHCILoadBalancerStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachine) DeepCopyInto(out *AzureStackHCIMachine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachine. +func (in *AzureStackHCIMachine) DeepCopy() *AzureStackHCIMachine { + if in == nil { + return nil + } + out := new(AzureStackHCIMachine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIMachine) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineList) DeepCopyInto(out *AzureStackHCIMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCIMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineList. +func (in *AzureStackHCIMachineList) DeepCopy() *AzureStackHCIMachineList { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIMachineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineProviderCondition) DeepCopyInto(out *AzureStackHCIMachineProviderCondition) { + *out = *in + in.LastProbeTime.DeepCopyInto(&out.LastProbeTime) + in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineProviderCondition. +func (in *AzureStackHCIMachineProviderCondition) DeepCopy() *AzureStackHCIMachineProviderCondition { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineProviderCondition) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineSpec) DeepCopyInto(out *AzureStackHCIMachineSpec) { + *out = *in + if in.ProviderID != nil { + in, out := &in.ProviderID, &out.ProviderID + *out = new(string) + **out = **in + } + in.AvailabilityZone.DeepCopyInto(&out.AvailabilityZone) + in.Image.DeepCopyInto(&out.Image) + out.OSDisk = in.OSDisk + if in.AdditionalSSHKeys != nil { + in, out := &in.AdditionalSSHKeys, &out.AdditionalSSHKeys + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make(NetworkInterfaces, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(NetworkInterfaceSpec) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineSpec. +func (in *AzureStackHCIMachineSpec) DeepCopy() *AzureStackHCIMachineSpec { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineStatus) DeepCopyInto(out *AzureStackHCIMachineStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]corev1.NodeAddress, len(*in)) + copy(*out, *in) + } + if in.VMState != nil { + in, out := &in.VMState, &out.VMState + *out = new(VMState) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Initialization != nil { + in, out := &in.Initialization, &out.Initialization + *out = new(corev1beta2.MachineInitializationStatus) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineStatus. +func (in *AzureStackHCIMachineStatus) DeepCopy() *AzureStackHCIMachineStatus { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineTemplate) DeepCopyInto(out *AzureStackHCIMachineTemplate) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineTemplate. +func (in *AzureStackHCIMachineTemplate) DeepCopy() *AzureStackHCIMachineTemplate { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineTemplate) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIMachineTemplate) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineTemplateList) DeepCopyInto(out *AzureStackHCIMachineTemplateList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCIMachineTemplate, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineTemplateList. +func (in *AzureStackHCIMachineTemplateList) DeepCopy() *AzureStackHCIMachineTemplateList { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineTemplateList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIMachineTemplateList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineTemplateResource) DeepCopyInto(out *AzureStackHCIMachineTemplateResource) { + *out = *in + in.Spec.DeepCopyInto(&out.Spec) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineTemplateResource. +func (in *AzureStackHCIMachineTemplateResource) DeepCopy() *AzureStackHCIMachineTemplateResource { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineTemplateResource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIMachineTemplateSpec) DeepCopyInto(out *AzureStackHCIMachineTemplateSpec) { + *out = *in + in.Template.DeepCopyInto(&out.Template) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIMachineTemplateSpec. +func (in *AzureStackHCIMachineTemplateSpec) DeepCopy() *AzureStackHCIMachineTemplateSpec { + if in == nil { + return nil + } + out := new(AzureStackHCIMachineTemplateSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIResourceReference) DeepCopyInto(out *AzureStackHCIResourceReference) { + *out = *in + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIResourceReference. +func (in *AzureStackHCIResourceReference) DeepCopy() *AzureStackHCIResourceReference { + if in == nil { + return nil + } + out := new(AzureStackHCIResourceReference) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIVirtualMachine) DeepCopyInto(out *AzureStackHCIVirtualMachine) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIVirtualMachine. +func (in *AzureStackHCIVirtualMachine) DeepCopy() *AzureStackHCIVirtualMachine { + if in == nil { + return nil + } + out := new(AzureStackHCIVirtualMachine) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIVirtualMachine) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIVirtualMachineList) DeepCopyInto(out *AzureStackHCIVirtualMachineList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]AzureStackHCIVirtualMachine, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIVirtualMachineList. +func (in *AzureStackHCIVirtualMachineList) DeepCopy() *AzureStackHCIVirtualMachineList { + if in == nil { + return nil + } + out := new(AzureStackHCIVirtualMachineList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *AzureStackHCIVirtualMachineList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIVirtualMachineSpec) DeepCopyInto(out *AzureStackHCIVirtualMachineSpec) { + *out = *in + in.AvailabilityZone.DeepCopyInto(&out.AvailabilityZone) + in.Image.DeepCopyInto(&out.Image) + out.OSDisk = in.OSDisk + if in.BootstrapData != nil { + in, out := &in.BootstrapData, &out.BootstrapData + *out = new(string) + **out = **in + } + if in.BackendPoolNames != nil { + in, out := &in.BackendPoolNames, &out.BackendPoolNames + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.AdditionalSSHKeys != nil { + in, out := &in.AdditionalSSHKeys, &out.AdditionalSSHKeys + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.NetworkInterfaces != nil { + in, out := &in.NetworkInterfaces, &out.NetworkInterfaces + *out = make(NetworkInterfaces, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(NetworkInterfaceSpec) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIVirtualMachineSpec. +func (in *AzureStackHCIVirtualMachineSpec) DeepCopy() *AzureStackHCIVirtualMachineSpec { + if in == nil { + return nil + } + out := new(AzureStackHCIVirtualMachineSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *AzureStackHCIVirtualMachineStatus) DeepCopyInto(out *AzureStackHCIVirtualMachineStatus) { + *out = *in + if in.Addresses != nil { + in, out := &in.Addresses, &out.Addresses + *out = make([]corev1.NodeAddress, len(*in)) + copy(*out, *in) + } + if in.VMState != nil { + in, out := &in.VMState, &out.VMState + *out = new(VMState) + **out = **in + } + if in.FailureReason != nil { + in, out := &in.FailureReason, &out.FailureReason + *out = new(errors.MachineStatusError) + **out = **in + } + if in.FailureMessage != nil { + in, out := &in.FailureMessage, &out.FailureMessage + *out = new(string) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]v1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureStackHCIVirtualMachineStatus. +func (in *AzureStackHCIVirtualMachineStatus) DeepCopy() *AzureStackHCIVirtualMachineStatus { + if in == nil { + return nil + } + out := new(AzureStackHCIVirtualMachineStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Image) DeepCopyInto(out *Image) { + *out = *in + if in.Publisher != nil { + in, out := &in.Publisher, &out.Publisher + *out = new(string) + **out = **in + } + if in.Offer != nil { + in, out := &in.Offer, &out.Offer + *out = new(string) + **out = **in + } + if in.SKU != nil { + in, out := &in.SKU, &out.SKU + *out = new(string) + **out = **in + } + if in.ID != nil { + in, out := &in.ID, &out.ID + *out = new(string) + **out = **in + } + if in.SubscriptionID != nil { + in, out := &in.SubscriptionID, &out.SubscriptionID + *out = new(string) + **out = **in + } + if in.ResourceGroup != nil { + in, out := &in.ResourceGroup, &out.ResourceGroup + *out = new(string) + **out = **in + } + if in.Gallery != nil { + in, out := &in.Gallery, &out.Gallery + *out = new(string) + **out = **in + } + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Image. +func (in *Image) DeepCopy() *Image { + if in == nil { + return nil + } + out := new(Image) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *IpConfigurationSpec) DeepCopyInto(out *IpConfigurationSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IpConfigurationSpec. +func (in *IpConfigurationSpec) DeepCopy() *IpConfigurationSpec { + if in == nil { + return nil + } + out := new(IpConfigurationSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in IpConfigurations) DeepCopyInto(out *IpConfigurations) { + { + in := &in + *out = make(IpConfigurations, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IpConfigurationSpec) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new IpConfigurations. +func (in IpConfigurations) DeepCopy() IpConfigurations { + if in == nil { + return nil + } + out := new(IpConfigurations) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ManagedDisk) DeepCopyInto(out *ManagedDisk) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ManagedDisk. +func (in *ManagedDisk) DeepCopy() *ManagedDisk { + if in == nil { + return nil + } + out := new(ManagedDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkInterfaceSpec) DeepCopyInto(out *NetworkInterfaceSpec) { + *out = *in + if in.IPConfigurations != nil { + in, out := &in.IPConfigurations, &out.IPConfigurations + *out = make(IpConfigurations, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(IpConfigurationSpec) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaceSpec. +func (in *NetworkInterfaceSpec) DeepCopy() *NetworkInterfaceSpec { + if in == nil { + return nil + } + out := new(NetworkInterfaceSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in NetworkInterfaces) DeepCopyInto(out *NetworkInterfaces) { + { + in := &in + *out = make(NetworkInterfaces, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(NetworkInterfaceSpec) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkInterfaces. +func (in NetworkInterfaces) DeepCopy() NetworkInterfaces { + if in == nil { + return nil + } + out := new(NetworkInterfaces) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *NetworkSpec) DeepCopyInto(out *NetworkSpec) { + *out = *in + out.Vnet = in.Vnet + if in.Subnets != nil { + in, out := &in.Subnets, &out.Subnets + *out = make(Subnets, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(SubnetSpec) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkSpec. +func (in *NetworkSpec) DeepCopy() *NetworkSpec { + if in == nil { + return nil + } + out := new(NetworkSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *OSDisk) DeepCopyInto(out *OSDisk) { + *out = *in + out.ManagedDisk = in.ManagedDisk +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OSDisk. +func (in *OSDisk) DeepCopy() *OSDisk { + if in == nil { + return nil + } + out := new(OSDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SubnetSpec) DeepCopyInto(out *SubnetSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SubnetSpec. +func (in *SubnetSpec) DeepCopy() *SubnetSpec { + if in == nil { + return nil + } + out := new(SubnetSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in Subnets) DeepCopyInto(out *Subnets) { + { + in := &in + *out = make(Subnets, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(SubnetSpec) + **out = **in + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subnets. +func (in Subnets) DeepCopy() Subnets { + if in == nil { + return nil + } + out := new(Subnets) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VM) DeepCopyInto(out *VM) { + *out = *in + in.Image.DeepCopyInto(&out.Image) + out.OSDisk = in.OSDisk +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VM. +func (in *VM) DeepCopy() *VM { + if in == nil { + return nil + } + out := new(VM) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in VirtualMachinesByCreationTimestamp) DeepCopyInto(out *VirtualMachinesByCreationTimestamp) { + { + in := &in + *out = make(VirtualMachinesByCreationTimestamp, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(AzureStackHCIVirtualMachine) + (*in).DeepCopyInto(*out) + } + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VirtualMachinesByCreationTimestamp. +func (in VirtualMachinesByCreationTimestamp) DeepCopy() VirtualMachinesByCreationTimestamp { + if in == nil { + return nil + } + out := new(VirtualMachinesByCreationTimestamp) + in.DeepCopyInto(out) + return *out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VnetSpec) DeepCopyInto(out *VnetSpec) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VnetSpec. +func (in *VnetSpec) DeepCopy() *VnetSpec { + if in == nil { + return nil + } + out := new(VnetSpec) + in.DeepCopyInto(out) + return out +} diff --git a/cloud/converters/vm.go b/cloud/converters/vm.go index 78be96ad..c2cf7f36 100644 --- a/cloud/converters/vm.go +++ b/cloud/converters/vm.go @@ -19,7 +19,7 @@ package converters import ( "github.com/Azure/go-autorest/autorest/to" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/microsoft/moc-sdk-for-go/services/compute" ) diff --git a/cloud/defaults.go b/cloud/defaults.go index 905d7874..b8ea4012 100644 --- a/cloud/defaults.go +++ b/cloud/defaults.go @@ -21,7 +21,7 @@ import ( "fmt" "github.com/blang/semver" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" infrav1util "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/util" "github.com/pkg/errors" "k8s.io/utils/pointer" diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index f210dc41..d59dce97 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -23,7 +23,7 @@ import ( "os" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azhciauth "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/auth" "github.com/microsoft/moc/pkg/auth" "github.com/microsoft/moc/pkg/diagnostics" @@ -31,7 +31,7 @@ import ( corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog/v2/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" @@ -176,18 +176,15 @@ func (s *ClusterScope) ListOptionsLabelSelector() client.ListOption { // PatchObject persists the cluster configuration and status. func (s *ClusterScope) PatchObject() error { - conditions.SetSummary(s.AzureStackHCICluster, - conditions.WithConditions( - infrav1.NetworkInfrastructureReadyCondition, - ), - conditions.WithStepCounterIfOnly( - infrav1.NetworkInfrastructureReadyCondition, - ), - ) + newCondition, err := conditions.NewSummaryCondition(s.AzureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, conditions.ForConditionTypes{infrav1.NetworkInfrastructureReadyCondition}) + if err != nil { + return fmt.Errorf("unable to generate summary condition: %e", err) + } + conditions.Set(s.AzureStackHCICluster, *newCondition) return s.patchHelper.Patch(s.Context, s.AzureStackHCICluster, - patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{ + patch.WithOwnedConditions{Conditions: []string{ clusterv1.ReadyCondition, infrav1.NetworkInfrastructureReadyCondition, }}) @@ -200,10 +197,7 @@ func (s *ClusterScope) Close() error { // APIServerPort returns the APIServerPort to use when creating the load balancer. func (s *ClusterScope) APIServerPort() int32 { - if s.Cluster.Spec.ClusterNetwork != nil && s.Cluster.Spec.ClusterNetwork.APIServerPort != nil { - return *s.Cluster.Spec.ClusterNetwork.APIServerPort - } - return 6443 + return s.Cluster.Spec.ClusterNetwork.APIServerPort } func (s *ClusterScope) AzureStackHCILoadBalancer() *infrav1.AzureStackHCILoadBalancerSpec { diff --git a/cloud/scope/loadbalancer.go b/cloud/scope/loadbalancer.go index 14a7ac95..b28d74ec 100644 --- a/cloud/scope/loadbalancer.go +++ b/cloud/scope/loadbalancer.go @@ -21,12 +21,12 @@ import ( "context" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/microsoft/moc/pkg/diagnostics" "github.com/pkg/errors" "k8s.io/klog/v2/klogr" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 78d4747c..b23dc66b 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -20,16 +20,17 @@ package scope import ( "context" "encoding/base64" + "fmt" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog/v2/klogr" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - capierrors "sigs.k8s.io/cluster-api/errors" + "k8s.io/utils/ptr" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" @@ -151,7 +152,7 @@ func (m *MachineScope) GetProviderID() string { // SetProviderID sets the AzureStackHCIMachine providerID in spec. func (m *MachineScope) SetProviderID(v string) { - m.AzureStackHCIMachine.Spec.ProviderID = pointer.StringPtr(v) + m.AzureStackHCIMachine.Spec.ProviderID = ptr.To(v) } // GetVMState returns the AzureStackHCIMachine VM state. @@ -167,17 +168,7 @@ func (m *MachineScope) SetVMState(v *infrav1.VMState) { // SetReady sets the AzureStackHCIMachine Ready Status func (m *MachineScope) SetReady() { - m.AzureStackHCIMachine.Status.Ready = true -} - -// SetFailureMessage sets the AzureStackHCIMachine status failure message. -func (m *MachineScope) SetFailureMessage(v error) { - m.AzureStackHCIMachine.Status.FailureMessage = pointer.StringPtr(v.Error()) -} - -// SetFailureReason sets the AzureStackHCIMachine status failure reason. -func (m *MachineScope) SetFailureReason(v capierrors.MachineStatusError) { - m.AzureStackHCIMachine.Status.FailureReason = &v + *m.AzureStackHCIMachine.Status.Initialization.InfrastructureProvisioned = true } // SetAnnotation sets a key value annotation on the AzureStackHCIMachine. @@ -190,19 +181,16 @@ func (m *MachineScope) SetAnnotation(key, value string) { // PatchObject persists the machine spec and status. func (m *MachineScope) PatchObject() error { - conditions.SetSummary(m.AzureStackHCIMachine, - conditions.WithConditions( - infrav1.VMRunningCondition, - ), - conditions.WithStepCounterIfOnly( - infrav1.VMRunningCondition, - ), - ) + summary, err := conditions.NewSummaryCondition(m.AzureStackHCIMachine, infrav1.VMRunningCondition, conditions.ForConditionTypes{infrav1.VMRunningCondition}) + if err != nil { + return fmt.Errorf("unable to generate summary condition: %e", err) + } + conditions.Set(m.AzureStackHCIMachine, *summary) return m.patchHelper.Patch( context.TODO(), m.AzureStackHCIMachine, - patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{ + patch.WithOwnedConditions{Conditions: []string{ clusterv1.ReadyCondition, infrav1.VMRunningCondition, }}) diff --git a/cloud/scope/virtualmachine.go b/cloud/scope/virtualmachine.go index 3133a2a2..2e70c398 100644 --- a/cloud/scope/virtualmachine.go +++ b/cloud/scope/virtualmachine.go @@ -23,15 +23,13 @@ import ( "os" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azhciauth "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/auth" "github.com/microsoft/moc/pkg/auth" "github.com/microsoft/moc/pkg/diagnostics" "github.com/pkg/errors" "k8s.io/klog/v2/klogr" - "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - capierrors "sigs.k8s.io/cluster-api/errors" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/cluster-api/util/patch" "sigs.k8s.io/controller-runtime/pkg/client" @@ -184,16 +182,6 @@ func (m *VirtualMachineScope) SetReady() { m.AzureStackHCIVirtualMachine.Status.Ready = true } -// SetFailureMessage sets the AzureStackHCIVirtualMachine status failure message. -func (m *VirtualMachineScope) SetFailureMessage(v error) { - m.AzureStackHCIVirtualMachine.Status.FailureMessage = pointer.StringPtr(v.Error()) -} - -// SetFailureReason sets the AzureStackHCIVirtualMachine status failure reason. -func (m *VirtualMachineScope) SetFailureReason(v capierrors.MachineStatusError) { - m.AzureStackHCIVirtualMachine.Status.FailureReason = &v -} - // SetAnnotation sets a key value annotation on the AzureStackHCIVirtualMachine. func (m *VirtualMachineScope) SetAnnotation(key, value string) { if m.AzureStackHCIVirtualMachine.Annotations == nil { @@ -204,18 +192,17 @@ func (m *VirtualMachineScope) SetAnnotation(key, value string) { // PatchObject persists the virtual machine spec and status. func (m *VirtualMachineScope) PatchObject() error { - conditions.SetSummary(m.AzureStackHCIVirtualMachine, - conditions.WithConditions( - infrav1.VMRunningCondition, - ), - conditions.WithStepCounterIfOnly( - infrav1.VMRunningCondition, - ), - ) + summary, err := conditions.NewSummaryCondition(m.AzureStackHCIVirtualMachine, + infrav1.VMRunningCondition, + conditions.ForConditionTypes{infrav1.VMRunningCondition}) + if err != nil { + return fmt.Errorf("unable to generate summary: %e", err) + } + conditions.Set(m.AzureStackHCIVirtualMachine, *summary) return m.patchHelper.Patch(m.Context, m.AzureStackHCIVirtualMachine, - patch.WithOwnedConditions{Conditions: []clusterv1.ConditionType{ + patch.WithOwnedConditions{Conditions: []string{ clusterv1.ReadyCondition, infrav1.VMRunningCondition, }}) diff --git a/cloud/services/virtualmachines/virtualmachines.go b/cloud/services/virtualmachines/virtualmachines.go index 383c0a3e..dbc90fbf 100644 --- a/cloud/services/virtualmachines/virtualmachines.go +++ b/cloud/services/virtualmachines/virtualmachines.go @@ -25,7 +25,7 @@ import ( "fmt" "github.com/Azure/go-autorest/autorest/to" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/converters" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/services/networkinterfaces" diff --git a/cmd/manager/main.go b/cmd/manager/main.go index 5ed0ec4e..2ac858a6 100644 --- a/cmd/manager/main.go +++ b/cmd/manager/main.go @@ -26,9 +26,8 @@ import ( "os" "time" - infrav1beta1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" - // +kubebuilder:scaffold:imports + infrav1beta2 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/microsoft/cluster-api-provider-azurestackhci/controllers" "github.com/microsoft/cluster-api-provider-azurestackhci/pkg/network" "github.com/spf13/pflag" @@ -38,7 +37,7 @@ import ( "k8s.io/client-go/util/workqueue" "k8s.io/klog/v2" "k8s.io/klog/v2/klogr" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/feature" "sigs.k8s.io/cluster-api/util/record" ctrl "sigs.k8s.io/controller-runtime" @@ -60,7 +59,7 @@ func init() { _ = clientgoscheme.AddToScheme(scheme) _ = clusterv1.AddToScheme(scheme) - _ = infrav1beta1.AddToScheme(scheme) + _ = infrav1beta2.AddToScheme(scheme) // +kubebuilder:scaffold:scheme } @@ -249,27 +248,27 @@ func main() { // +kubebuilder:scaffold:builder - if err := (&infrav1beta1.AzureStackHCICluster{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&infrav1beta2.AzureStackHCICluster{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "AzureStackHCICluster") os.Exit(1) } - if err := (&infrav1beta1.AzureStackHCIMachine{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&infrav1beta2.AzureStackHCIMachine{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "AzureStackHCIMachine") os.Exit(1) } - if err := (&infrav1beta1.AzureStackHCIMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&infrav1beta2.AzureStackHCIMachineTemplate{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "AzureStackHCIMachineTemplate") os.Exit(1) } - if err := (&infrav1beta1.AzureStackHCIVirtualMachine{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&infrav1beta2.AzureStackHCIVirtualMachine{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "AzureStackHCIVirtualMachine") os.Exit(1) } - if err := (&infrav1beta1.AzureStackHCILoadBalancer{}).SetupWebhookWithManager(mgr); err != nil { + if err := (&infrav1beta2.AzureStackHCILoadBalancer{}).SetupWebhookWithManager(mgr); err != nil { setupLog.Error(err, "unable to create webhook", "webhook", "AzureStackHCILoadBalancer") os.Exit(1) } diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml index a9593fde..4119d305 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclusters.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhciclusters.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -21,7 +21,7 @@ spec: jsonPath: .status.phase name: Phase type: string - name: v1beta1 + name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCICluster is the Schema for the azurestackhciclusters @@ -105,18 +105,19 @@ spec: controlPlaneEndpoint: description: ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + minProperties: 1 properties: host: description: host is the hostname on which the API server is serving. maxLength: 512 + minLength: 1 type: string port: description: port is the port on which the API server is serving. format: int32 + maximum: 65535 + minimum: 1 type: integer - required: - - host - - port type: object location: type: string @@ -268,63 +269,89 @@ spec: conditions: description: Conditions defines current service state of the AzureStackHCICluster. items: - description: Condition defines an observation of a Cluster API resource - operational state. + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: description: |- message is a human readable message indicating details about the transition. - This field may be empty. - maxLength: 10240 - minLength: 1 + This may be an empty string. + maxLength: 32768 type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer reason: description: |- - reason is the reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - maxLength: 256 + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 minLength: 1 - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - maxLength: 32 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ type: string status: description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - maxLength: 256 - minLength: 1 + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: - lastTransitionTime + - message + - reason - status - type type: object type: array + initialization: + description: |- + Initialization provides observations of the Cluster initialization process. + NOTE: fields in this struct are part of the Cluster API contract and are used to orchestrate initial Cluster provisioning. + The value of those fields is never updated after provisioning is completed. + Use conditions to monitor the operational state of the Cluster's BootstrapSecret. + minProperties: 1 + properties: + controlPlaneInitialized: + description: |- + controlPlaneInitialized denotes when the control plane is functional enough to accept requests. + This information is usually used as a signal for starting all the provisioning operations that depends on + a functional API server, but do not require a full HA control plane to exists, like e.g. join worker Machines, + install core addons like CNI, CPI, CSI etc. + NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + The value of this field is never updated after initialization is completed. + type: boolean + infrastructureProvisioned: + description: |- + infrastructureProvisioned is true when the infrastructure provider reports that Cluster's infrastructure is fully provisioned. + NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + The value of this field is never updated after provisioning is completed. + type: boolean + type: object phase: description: |- Phase represents the current phase of cluster actuation. E.g. Pending, Running, Terminating, Failed etc. type: string - ready: - description: Ready is true when the provider resource is ready. - type: boolean type: object type: object served: true diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclustertemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclustertemplates.yaml index ed9df01f..7d084569 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclustertemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciclustertemplates.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhciclustertemplates.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -14,7 +14,7 @@ spec: singular: azurestackhciclustertemplate scope: Namespaced versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCIClusterTemplate is the Schema for the azurestackhciclustertemplates @@ -108,20 +108,21 @@ spec: controlPlaneEndpoint: description: ControlPlaneEndpoint represents the endpoint used to communicate with the control plane. + minProperties: 1 properties: host: description: host is the hostname on which the API server is serving. maxLength: 512 + minLength: 1 type: string port: description: port is the port on which the API server is serving. format: int32 + maximum: 65535 + minimum: 1 type: integer - required: - - host - - port type: object location: type: string diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciloadbalancers.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciloadbalancers.yaml index 232c50e9..6e7a16c2 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciloadbalancers.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhciloadbalancers.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhciloadbalancers.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -47,7 +47,7 @@ spec: jsonPath: .status.failedReplicas name: Unavailable type: integer - name: v1beta1 + name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCILoadBalancer is the Schema for the azurestackhciloadbalancers @@ -131,51 +131,56 @@ spec: conditions: description: Conditions defines current service state of the AzureStackHCILoadBalancer. items: - description: Condition defines an observation of a Cluster API resource - operational state. + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: description: |- message is a human readable message indicating details about the transition. - This field may be empty. - maxLength: 10240 - minLength: 1 + This may be an empty string. + maxLength: 32768 type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer reason: description: |- - reason is the reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - maxLength: 256 + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 minLength: 1 - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - maxLength: 32 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ type: string status: description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - maxLength: 256 - minLength: 1 + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: - lastTransitionTime + - message + - reason - status - type type: object diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml index 22c65e59..37035b23 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachines.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhcimachines.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -16,7 +16,7 @@ spec: singular: azurestackhcimachine scope: Namespaced versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCIMachine is the Schema for the azurestackhcimachines @@ -194,93 +194,79 @@ spec: conditions: description: Conditions defines current service state of the AzureStackHCIMachine. items: - description: Condition defines an observation of a Cluster API resource - operational state. + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: description: |- message is a human readable message indicating details about the transition. - This field may be empty. - maxLength: 10240 - minLength: 1 + This may be an empty string. + maxLength: 32768 type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer reason: description: |- - reason is the reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - maxLength: 256 + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 minLength: 1 - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - maxLength: 32 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ type: string status: description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - maxLength: 256 - minLength: 1 + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: - lastTransitionTime + - message + - reason - status - type type: object type: array - failureMessage: + initialization: description: |- - FailureMessage will be set in the event that there is a terminal problem - reconciling the Machine and will contain a more verbose string suitable - for logging and human consumption. - - This field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over - time (like service outages), but instead indicate that something is - fundamentally wrong with the Machine's spec or the configuration of - the controller, and that manual intervention is required. Examples - of terminal errors would be invalid combinations of settings in the - spec, values that are unsupported by the controller, or the - responsible controller itself being critically misconfigured. - - Any transient errors that occur during the reconciliation of Machines - can be added as events to the Machine object and/or logged in the - controller's output. - type: string - failureReason: - description: |- - FailureReason will be set in the event that there is a terminal problem - reconciling the Machine and will contain a succinct value suitable - for machine interpretation. - - This field should not be set for transitive errors that a controller - faces that are expected to be fixed automatically over - time (like service outages), but instead indicate that something is - fundamentally wrong with the Machine's spec or the configuration of - the controller, and that manual intervention is required. Examples - of terminal errors would be invalid combinations of settings in the - spec, values that are unsupported by the controller, or the - responsible controller itself being critically misconfigured. - - Any transient errors that occur during the reconciliation of Machines - can be added as events to the Machine object and/or logged in the - controller's output. - type: string + MachineInitializationStatus provides observations of the Machine initialization process. + NOTE: Fields in this struct are part of the Cluster API contract and are used to orchestrate initial Machine provisioning. + minProperties: 1 + properties: + bootstrapDataSecretCreated: + description: |- + bootstrapDataSecretCreated is true when the bootstrap provider reports that the Machine's boostrap secret is created. + NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + The value of this field is never updated after provisioning is completed. + type: boolean + infrastructureProvisioned: + description: |- + infrastructureProvisioned is true when the infrastructure provider reports that Machine's infrastructure is fully provisioned. + NOTE: this field is part of the Cluster API contract, and it is used to orchestrate provisioning. + The value of this field is never updated after provisioning is completed. + type: boolean + type: object ready: description: Ready is true when the provider resource is ready. type: boolean diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml index b8f68ad0..10cd04be 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcimachinetemplates.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhcimachinetemplates.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -16,7 +16,7 @@ spec: singular: azurestackhcimachinetemplate scope: Namespaced versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCIMachineTemplate is the Schema for the azurestackhcimachinetemplates diff --git a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml index 884ee31c..91bd18cb 100644 --- a/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml +++ b/config/crd/bases/infrastructure.cluster.x-k8s.io_azurestackhcivirtualmachines.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.17.2 + controller-gen.kubebuilder.io/version: v0.19.0 name: azurestackhcivirtualmachines.infrastructure.cluster.x-k8s.io spec: group: infrastructure.cluster.x-k8s.io @@ -16,7 +16,7 @@ spec: singular: azurestackhcivirtualmachine scope: Namespaced versions: - - name: v1beta1 + - name: v1beta2 schema: openAPIV3Schema: description: AzureStackHCIVirtualMachine is the Schema for the azurestackhcivirtualmachines @@ -214,51 +214,56 @@ spec: conditions: description: Conditions defines current service state of the AzureStackHCIVirtualMachine. items: - description: Condition defines an observation of a Cluster API resource - operational state. + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- lastTransitionTime is the last time the condition transitioned from one status to another. - This should be when the underlying condition changed. If that is not known, then using the time when - the API field changed is acceptable. + This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. format: date-time type: string message: description: |- message is a human readable message indicating details about the transition. - This field may be empty. - maxLength: 10240 - minLength: 1 + This may be an empty string. + maxLength: 32768 type: string + observedGeneration: + description: |- + observedGeneration represents the .metadata.generation that the condition was set based upon. + For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date + with respect to the current state of the instance. + format: int64 + minimum: 0 + type: integer reason: description: |- - reason is the reason for the condition's last transition in CamelCase. - The specific API may choose whether or not this field is considered a guaranteed API. - This field may be empty. - maxLength: 256 + reason contains a programmatic identifier indicating the reason for the condition's last transition. + Producers of specific condition types may define expected values and meanings for this field, + and whether the values are considered a guaranteed API. + The value should be a CamelCase string. + This field may not be empty. + maxLength: 1024 minLength: 1 - type: string - severity: - description: |- - severity provides an explicit classification of Reason code, so the users or machines can immediately - understand the current situation and act accordingly. - The Severity field MUST be set only when Status=False. - maxLength: 32 + pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$ type: string status: description: status of the condition, one of True, False, Unknown. + enum: + - "True" + - "False" + - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions - can be useful (see .node.status.conditions), the ability to deconflict is important. - maxLength: 256 - minLength: 1 + description: type of condition in CamelCase or in foo.example.com/CamelCase. + maxLength: 316 + pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string required: - lastTransitionTime + - message + - reason - status - type type: object diff --git a/config/crd/kustomization.yaml b/config/crd/kustomization.yaml index 5e0c2e17..6f54970a 100644 --- a/config/crd/kustomization.yaml +++ b/config/crd/kustomization.yaml @@ -26,7 +26,7 @@ kind: Kustomization labels: - includeSelectors: true pairs: - cluster.x-k8s.io/v1beta1: v1beta1 + cluster.x-k8s.io/v1beta2: v1beta2 patches: - path: patches/webhook_in_azurestackhcimachines.yaml - path: patches/webhook_in_azurestackhciclusters.yaml diff --git a/config/crd/patches/webhook_in_azurestackhciclusters.yaml b/config/crd/patches/webhook_in_azurestackhciclusters.yaml index 605c86ee..267fa8c3 100644 --- a/config/crd/patches/webhook_in_azurestackhciclusters.yaml +++ b/config/crd/patches/webhook_in_azurestackhciclusters.yaml @@ -8,7 +8,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1", "v1beta1"] + conversionReviewVersions: ["v1", "v1beta2"] clientConfig: service: namespace: system diff --git a/config/crd/patches/webhook_in_azurestackhciloadbalancers.yaml b/config/crd/patches/webhook_in_azurestackhciloadbalancers.yaml index 245c7320..45939077 100644 --- a/config/crd/patches/webhook_in_azurestackhciloadbalancers.yaml +++ b/config/crd/patches/webhook_in_azurestackhciloadbalancers.yaml @@ -8,7 +8,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1", "v1beta1"] + conversionReviewVersions: ["v1", "v1beta2"] clientConfig: service: namespace: system diff --git a/config/crd/patches/webhook_in_azurestackhcimachines.yaml b/config/crd/patches/webhook_in_azurestackhcimachines.yaml index 1e4d57f0..5beedf35 100644 --- a/config/crd/patches/webhook_in_azurestackhcimachines.yaml +++ b/config/crd/patches/webhook_in_azurestackhcimachines.yaml @@ -8,7 +8,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1", "v1beta1"] + conversionReviewVersions: ["v1", "v1beta2"] clientConfig: service: namespace: system diff --git a/config/crd/patches/webhook_in_azurestackhcimachinetemplates.yaml b/config/crd/patches/webhook_in_azurestackhcimachinetemplates.yaml index 25ed05bb..76305e1b 100644 --- a/config/crd/patches/webhook_in_azurestackhcimachinetemplates.yaml +++ b/config/crd/patches/webhook_in_azurestackhcimachinetemplates.yaml @@ -8,7 +8,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1", "v1beta1"] + conversionReviewVersions: ["v1", "v1beta2"] clientConfig: service: namespace: system diff --git a/config/crd/patches/webhook_in_azurestackhcivirtualmachines.yaml b/config/crd/patches/webhook_in_azurestackhcivirtualmachines.yaml index f3320b87..c07b5880 100644 --- a/config/crd/patches/webhook_in_azurestackhcivirtualmachines.yaml +++ b/config/crd/patches/webhook_in_azurestackhcivirtualmachines.yaml @@ -8,7 +8,7 @@ spec: conversion: strategy: Webhook webhook: - conversionReviewVersions: ["v1", "v1beta1"] + conversionReviewVersions: ["v1", "v1beta2"] clientConfig: service: namespace: system diff --git a/config/default/manager_image_patch.yaml b/config/default/manager_image_patch.yaml index 20847066..6c33419f 100644 --- a/config/default/manager_image_patch.yaml +++ b/config/default/manager_image_patch.yaml @@ -7,5 +7,5 @@ spec: template: spec: containers: - - image: mocimages.azurecr.io/caphcontroller:1.1.3 + - image: mocimages.azurecr.io/caphcontroller:1.1.23 name: manager diff --git a/config/default/webhookcainjection_patch.yaml b/config/default/webhookcainjection_patch.yaml index 6a0593fc..58189b40 100644 --- a/config/default/webhookcainjection_patch.yaml +++ b/config/default/webhookcainjection_patch.yaml @@ -3,7 +3,7 @@ # the variables $(CERTIFICATE_NAMESPACE) and $(CERTIFICATE_NAME) will be substituted by kustomize. # uncomment the following lines to enable mutating and validating webhook -#apiVersion: admissionregistration.k8s.io/v1beta1 +#apiVersion: admissionregistration.k8s.io/v1beta2 #kind: MutatingWebhookConfiguration #metadata: # name: mutating-webhook-configuration diff --git a/config/webhook/manifests.yaml b/config/webhook/manifests.yaml index d679d6a1..d8563133 100644 --- a/config/webhook/manifests.yaml +++ b/config/webhook/manifests.yaml @@ -8,12 +8,12 @@ #webhooks: #- admissionReviewVersions: # - v1 -# - v1beta1 +# - v1beta2 # clientConfig: # service: # name: webhook-service # namespace: system -# path: /validate-infrastructure-cluster-x-k8s-io-v1beta1-azurestackhcimachine +# path: /validate-infrastructure-cluster-x-k8s-io-v1beta2-azurestackhcimachine # failurePolicy: Fail # matchPolicy: Equivalent # name: validation.azurestackhcimachine.infrastructure.cluster.x-k8s.io @@ -21,7 +21,7 @@ # - apiGroups: # - infrastructure.cluster.x-k8s.io # apiVersions: -# - v1beta1 +# - v1beta2 # operations: # - CREATE # - UPDATE diff --git a/controllers/azurestackhcicluster_controller.go b/controllers/azurestackhcicluster_controller.go index 57735780..b74c785d 100644 --- a/controllers/azurestackhcicluster_controller.go +++ b/controllers/azurestackhcicluster_controller.go @@ -23,7 +23,7 @@ import ( "time" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/telemetry" @@ -35,7 +35,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" @@ -157,11 +157,29 @@ func (r *AzureStackHCIClusterReconciler) reconcileNormal(clusterScope *scope.Clu if err != nil { switch mocerrors.GetErrorCode(err) { case mocerrors.OutOfMemory.Error(): - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.OutOfMemoryReason, clusterv1.ConditionSeverityError, err.Error()) + notReady := metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfMemoryReason, + Message: err.Error(), + } + conditions.Set(azureStackHCICluster, notReady) case mocerrors.OutOfCapacity.Error(): - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.OutOfCapacityReason, clusterv1.ConditionSeverityError, err.Error()) + outOfCapacityCondition := metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfMemoryReason, + Message: err.Error(), + } + conditions.Set(azureStackHCICluster, outOfCapacityCondition) default: - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.ClusterReconciliationFailedReason, clusterv1.ConditionSeverityError, err.Error()) + generalErrorCondition := metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.ClusterReconciliationFailedReason, + Message: err.Error(), + } + conditions.Set(azureStackHCICluster, generalErrorCondition) } wrappedErr := errors.Wrap(err, "failed to reconcile cluster services") @@ -179,8 +197,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileNormal(clusterScope *scope.Clu } // No errors, so mark us ready so the Cluster API Cluster Controller can pull it - azureStackHCICluster.Status.Ready = true - conditions.MarkTrue(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition) + *azureStackHCICluster.Status.Initialization.InfrastructureProvisioned = true + readyCondition := metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionTrue, + } + conditions.Set(azureStackHCICluster, readyCondition) return reconcile.Result{}, nil } @@ -189,7 +211,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileDelete(clusterScope *scope.Clu clusterScope.Info("Reconciling AzureStackHCICluster delete") azureStackHCICluster := clusterScope.AzureStackHCICluster - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletedReason, clusterv1.ConditionSeverityInfo, "") + deletedCondition := metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "Deleted", + } + conditions.Set(azureStackHCICluster, deletedCondition) // Steps to delete a cluster // 1. Wait for machines in the cluster to be deleted @@ -200,7 +227,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileDelete(clusterScope *scope.Clu if err != nil { wrappedErr := errors.Wrapf(err, "unable to list AzureStackHCIMachines part of AzureStackHCIClusters %s/%s", clusterScope.AzureStackHCICluster.Namespace, clusterScope.AzureStackHCICluster.Name) r.Recorder.Eventf(azureStackHCICluster, corev1.EventTypeWarning, "FailureListMachinesInCluster", wrappedErr.Error()) - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(azureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return reconcile.Result{}, wrappedErr } @@ -210,12 +242,21 @@ func (r *AzureStackHCIClusterReconciler) reconcileDelete(clusterScope *scope.Clu if err != nil { wrappedErr := errors.Wrapf(err, "failed to delete orphaned AzureStackHCIMachines part of AzureStackHCIClusters %s/%s", clusterScope.AzureStackHCICluster.Namespace, clusterScope.AzureStackHCICluster.Name) r.Recorder.Eventf(azureStackHCICluster, corev1.EventTypeWarning, "FailureListMachinesInCluster", wrappedErr.Error()) - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(azureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return reconcile.Result{}, wrappedErr } clusterScope.Info("Waiting for AzureStackHCIMachines to be deleted", "count", len(azhciMachines)) - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.AzureStackHCIMachinesDeletingReason, clusterv1.ConditionSeverityWarning, "") + conditions.Set(azureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.AzureStackHCIMachinesDeletingReason, + }) return reconcile.Result{RequeueAfter: 20 * time.Second}, nil } @@ -233,14 +274,21 @@ func (r *AzureStackHCIClusterReconciler) reconcileDelete(clusterScope *scope.Clu // Try to get the AzureStackHCILoadBalancer; if it still exists, requeue if err := r.Client.Get(clusterScope.Context, azureStackHCILoadBalancerName, azureStackHCILoadBalancer); err == nil { clusterScope.Info("Waiting for AzureStackHCILoadBalancer to be deleted", "name", azureStackHCILoadBalancerName.Name) - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.LoadBalancerDeletingReason, clusterv1.ConditionSeverityWarning, "") + conditions.Set(azureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerDeletingReason, + }) return reconcile.Result{RequeueAfter: 20 * time.Second}, nil } if err := newAzureStackHCIClusterReconciler(clusterScope).Delete(); err != nil { wrappedErr := errors.Wrapf(err, "error deleting AzureStackHCICluster %s/%s", azureStackHCICluster.Namespace, azureStackHCICluster.Name) r.Recorder.Eventf(azureStackHCICluster, corev1.EventTypeWarning, "FailureClusterDelete", wrappedErr.Error()) - conditions.MarkFalse(azureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(azureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Reason: "DeletionFailed", + Message: err.Error()}) return reconcile.Result{}, wrappedErr } @@ -334,7 +382,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileAzureStackHCILoadBalancer(clus } if err != nil { if !apierrors.IsAlreadyExists(err) { - conditions.MarkFalse(clusterScope.AzureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.LoadBalancerProvisioningReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(clusterScope.AzureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerProvisioningReason, + Message: err.Error(), + }) return false, err } } @@ -342,7 +395,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileAzureStackHCILoadBalancer(clus // Wait for the load balancer to be fully provisioned if conditions.IsFalse(azureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition) { cond := conditions.Get(azureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition) - conditions.MarkFalse(clusterScope.AzureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, cond.Reason, cond.Severity, cond.Message) + conditions.Set(clusterScope.AzureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: cond.Reason, + Message: cond.Message, + }) return false, nil } @@ -381,7 +439,11 @@ func (r *AzureStackHCIClusterReconciler) reconcileDeleteAzureStackHCILoadBalance infrav1util.CopyCorrelationID(clusterScope.AzureStackHCICluster, azureStackHCILoadBalancer) if err := r.Client.Update(clusterScope.Context, azureStackHCILoadBalancer); err != nil { if !apierrors.IsNotFound(err) { - conditions.MarkFalse(clusterScope.AzureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(clusterScope.AzureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error()}) return errors.Wrapf(err, "Failed to update AzureStackHCILoadBalancer %s", azureStackHCILoadBalancerName) } } @@ -396,7 +458,12 @@ func (r *AzureStackHCIClusterReconciler) reconcileDeleteAzureStackHCILoadBalance err) if err != nil { if !apierrors.IsNotFound(err) { - conditions.MarkFalse(clusterScope.AzureStackHCICluster, infrav1.NetworkInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(clusterScope.AzureStackHCICluster, metav1.Condition{ + Type: infrav1.NetworkInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return errors.Wrapf(err, "Failed to delete AzureStackHCILoadBalancer %s", azureStackHCILoadBalancerName) } } @@ -412,11 +479,11 @@ func (r *AzureStackHCIClusterReconciler) reconcilePhase(clusterScope *scope.Clus azureStackHCICluster.Status.SetTypedPhase(infrav1.AzureStackHCIClusterPhasePending) } - if !azureStackHCICluster.Status.Ready { + if !*azureStackHCICluster.Status.Initialization.InfrastructureProvisioned { azureStackHCICluster.Status.SetTypedPhase(infrav1.AzureStackHCIClusterPhaseProvisioning) } - if azureStackHCICluster.Status.Ready { // && azureStackHCICluster.Spec.ControlPlaneEndpoint.IsValid() { + if *azureStackHCICluster.Status.Initialization.InfrastructureProvisioned { azureStackHCICluster.Status.SetTypedPhase(infrav1.AzureStackHCIClusterPhaseProvisioned) } diff --git a/controllers/azurestackhciloadbalancer_controller.go b/controllers/azurestackhciloadbalancer_controller.go index c9c1d595..1c0f1508 100644 --- a/controllers/azurestackhciloadbalancer_controller.go +++ b/controllers/azurestackhciloadbalancer_controller.go @@ -23,7 +23,7 @@ import ( "time" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/services/loadbalancers" @@ -33,8 +33,8 @@ import ( "github.com/pkg/errors" corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" @@ -188,7 +188,12 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileNormal(lbs *scope.LoadBal result, err := r.reconcileVirtualMachines(lbs, clusterScope) if err != nil { r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeWarning, "FailureReconcileLBMachines", errors.Wrapf(err, "Failed to reconcile LoadBalancer machines").Error()) - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerMachineReconciliationFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerMachineReconciliationFailedReason, + Message: err.Error(), + }) return reconcile.Result{}, err } @@ -197,11 +202,26 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileNormal(lbs *scope.LoadBal if err != nil { switch mocerrors.GetErrorCode(err) { case mocerrors.OutOfMemory.Error(): - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.OutOfMemoryReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfMemoryReason, + Message: err.Error(), + }) case mocerrors.OutOfCapacity.Error(): - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.OutOfCapacityReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfCapacityReason, + Message: err.Error(), + }) default: - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerServiceReconciliationFailedReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerServiceReconciliationFailedReason, + Message: err.Error(), + }) } r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeWarning, "FailureReconcileLB", errors.Wrapf(err, "Failed to reconcile LoadBalancer service").Error()) @@ -212,12 +232,22 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileNormal(lbs *scope.LoadBal err := r.reconcileLoadBalancerServiceStatus(lbs, clusterScope) if err != nil { r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeWarning, "FailureReconcileLBStatus", errors.Wrapf(err, "Failed to reconcile LoadBalancer service status").Error()) - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerServiceStatusFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerServiceStatusFailedReason, + Message: err.Error(), + }) return reconcile.Result{}, err } if lbs.Address() == "" { lbs.Info("LoadBalancer service address is not available yet") - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerAddressUnavailableReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerAddressUnavailableReason, + Message: "", + }) return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 20}, nil } } @@ -231,12 +261,20 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileNormal(lbs *scope.LoadBal } lbs.Info("Waiting for at least one replica to be ready") - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerNoReplicasReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerNoReplicasReadyReason, + Message: "", + }) return reconcile.Result{Requeue: true, RequeueAfter: time.Second * 20}, nil } if conditions.IsFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition) { - conditions.MarkTrue(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionTrue, + }) r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeNormal, "LoadBalancerReady", "AzureStackHCILoadBalancer %s infrastructure is ready", lbs.Name()) } @@ -294,18 +332,33 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileDelete(lbs *scope.LoadBal if err := r.reconcileDeleteLoadBalancerService(lbs, clusterScope); err != nil { r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeWarning, "FailureDeleteLoadBalancer", errors.Wrapf(err, "Error deleting AzureStackHCILoadBalancer %s", lbs.Name()).Error()) - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return reconcile.Result{}, err } if err := r.reconcileDeleteVirtualMachines(lbs, clusterScope); err != nil { r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeWarning, "FailureDeleteLoadBalancerMachines", errors.Wrapf(err, "Error deleting machines for AzureStackHCILoadBalancer %s", lbs.Name()).Error()) - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return reconcile.Result{}, err } controllerutil.RemoveFinalizer(lbs.AzureStackHCILoadBalancer, infrav1.AzureStackHCILoadBalancerFinalizer) - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerInfrastructureReadyCondition, infrav1.LoadBalancerDeletingReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerDeletingReason, + Message: "", + }) r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeNormal, "SuccessfulDeleteLoadBalancer", "Successfully deleted AzureStackHCILoadBalancer %s", lbs.Name()) return reconcile.Result{}, nil @@ -349,9 +402,14 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileStatus(lbs *scope.LoadBal } if conditions.IsFalse(lb, infrav1.LoadBalancerReplicasReadyCondition) { - if *conditions.GetSeverity(lb, infrav1.LoadBalancerReplicasReadyCondition) == clusterv1.ConditionSeverityError { - cond := conditions.Get(lb, infrav1.LoadBalancerReplicasReadyCondition) - conditions.MarkFalse(lb, infrav1.LoadBalancerInfrastructureReadyCondition, cond.Reason, cond.Severity, cond.Message) + cond := conditions.Get(lb, infrav1.LoadBalancerReplicasReadyCondition) + if cond != nil && cond.Reason == infrav1.LoadBalancerReplicasFailedReason { + conditions.Set(lb, metav1.Condition{ + Type: infrav1.LoadBalancerInfrastructureReadyCondition, + Status: metav1.ConditionFalse, + Reason: cond.Reason, + Message: cond.Message, + }) } if conditions.GetReason(lb, infrav1.LoadBalancerReplicasReadyCondition) == infrav1.LoadBalancerReplicasUpgradingReason { diff --git a/controllers/azurestackhciloadbalancer_virtualmachine.go b/controllers/azurestackhciloadbalancer_virtualmachine.go index 602a86b0..9164e8b0 100644 --- a/controllers/azurestackhciloadbalancer_virtualmachine.go +++ b/controllers/azurestackhciloadbalancer_virtualmachine.go @@ -23,7 +23,7 @@ import ( "time" "github.com/Azure/go-autorest/autorest/to" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/telemetry" @@ -32,7 +32,6 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/conditions" "sigs.k8s.io/controller-runtime/pkg/client" @@ -49,8 +48,13 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop for _, vm := range loadBalancerVMs { if conditions.IsFalse(vm, infrav1.VMRunningCondition) { cond := conditions.Get(vm, infrav1.VMRunningCondition) - if cond.Severity == clusterv1.ConditionSeverityError { - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition, cond.Reason, cond.Severity, cond.Message) + if cond != nil && (cond.Reason != "") { + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionFalse, + Reason: cond.Reason, + Message: cond.Message, + }) return reconcile.Result{}, nil } } @@ -67,7 +71,12 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop // some replicas are no longer ready. Unless a scale down operation was requested we will wait for them to become ready again if !r.isScaleDownRequired(lbs) { - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition, infrav1.LoadBalancerWaitingForReplicasReadyReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerWaitingForReplicasReadyReason, + Message: "", + }) return reconcile.Result{Requeue: true, RequeueAfter: time.Minute}, nil } } @@ -75,7 +84,11 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop // check if we need to scale up if r.isScaleUpRequired(lbs) { if !r.replicasAreUpgrading(lbs) { - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition, infrav1.LoadBalancerReplicasScalingUpReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerReplicasScalingUpReason, + }) } err = r.scaleUpVirtualMachines(lbs, clusterScope) @@ -89,7 +102,11 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop // check if we need to scale down if r.isScaleDownRequired(lbs) { if !r.replicasAreUpgrading(lbs) { - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition, infrav1.LoadBalancerReplicasScalingDownReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerReplicasScalingDownReason, + }) } err = r.scaleDownVirtualMachines(lbs, clusterScope, loadBalancerVMs) @@ -102,7 +119,11 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop // check if we need to upgrade if r.isUpgradeRequired(lbs, loadBalancerVMs) { - conditions.MarkFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition, infrav1.LoadBalancerReplicasUpgradingReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.LoadBalancerReplicasUpgradingReason, + }) r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeNormal, "UpgradingLoadBalancer", "Upgrading AzureStackHCILoadBalancer %s", lbs.Name()) for lbs.GetReplicas() < lbs.GetMaxReplicas() { @@ -116,7 +137,10 @@ func (r *AzureStackHCILoadBalancerReconciler) reconcileVirtualMachines(lbs *scop // desired state was achieved if conditions.IsFalse(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition) { - conditions.MarkTrue(lbs.AzureStackHCILoadBalancer, infrav1.LoadBalancerReplicasReadyCondition) + conditions.Set(lbs.AzureStackHCILoadBalancer, metav1.Condition{ + Type: infrav1.LoadBalancerReplicasReadyCondition, + Status: metav1.ConditionTrue, + }) r.Recorder.Eventf(lbs.AzureStackHCILoadBalancer, corev1.EventTypeNormal, "LoadBalancerReplicasReady", "All replicas for AzureStackHCILoadBalancer %s are ready", lbs.Name()) } diff --git a/controllers/azurestackhcimachine_annotations.go b/controllers/azurestackhcimachine_annotations.go index ac5fa776..b9c9cfff 100644 --- a/controllers/azurestackhcimachine_annotations.go +++ b/controllers/azurestackhcimachine_annotations.go @@ -20,7 +20,7 @@ package controllers import ( "encoding/json" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" ) // updateMachineAnnotationJSON updates the `annotation` on `machine` with diff --git a/controllers/azurestackhcimachine_controller.go b/controllers/azurestackhcimachine_controller.go index 96220e17..2f3228f4 100644 --- a/controllers/azurestackhcimachine_controller.go +++ b/controllers/azurestackhcimachine_controller.go @@ -23,9 +23,8 @@ import ( "fmt" - "github.com/Azure/go-autorest/autorest/to" "github.com/go-logr/logr" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/telemetry" @@ -38,9 +37,9 @@ import ( apitypes "k8s.io/apimachinery/pkg/types" kerrors "k8s.io/apimachinery/pkg/util/errors" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - capierrors "sigs.k8s.io/cluster-api/errors" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" "sigs.k8s.io/cluster-api/util" + "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" @@ -194,7 +193,10 @@ func (r *AzureStackHCIMachineReconciler) Reconcile(ctx context.Context, req ctrl func (r *AzureStackHCIMachineReconciler) reconcileNormal(machineScope *scope.MachineScope, clusterScope *scope.ClusterScope) (reconcile.Result, error) { machineScope.Info("Reconciling AzureStackHCIMachine") // If the AzureStackHCIMachine is in an error state, return early. - if machineScope.AzureStackHCIMachine.Status.FailureReason != nil || machineScope.AzureStackHCIMachine.Status.FailureMessage != nil { + // In v1beta2, we check conditions for error states + vmRunningCondition := conditions.Get(machineScope.AzureStackHCIMachine, infrav1.VMRunningCondition) + if vmRunningCondition != nil && vmRunningCondition.Status == metav1.ConditionFalse && + (vmRunningCondition.Reason != "") { machineScope.Info("Error state detected, skipping reconciliation") r.Recorder.Eventf(machineScope.AzureStackHCIMachine, corev1.EventTypeWarning, "ErrorStateAzureStackHCIMachine", "AzureStackHCIMachine is in an error state") return reconcile.Result{}, nil @@ -207,7 +209,7 @@ func (r *AzureStackHCIMachineReconciler) reconcileNormal(machineScope *scope.Mac return reconcile.Result{}, err } - if !machineScope.Cluster.Status.InfrastructureReady { + if machineScope.Cluster.Status.Initialization.InfrastructureProvisioned == nil || !*machineScope.Cluster.Status.Initialization.InfrastructureProvisioned { machineScope.Info("Cluster infrastructure is not ready yet") return reconcile.Result{}, nil } @@ -254,8 +256,12 @@ func (r *AzureStackHCIMachineReconciler) reconcileNormal(machineScope *scope.Mac case infrav1.VMStateUpdating: machineScope.Info("Machine VM is updating", "name", vm.Name) default: - machineScope.SetFailureReason(capierrors.UpdateMachineError) - machineScope.SetFailureMessage(errors.Errorf("AzureStackHCI VM state %q is unexpected", *machineScope.GetVMState())) + conditions.Set(machineScope.AzureStackHCIMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.VMProvisionFailedReason, + Message: fmt.Sprintf("AzureStackHCI VM state %q is unexpected", *machineScope.GetVMState()), + }) } return reconcile.Result{}, nil @@ -496,5 +502,5 @@ func (r *AzureStackHCIMachineReconciler) getVMImage(scope *scope.MachineScope) ( return &scope.AzureStackHCIMachine.Spec.Image, nil } - return azurestackhci.GetDefaultImage(scope.AzureStackHCIMachine.Spec.Image.OSType, to.String(scope.Machine.Spec.Version)) + return azurestackhci.GetDefaultImage(scope.AzureStackHCIMachine.Spec.Image.OSType, scope.Machine.Spec.Version) } diff --git a/controllers/azurestackhcimachine_controller_test.go b/controllers/azurestackhcimachine_controller_test.go index 3f562f55..1ae30830 100644 --- a/controllers/azurestackhcimachine_controller_test.go +++ b/controllers/azurestackhcimachine_controller_test.go @@ -4,7 +4,7 @@ import ( "context" "time" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" mock8sclient "github.com/microsoft/cluster-api-provider-azurestackhci/test/mocks/k8s/client" . "github.com/onsi/ginkgo/v2" @@ -12,7 +12,7 @@ import ( "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" apitypes "k8s.io/apimachinery/pkg/types" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/log" ) diff --git a/controllers/azurestackhcivirtualmachine_controller.go b/controllers/azurestackhcivirtualmachine_controller.go index 6ae5d7a4..ab333ec8 100644 --- a/controllers/azurestackhcivirtualmachine_controller.go +++ b/controllers/azurestackhcivirtualmachine_controller.go @@ -19,6 +19,7 @@ package controllers import ( "context" + "fmt" "github.com/go-logr/logr" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" @@ -29,10 +30,9 @@ import ( corev1 "k8s.io/api/core/v1" apierrors "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" "k8s.io/client-go/tools/record" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" - capierrors "sigs.k8s.io/cluster-api/errors" "sigs.k8s.io/cluster-api/util/conditions" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -40,7 +40,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil" "sigs.k8s.io/controller-runtime/pkg/reconcile" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" ) // AzureStackHCIVirtualMachineReconciler reconciles a AzureStackHCIVirtualMachine object @@ -175,15 +175,26 @@ func (r *AzureStackHCIVirtualMachineReconciler) reconcileNormal(virtualMachineSc case infrav1.VMStateSucceeded: virtualMachineScope.Info("Machine VM is running", "name", virtualMachineScope.Name()) virtualMachineScope.SetReady() - conditions.MarkTrue(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionTrue, + }) case infrav1.VMStateUpdating: virtualMachineScope.Info("Machine VM is updating", "name", virtualMachineScope.Name()) - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.VMUpdatingReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.VMUpdatingReason, + Message: "", + }) default: - virtualMachineScope.SetFailureReason(capierrors.UpdateMachineError) - virtualMachineScope.SetFailureMessage(errors.Errorf("AzureStackHCI VM state %q is unexpected", vm.State)) r.Recorder.Eventf(virtualMachineScope.AzureStackHCIVirtualMachine, corev1.EventTypeWarning, "UnexpectedVMState", "AzureStackHCIVirtualMachine is in an unexpected state %q", vm.State) - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.VMProvisionFailedReason, clusterv1.ConditionSeverityWarning, "") + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.VMProvisionFailedReason, + Message: fmt.Sprintf("AzureStackHCI VM state %q is unexpected", vm.State), + }) } return reconcile.Result{}, nil @@ -195,7 +206,12 @@ func (r *AzureStackHCIVirtualMachineReconciler) getOrCreate(virtualMachineScope if err != nil { wrappedErr := errors.Wrapf(err, "Failed to query for AzureStackHCIVirtualMachine %s/%s", virtualMachineScope.Namespace(), virtualMachineScope.Name()) r.Recorder.Eventf(virtualMachineScope.AzureStackHCIVirtualMachine, corev1.EventTypeWarning, "FailureQueryForVM", wrappedErr.Error()) - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.VMNotFoundReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.VMNotFoundReason, + Message: err.Error(), + }) return nil, err } @@ -206,22 +222,52 @@ func (r *AzureStackHCIVirtualMachineReconciler) getOrCreate(virtualMachineScope if err != nil { switch mocerrors.GetErrorCode(err) { case mocerrors.OutOfMemory.Error(): - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.OutOfMemoryReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfMemoryReason, + Message: err.Error(), + }) case mocerrors.OutOfCapacity.Error(): - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.OutOfCapacityReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfCapacityReason, + Message: err.Error(), + }) case mocerrors.OutOfNodeCapacity.Error(): - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.OutOfNodeCapacityReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.OutOfNodeCapacityReason, + Message: err.Error(), + }) case mocerrors.NotFound.Error(): // "NotFound" fallthrough // Internally, NotFound is a legacy error and returns the error string instead. case moccodes.NotFound.String(): // "Not Found" if mocerrors.IsPathNotFound(err) { - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.PathNotFoundReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.PathNotFoundReason, + Message: err.Error(), + }) } else { - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.NotFoundReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.NotFoundReason, + Message: err.Error(), + }) } default: - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, infrav1.VMProvisionFailedReason, clusterv1.ConditionSeverityError, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: infrav1.VMProvisionFailedReason, + Message: err.Error(), + }) } wrappedErr := errors.Wrapf(err, "failed to create AzureStackHCIVirtualMachine") @@ -238,12 +284,22 @@ func (r *AzureStackHCIVirtualMachineReconciler) getOrCreate(virtualMachineScope func (r *AzureStackHCIVirtualMachineReconciler) reconcileDelete(virtualMachineScope *scope.VirtualMachineScope) (_ reconcile.Result, reterr error) { virtualMachineScope.Info("Handling deleted AzureStackHCIVirtualMachine", "Name", virtualMachineScope.Name()) - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, clusterv1.DeletingReason, clusterv1.ConditionSeverityInfo, "") + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: "Deleting", + Message: "", + }) if err := newAzureStackHCIVirtualMachineService(virtualMachineScope).Delete(); err != nil { wrappedErr := errors.Wrapf(err, "error deleting AzureStackHCIVirtualMachine %s/%s", virtualMachineScope.Namespace(), virtualMachineScope.Name()) r.Recorder.Eventf(virtualMachineScope.AzureStackHCIVirtualMachine, corev1.EventTypeWarning, "FailureDeleteVM", wrappedErr.Error()) - conditions.MarkFalse(virtualMachineScope.AzureStackHCIVirtualMachine, infrav1.VMRunningCondition, clusterv1.DeletionFailedReason, clusterv1.ConditionSeverityWarning, err.Error()) + conditions.Set(virtualMachineScope.AzureStackHCIVirtualMachine, metav1.Condition{ + Type: infrav1.VMRunningCondition, + Status: metav1.ConditionFalse, + Reason: "DeletionFailed", + Message: err.Error(), + }) return reconcile.Result{}, wrappedErr } r.Recorder.Eventf(virtualMachineScope.AzureStackHCIVirtualMachine, corev1.EventTypeNormal, "SuccessfulDeleteVM", "Success deleting AzureStackHCIVirtualMachine %s/%s", virtualMachineScope.Namespace(), virtualMachineScope.Name()) diff --git a/controllers/azurestackhcivirtualmachine_reconciler.go b/controllers/azurestackhcivirtualmachine_reconciler.go index 1c574556..ab4c0e43 100644 --- a/controllers/azurestackhcivirtualmachine_reconciler.go +++ b/controllers/azurestackhcivirtualmachine_reconciler.go @@ -21,7 +21,7 @@ import ( "encoding/base64" "time" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" azurestackhci "github.com/microsoft/cluster-api-provider-azurestackhci/cloud" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/scope" "github.com/microsoft/cluster-api-provider-azurestackhci/cloud/services/disks" diff --git a/controllers/controllers_suite_test.go b/controllers/controllers_suite_test.go index 0bcd1b7e..957b882c 100644 --- a/controllers/controllers_suite_test.go +++ b/controllers/controllers_suite_test.go @@ -8,14 +8,14 @@ import ( "testing" "time" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/onsi/gomega/gexec" "k8s.io/client-go/kubernetes/scheme" "k8s.io/client-go/tools/record" "k8s.io/klog/v2" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" diff --git a/go.mod b/go.mod index 051d6425..85d677f8 100644 --- a/go.mod +++ b/go.mod @@ -1,27 +1,27 @@ module github.com/microsoft/cluster-api-provider-azurestackhci -go 1.23.0 +go 1.24.0 require ( github.com/Azure/go-autorest/autorest/to v0.4.0 github.com/blang/semver v3.5.1+incompatible - github.com/go-logr/logr v1.4.2 + github.com/go-logr/logr v1.4.3 github.com/golang/mock v1.6.0 github.com/microsoft/moc v0.25.0 github.com/microsoft/moc-sdk-for-go v0.24.2 github.com/onsi/ginkgo/v2 v2.23.4 - github.com/onsi/gomega v1.36.3 + github.com/onsi/gomega v1.38.0 github.com/pkg/errors v0.9.1 - github.com/spf13/pflag v1.0.6 - golang.org/x/crypto v0.36.0 - google.golang.org/grpc v1.67.3 - k8s.io/api v0.32.3 - k8s.io/apimachinery v0.32.3 - k8s.io/client-go v0.32.3 + github.com/spf13/pflag v1.0.7 + golang.org/x/crypto v0.40.0 + google.golang.org/grpc v1.71.3 + k8s.io/api v0.33.3 + k8s.io/apimachinery v0.33.3 + k8s.io/client-go v0.33.3 k8s.io/klog/v2 v2.130.1 k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 - sigs.k8s.io/cluster-api v1.10.3 - sigs.k8s.io/controller-runtime v0.20.4 + sigs.k8s.io/cluster-api v1.11.1 + sigs.k8s.io/controller-runtime v0.21.0 ) require ( @@ -43,19 +43,17 @@ require ( github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.23.0 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect - github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/gobuffalo/flect v1.0.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect - github.com/golang-jwt/jwt/v4 v4.5.0 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/gnostic-models v0.6.9 // indirect github.com/google/go-cmp v0.7.0 // indirect - github.com/google/gofuzz v1.2.0 // indirect github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/uuid v1.6.0 // indirect github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -64,44 +62,45 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect - github.com/prometheus/client_golang v1.19.1 // indirect + github.com/prometheus/client_golang v1.22.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.62.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/sagikazarmark/locafero v0.7.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.12.0 // indirect github.com/spf13/cast v1.7.1 // indirect - github.com/spf13/cobra v1.9.1 // indirect - github.com/spf13/viper v1.20.0 // indirect + github.com/spf13/viper v1.20.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/x448/float16 v0.8.4 // indirect - go.opentelemetry.io/otel v1.29.0 // indirect - go.opentelemetry.io/otel/trace v1.29.0 // indirect + go.opentelemetry.io/otel v1.34.0 // indirect + go.opentelemetry.io/otel/trace v1.34.0 // indirect go.uber.org/automaxprocs v1.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/net v0.38.0 // indirect - golang.org/x/oauth2 v0.28.0 // indirect - golang.org/x/sync v0.12.0 // indirect - golang.org/x/sys v0.32.0 // indirect - golang.org/x/term v0.30.0 // indirect - golang.org/x/text v0.23.0 // indirect - golang.org/x/time v0.8.0 // indirect - golang.org/x/tools v0.31.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/net v0.42.0 // indirect + golang.org/x/oauth2 v0.30.0 // indirect + golang.org/x/sync v0.16.0 // indirect + golang.org/x/sys v0.34.0 // indirect + golang.org/x/term v0.33.0 // indirect + golang.org/x/text v0.27.0 // indirect + golang.org/x/time v0.9.0 // indirect + golang.org/x/tools v0.34.0 // indirect gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect - google.golang.org/protobuf v1.36.5 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f // indirect + google.golang.org/protobuf v1.36.6 // indirect gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect - k8s.io/apiextensions-apiserver v0.32.3 // indirect - k8s.io/cluster-bootstrap v0.32.3 // indirect - k8s.io/component-base v0.32.3 // indirect + k8s.io/apiextensions-apiserver v0.33.3 // indirect + k8s.io/cluster-bootstrap v0.33.3 // indirect + k8s.io/component-base v0.33.3 // indirect k8s.io/klog v1.0.0 // indirect - k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f // indirect + k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect - sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index 8f1be9c4..a479c7d6 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,5 @@ -cel.dev/expr v0.18.0 h1:CJ6drgk+Hf96lkLikr4rFf19WrU0BOWEihyZnI2TAzo= -cel.dev/expr v0.18.0/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw= +cel.dev/expr v0.19.1 h1:NciYrtDRIR0lNCnH1LFJegdjspNx9fI59O7TWcua/W4= +cel.dev/expr v0.19.1/go.mod h1:MrpN08Q+lEBs+bGYdLxxHkZoUSsCp0nSKTs0nTymJgw= dario.cat/mergo v1.0.1 h1:Ra4+bf83h2ztPIQYNP99R6m+Y7KfnARDfID+a+vLl4s= dario.cat/mergo v1.0.1/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs= @@ -30,8 +30,6 @@ github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0= github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= -github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= @@ -44,9 +42,8 @@ github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UF github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/coredns/caddy v1.1.1 h1:2eYKZT7i6yxIfGP3qLJoJ7HAsDJqYB+X68g4NYjSrE0= github.com/coredns/caddy v1.1.1/go.mod h1:A6ntJQlAWuQfFlsd9hvigKbo2WS0VUs2l1e2F+BawD4= -github.com/coredns/corefile-migration v1.0.26 h1:xiiEkVB1Dwolb24pkeDUDBfygV9/XsOSq79yFCrhptY= -github.com/coredns/corefile-migration v1.0.26/go.mod h1:56DPqONc3njpVPsdilEnfijCwNGC3/kTJLl7i7SPavY= -github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/coredns/corefile-migration v1.0.27 h1:WIIw5sU0LfGgoGnhdrYdVcto/aWmJoGA/C62iwkU0JM= +github.com/coredns/corefile-migration v1.0.27/go.mod h1:56DPqONc3njpVPsdilEnfijCwNGC3/kTJLl7i7SPavY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -69,8 +66,8 @@ github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8 github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E= github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= -github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY= -github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= @@ -85,8 +82,8 @@ github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+Gr github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= -github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= -github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= +github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gobuffalo/flect v1.0.3 h1:xeWBM2nui+qnVvNM4S3foBhCAL2XgPU+a7FdpelbTq4= github.com/gobuffalo/flect v1.0.3/go.mod h1:A5msMlrHtLqh9umBSnvabjsMrCcCpAyzglnDvkbYKHs= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= @@ -101,10 +98,10 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.22.0 h1:b3FJZxpiv1vTMo2/5RDUqAHPxkT8mmMfJIrq1llbf7g= -github.com/google/cel-go v0.22.0/go.mod h1:BuznPXXfQDpXKWQ9sPW3TzlAJN5zzFe+i9tIs0yC4s8= -github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= -github.com/google/gnostic-models v0.6.8/go.mod h1:5n7qKqH0f5wFt+aWF8CW6pZLLNOfYuF5OpfBSENuI8U= +github.com/google/cel-go v0.23.2 h1:UdEe3CvQh3Nv+E/j9r1Y//WO0K0cSyD7/y0bzyLIMI4= +github.com/google/cel-go v0.23.2/go.mod h1:52Pb6QsDbC5kvgxvZhiL9QX1oZEkcUF/ZqaPx1J5Wwo= +github.com/google/gnostic-models v0.6.9 h1:MU/8wDLif2qCXZmzncUQ/BOfxWfthHi63KqpoNbWqVw= +github.com/google/gnostic-models v0.6.9/go.mod h1:CiWsm0s6BSQd1hRn8/QmxqB6BesYcbSZxsz9b0KuDBw= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= @@ -116,8 +113,8 @@ github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0 h1:TmHmbvxPmaegwhDubVz0lICL0J5Ka2vwTzhoePEXsGE= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.24.0/go.mod h1:qztMSjm835F2bXf+5HKAPIS5qsmQDqZna/PgVt4rWtI= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb h1:PGufWXXDq9yaev6xX1YQauaO1MV90e6Mpoq1I7Lz/VM= github.com/hectane/go-acl v0.0.0-20230122075934-ca0b05cb1adb/go.mod h1:QiyDdbZLaJ/mZP4Zwc9g2QsfaEA4o7XvvgZegSci5/E= github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= @@ -134,6 +131,8 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -141,6 +140,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/microsoft/moc v0.25.0 h1:lgGesosWrJQ9UauTHR9ZXHtaM2YiurgnK514AXCpC9E= @@ -160,8 +161,8 @@ github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus= github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8= -github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU= -github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0= +github.com/onsi/gomega v1.38.0 h1:c/WX+w8SLAinvuKKQFh77WEucCnPk4j2OTUr7lt7BeY= +github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJEB6o= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= @@ -173,17 +174,16 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRI github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.22.0 h1:rb93p9lokFEsctTys46VnV1kLCDpVZ0a/Y92Vm0Zc6Q= +github.com/prometheus/client_golang v1.22.0/go.mod h1:R7ljNsLXhuQXYZYtw6GAE9AZg8Y7vEW5scdCXrWRXC0= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.62.0 h1:xasJaQlnWAeyHdUBeGjXmutelfJHWMRr+Fg4QszZ2Io= +github.com/prometheus/common v0.62.0/go.mod h1:vyBcEuLSvWos9B1+CyL7JZ2up+uFzXhkqml0W5zIY1I= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= -github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= -github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k= @@ -196,15 +196,17 @@ github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/viper v1.20.0 h1:zrxIyR3RQIOsarIrgL8+sAvALXul9jeEPa06Y0Ph6vY= -github.com/spf13/viper v1.20.0/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= +github.com/spf13/pflag v1.0.7 h1:vN6T9TfwStFPFM5XzjsvmzZkLuaLX+HS+0SeFLRgU6M= +github.com/spf13/pflag v1.0.7/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= +github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= @@ -220,22 +222,24 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0 h1:KfYpVmrjI7JuToy5k8XV3nkapjWx48k4E4JOtVstzQI= go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.44.0/go.mod h1:SeQhzAEccGVZVEy7aH87Nh0km+utSpo1pTv6eMMop48= -go.opentelemetry.io/otel v1.29.0 h1:PdomN/Al4q/lN6iBJEN3AwPvUiHPMlt93c8bqTG5Llw= -go.opentelemetry.io/otel v1.29.0/go.mod h1:N/WtXPs1CNCUEx+Agz5uouwCba+i+bJGFicT8SR4NP8= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0 h1:3Q/xZUyC1BBkualc9ROb4G8qkH90LXEIICcs5zv1OYY= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.28.0/go.mod h1:s75jGIWA9OfCMzF0xr+ZgfrB5FEbbV7UuYo32ahUiFI= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0 h1:qFffATk0X+HD+f1Z8lswGiOQYKHRlzfmdJm0wEaVrFA= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0/go.mod h1:MOiCmryaYtc+V0Ei+Tx9o5S1ZjA7kzLucuVuyzBZloQ= -go.opentelemetry.io/otel/metric v1.29.0 h1:vPf/HFWTNkPu1aYeIsc98l4ktOQaL6LeSoeV2g+8YLc= -go.opentelemetry.io/otel/metric v1.29.0/go.mod h1:auu/QWieFVWx+DmQOUMgj0F8LHWdgalxXqvp7BII/W8= -go.opentelemetry.io/otel/sdk v1.29.0 h1:vkqKjk7gwhS8VaWb0POZKmIEDimRCMsopNYnriHyryo= -go.opentelemetry.io/otel/sdk v1.29.0/go.mod h1:pM8Dx5WKnvxLCb+8lG1PRNIDxu9g9b9g59Qr7hfAAok= -go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt39JTi4= -go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ= -go.opentelemetry.io/proto/otlp v1.3.1 h1:TrMUixzpM0yuc/znrFTP9MMRh8trP93mkCiDVeXrui0= -go.opentelemetry.io/proto/otlp v1.3.1/go.mod h1:0X1WI4de4ZsLrrJNLAQbFeLCm3T7yBkR0XqQ7niQU+8= +go.opentelemetry.io/otel v1.34.0 h1:zRLXxLCgL1WyKsPVrgbSdMN4c0FMkDAskSTQP+0hdUY= +go.opentelemetry.io/otel v1.34.0/go.mod h1:OWFPOQ+h4G8xpyjgqo4SxJYdDQ/qmRH+wivy7zzx9oI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0 h1:Vh5HayB/0HHfOQA7Ctx69E/Y/DcQSMPpKANYVMQ7fBA= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.33.0/go.mod h1:cpgtDBaqD/6ok/UG0jT15/uKjAY8mRA53diogHBg3UI= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0 h1:5pojmb1U1AogINhN3SurB+zm/nIcusopeBNp42f45QM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.33.0/go.mod h1:57gTHJSE5S1tqg+EKsLPlTWhpHMsWlVmer+LA926XiA= +go.opentelemetry.io/otel/metric v1.34.0 h1:+eTR3U0MyfWjRDhmFMxe2SsW64QrZ84AOhvqS7Y+PoQ= +go.opentelemetry.io/otel/metric v1.34.0/go.mod h1:CEDrp0fy2D0MvkXE+dPV7cMi8tWZwX3dmaIhwPOaqHE= +go.opentelemetry.io/otel/sdk v1.34.0 h1:95zS4k/2GOy069d321O8jWgYsW3MzVV+KuSPKp7Wr1A= +go.opentelemetry.io/otel/sdk v1.34.0/go.mod h1:0e/pNiaMAqaykJGKbi+tSjWfNNHMTxoC9qANsCzbyxU= +go.opentelemetry.io/otel/trace v1.34.0 h1:+ouXS2V8Rd4hp4580a8q23bg0azF2nI8cqLYnC8mh/k= +go.opentelemetry.io/otel/trace v1.34.0/go.mod h1:Svm7lSjQD7kG7KJ/MUHPVXSDGz2OX4h0M2jHBhmSfRE= +go.opentelemetry.io/proto/otlp v1.4.0 h1:TA9WRvW6zMwP+Ssb6fLoUIuirti1gGbP28GcKG1jgeg= +go.opentelemetry.io/proto/otlp v1.4.0/go.mod h1:PPBWZIP98o2ElSqI35IHfu7hIhSwvc5N38Jw8pXuGFY= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -244,14 +248,18 @@ go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE= +go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58= -golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= -golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/crypto v0.40.0 h1:r4x+VvoG5Fm+eJcxMaY8CQM7Lb0l1lsmjGBQ6s8BfKM= +golang.org/x/crypto v0.40.0/go.mod h1:Qr1vMER5WyS2dfPHAlsOj01wgLbsyWtFn/aY+5+ZdxY= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa h1:ELnwvuAXPNtPk1TJRuGkI9fDTwym6AYBu0qzT8AcHdI= golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa/go.mod h1:akd2r19cwCdwSwWeIdzYQGa/EZZyqcOdwWiwj5L5eKQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -267,17 +275,17 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8= -golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= -golang.org/x/oauth2 v0.28.0 h1:CrgCKl8PPAVtLnU3c+EDw6x11699EWlsDeWNWKdIOkc= -golang.org/x/oauth2 v0.28.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8= +golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs= +golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8= +golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= +golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.12.0 h1:MHc5BpPuC30uJk597Ri8TV3CNZcTLu6B6z4lJy+g6Jw= -golang.org/x/sync v0.12.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= +golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= +golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190529164535-6a60838ec259/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -290,30 +298,30 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20= -golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/sys v0.34.0 h1:H5Y5sJ2L2JRdyv7ROF1he/lPdvFsd0mJHFw2ThKHxLA= +golang.org/x/sys v0.34.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= -golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= +golang.org/x/term v0.33.0 h1:NuFncQrRcaRvVmgRkvM3j/F00gWIAlcmlB8ACEKmGIg= +golang.org/x/term v0.33.0/go.mod h1:s18+ql9tYWp1IfpV9DmCtQDDSRBUjKaw9M1eAv5UeF0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= -golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4= +golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.31.0 h1:0EedkvKDbh+qistFTd0Bcwe/YLh4vHwWEkiI0toFIBU= -golang.org/x/tools v0.31.0/go.mod h1:naFTU+Cev749tSJRXJlna0T3WxKvb1kWEx15xA4SdmQ= +golang.org/x/tools v0.34.0 h1:qIpSLOxeCYGg9TrcJokLBG4KFA6d795g0xkBkiESGlo= +golang.org/x/tools v0.34.0/go.mod h1:pAP9OwEaY1CAW3HOmg3hLZC5Z0CCmzjAF2UQMSqNARg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -321,14 +329,14 @@ golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8T gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0= gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 h1:ToEetK57OidYuqD4Q5w+vfEnPvPpuTwedCNVohYJfNk= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 h1:CkkIfIt50+lT6NHAVoRYEyAvQGFM7xEwXUUywFvEb3Q= -google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576/go.mod h1:1R3kvZ1dtP3+4p4d3G8uJ8rFk/fWlScl38vanWACI08= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422 h1:GVIKPyP/kLIyVOgOnTwFOrvQaQUzOzGMCxgFUOEmm24= +google.golang.org/genproto/googleapis/api v0.0.0-20250106144421-5f5ef82da422/go.mod h1:b6h1vNKhxaSoEI+5jc3PJUCustfli/mRab7295pY7rw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f h1:OxYkA3wjPsZyBylwymxSHa7ViiW1Sml4ToBrncvFehI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250115164207-1a7da9e5054f/go.mod h1:+2Yz8+CLJbIfL9z73EW45avw8Lmge3xVElCP9zEKi50= google.golang.org/grpc v1.56.3 h1:8I4C0Yq1EjstUzUJzpcRVbuYA2mODtEmpWiQoN/b2nc= google.golang.org/grpc v1.56.3/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= -google.golang.org/protobuf v1.36.5 h1:tPhr+woSbjfYvY6/GPufUoYizxw1cF/yFoxJ2fmpwlM= -google.golang.org/protobuf v1.36.5/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= +google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY= +google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= @@ -342,37 +350,41 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -k8s.io/api v0.32.3 h1:Hw7KqxRusq+6QSplE3NYG4MBxZw1BZnq4aP4cJVINls= -k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k= -k8s.io/apiextensions-apiserver v0.32.3 h1:4D8vy+9GWerlErCwVIbcQjsWunF9SUGNu7O7hiQTyPY= -k8s.io/apiextensions-apiserver v0.32.3/go.mod h1:8YwcvVRMVzw0r1Stc7XfGAzB/SIVLunqApySV5V7Dss= -k8s.io/apimachinery v0.32.3 h1:JmDuDarhDmA/Li7j3aPrwhpNBA94Nvk5zLeOge9HH1U= -k8s.io/apimachinery v0.32.3/go.mod h1:GpHVgxoKlTxClKcteaeuF1Ul/lDVb74KpZcxcmLDElE= -k8s.io/apiserver v0.32.3 h1:kOw2KBuHOA+wetX1MkmrxgBr648ksz653j26ESuWNY8= -k8s.io/apiserver v0.32.3/go.mod h1:q1x9B8E/WzShF49wh3ADOh6muSfpmFL0I2t+TG0Zdgc= -k8s.io/client-go v0.32.3 h1:RKPVltzopkSgHS7aS98QdscAgtgah/+zmpAogooIqVU= -k8s.io/client-go v0.32.3/go.mod h1:3v0+3k4IcT9bXTc4V2rt+d2ZPPG700Xy6Oi0Gdl2PaY= -k8s.io/cluster-bootstrap v0.32.3 h1:AqIpsUhB6MUeaAsl1WvaUw54AHRd2hfZrESlKChtd8s= -k8s.io/cluster-bootstrap v0.32.3/go.mod h1:CHbBwgOb6liDV6JFUTkx5t85T2xidy0sChBDoyYw344= -k8s.io/component-base v0.32.3 h1:98WJvvMs3QZ2LYHBzvltFSeJjEx7t5+8s71P7M74u8k= -k8s.io/component-base v0.32.3/go.mod h1:LWi9cR+yPAv7cu2X9rZanTiFKB2kHA+JjmhkKjCZRpI= +k8s.io/api v0.33.3 h1:SRd5t//hhkI1buzxb288fy2xvjubstenEKL9K51KBI8= +k8s.io/api v0.33.3/go.mod h1:01Y/iLUjNBM3TAvypct7DIj0M0NIZc+PzAHCIo0CYGE= +k8s.io/apiextensions-apiserver v0.33.3 h1:qmOcAHN6DjfD0v9kxL5udB27SRP6SG/MTopmge3MwEs= +k8s.io/apiextensions-apiserver v0.33.3/go.mod h1:oROuctgo27mUsyp9+Obahos6CWcMISSAPzQ77CAQGz8= +k8s.io/apimachinery v0.33.3 h1:4ZSrmNa0c/ZpZJhAgRdcsFcZOw1PQU1bALVQ0B3I5LA= +k8s.io/apimachinery v0.33.3/go.mod h1:BHW0YOu7n22fFv/JkYOEfkUYNRN0fj0BlvMFWA7b+SM= +k8s.io/apiserver v0.33.3 h1:Wv0hGc+QFdMJB4ZSiHrCgN3zL3QRatu56+rpccKC3J4= +k8s.io/apiserver v0.33.3/go.mod h1:05632ifFEe6TxwjdAIrwINHWE2hLwyADFk5mBsQa15E= +k8s.io/client-go v0.33.3 h1:M5AfDnKfYmVJif92ngN532gFqakcGi6RvaOF16efrpA= +k8s.io/client-go v0.33.3/go.mod h1:luqKBQggEf3shbxHY4uVENAxrDISLOarxpTKMiUuujg= +k8s.io/cluster-bootstrap v0.33.3 h1:u2NTxJ5CFSBFXaDxLQoOWMly8eni31psVso+caq6uwI= +k8s.io/cluster-bootstrap v0.33.3/go.mod h1:p970f8u8jf273zyQ5raD8WUu2XyAl0SAWOY82o7i/ds= +k8s.io/component-base v0.33.3 h1:mlAuyJqyPlKZM7FyaoM/LcunZaaY353RXiOd2+B5tGA= +k8s.io/component-base v0.33.3/go.mod h1:ktBVsBzkI3imDuxYXmVxZ2zxJnYTZ4HAsVj9iF09qp4= k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8= k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f h1:GA7//TjRY9yWGy1poLzYYJJ4JRdzg3+O6e8I+e+8T5Y= -k8s.io/kube-openapi v0.0.0-20241105132330-32ad38e42d3f/go.mod h1:R/HEjbvWI0qdfb8viZUeVZm0X6IZnxAydC7YU42CMw4= +k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff h1:/usPimJzUKKu+m+TE36gUyGcf03XZEP0ZIKgKj35LS4= +k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff/go.mod h1:5jIi+8yX4RIb8wk3XwBo5Pq2ccx4FP10ohkbSKCZoK8= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738 h1:M3sRQVHv7vB20Xc2ybTt7ODCeFj6JSWYFzOFnYeS6Ro= k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0 h1:CPT0ExVicCzcpeN4baWEV2ko2Z/AsiZgEdwgcfwLgMo= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= -sigs.k8s.io/cluster-api v1.10.3 h1:7tE5xgQJutisgDyeLzaZ9JhDaHGuG3GjPltsFM89BoA= -sigs.k8s.io/cluster-api v1.10.3/go.mod h1:pu1WDn+fdax9aC9ZtDDoXqnO7P3LLjxbKGU/Nzf/DF4= -sigs.k8s.io/controller-runtime v0.20.4 h1:X3c+Odnxz+iPTRobG4tp092+CvBU9UK0t/bRf+n0DGU= -sigs.k8s.io/controller-runtime v0.20.4/go.mod h1:xg2XB0K5ShQzAgsoujxuKN4LNXR2LfwwHsPj7Iaw+XY= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/cluster-api v1.11.1 h1:7CyGCTxv1p3Y2kRe1ljTj/w4TcdIdWNj0CTBc4i1aBo= +sigs.k8s.io/cluster-api v1.11.1/go.mod h1:zyrjgJ5RbXhwKcAdUlGPNK5YOHpcmxXvur+5I8lkMUQ= +sigs.k8s.io/controller-runtime v0.21.0 h1:CYfjpEuicjUecRk+KAeyYh+ouUBn4llGyDYytIGcJS8= +sigs.k8s.io/controller-runtime v0.21.0/go.mod h1:OSg14+F65eWqIu4DceX7k/+QRAbTTvxeQSNSOQpukWM= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 h1:/Rv+M11QRah1itp8VhT6HoVx1Ray9eB4DBr+K+/sCJ8= sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3/go.mod h1:18nIHnGi6636UCz6m8i4DhaJ65T6EruyzmoQqI2BVDo= -sigs.k8s.io/structured-merge-diff/v4 v4.4.2 h1:MdmvkGuXi/8io6ixD5wud3vOLwc1rj0aNqRlpuvjmwA= -sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5/2tiu1w1AGfACIGE4= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= +sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v4 v4.6.0 h1:IUA9nvMmnKWcj5jl84xn+T5MnlZKThmUW1TdblaLVAc= +sigs.k8s.io/structured-merge-diff/v4 v4.6.0/go.mod h1:dDy58f92j70zLsuZVuUX5Wp9vtxXpaZnkPGWeqDfCps= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/metadata.yaml b/metadata.yaml index 2fc8f123..3ff7547f 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -3,4 +3,4 @@ kind: Metadata releaseSeries: - major: 1 minor: 1 - contract: v1beta1 \ No newline at end of file + contract: v1beta2 \ No newline at end of file diff --git a/pkg/util/util.go b/pkg/util/util.go index 7e508586..150064e7 100644 --- a/pkg/util/util.go +++ b/pkg/util/util.go @@ -7,7 +7,7 @@ import ( "strings" "time" - infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta1" + infrav1 "github.com/microsoft/cluster-api-provider-azurestackhci/api/v1beta2" "github.com/pkg/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -18,7 +18,7 @@ import ( "k8s.io/client-go/tools/clientcmd" "k8s.io/utils/pointer" - clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1" + clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2" capiutil "sigs.k8s.io/cluster-api/util" "sigs.k8s.io/cluster-api/util/kubeconfig" "sigs.k8s.io/controller-runtime/pkg/client" @@ -91,7 +91,7 @@ func GetNodeName(ctx context.Context, client client.Client, obj metav1.ObjectMet if machine == nil { return "", errors.Errorf("resource %s.%s has no owning machine", obj.Namespace, obj.Name) } - if machine.Status.NodeRef == nil { + if machine.Status.NodeRef.Name == "" { return "", errors.Errorf("machine %s.%s has no node ref", machine.Namespace, machine.Name) } return machine.Status.NodeRef.Name, nil diff --git a/templates/flavors/base/cluster-template.yaml b/templates/flavors/base/cluster-template.yaml index 3ccc62dd..cc1a6da5 100644 --- a/templates/flavors/base/cluster-template.yaml +++ b/templates/flavors/base/cluster-template.yaml @@ -1,5 +1,5 @@ --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachineTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -13,7 +13,7 @@ spec: sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} --- kind: AzureStackHCIMachineTemplate -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 metadata: name: "${CLUSTER_NAME}-control-plane" spec: @@ -25,7 +25,7 @@ spec: vmSize: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE} sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} --- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate metadata: name: "${CLUSTER_NAME}-md-0" @@ -39,7 +39,7 @@ spec: kubeletExtraArgs: cloud-provider: external --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachineTemplate metadata: name: "${CLUSTER_NAME}-md-1" @@ -57,7 +57,7 @@ spec: vmSize: ${AZURESTACKHCI_WINDOWS_WORKER_MACHINE_TYPE} sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} --- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate metadata: name: "${CLUSTER_NAME}-md-1" @@ -249,7 +249,7 @@ spec: - powershell -C "powershell C:\ECP-Cache\RetryJoinIfNecessary.ps1 > C:\tmp\retry.log 2>&1; type C:\tmp\retry.log; del C:\tmp\retry.log" - powershell C:\ECP-Cache\StartFlannel.ps1 --- -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: Cluster metadata: name: ${CLUSTER_NAME} @@ -262,11 +262,11 @@ spec: cidrBlocks: - ${AZURESTACKHCI_SERVICE_CIDR:=""} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCICluster name: ${CLUSTER_NAME} --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCICluster metadata: name: ${CLUSTER_NAME} @@ -286,7 +286,7 @@ spec: version: "${KUBERNETES_VERSION}" --- kind: KubeadmControlPlane -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +apiVersion: controlplane.cluster.x-k8s.io/v1beta2 metadata: name: "${CLUSTER_NAME}-control-plane" spec: @@ -294,7 +294,7 @@ spec: machineTemplate: infrastructureRef: kind: AzureStackHCIMachineTemplate - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 name: "${CLUSTER_NAME}-control-plane" kubeadmConfigSpec: useExperimentalRetryJoin: true @@ -329,7 +329,7 @@ spec: imageRepository: "ecpacr.azurecr.io" version: "${KUBERNETES_VERSION}" --- -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: MachineDeployment metadata: name: "${CLUSTER_NAME}-md-0" @@ -345,14 +345,14 @@ spec: bootstrap: configRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate infrastructureRef: name: "${CLUSTER_NAME}-md-0" - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachineTemplate --- -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: MachineDeployment metadata: name: "${CLUSTER_NAME}-md-1" @@ -368,9 +368,9 @@ spec: bootstrap: configRef: name: "${CLUSTER_NAME}-md-1" - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate infrastructureRef: name: "${CLUSTER_NAME}-md-1" - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachineTemplate diff --git a/templates/flavors/default/patches/default.yaml b/templates/flavors/default/patches/default.yaml index a7e8a650..d8660026 100644 --- a/templates/flavors/default/patches/default.yaml +++ b/templates/flavors/default/patches/default.yaml @@ -1,5 +1,5 @@ --- -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: Cluster metadata: name: ${CLUSTER_NAME} @@ -12,10 +12,10 @@ spec: cidrBlocks: - ${AZURESTACKHCI_SERVICE_CIDR:=""} infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCICluster name: ${CLUSTER_NAME} controlPlaneRef: kind: KubeadmControlPlane - apiVersion: controlplane.cluster.x-k8s.io/v1beta1 + apiVersion: controlplane.cluster.x-k8s.io/v1beta2 name: "${CLUSTER_NAME}-control-plane" \ No newline at end of file diff --git a/templates/flavors/mgmt/mgmt-machine.yaml b/templates/flavors/mgmt/mgmt-machine.yaml index c55e1f8b..b067d45e 100644 --- a/templates/flavors/mgmt/mgmt-machine.yaml +++ b/templates/flavors/mgmt/mgmt-machine.yaml @@ -1,5 +1,5 @@ --- -apiVersion: cluster.x-k8s.io/v1beta1 +apiVersion: cluster.x-k8s.io/v1beta2 kind: Machine metadata: labels: @@ -13,15 +13,15 @@ spec: clusterName: ${CLUSTER_NAME} bootstrap: configRef: - apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 + apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfig name: ${CLUSTER_NAME}-control-plane-0 infrastructureRef: - apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 + apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachine name: ${CLUSTER_NAME}-control-plane-0 --- -apiVersion: infrastructure.cluster.x-k8s.io/v1beta1 +apiVersion: infrastructure.cluster.x-k8s.io/v1beta2 kind: AzureStackHCIMachine metadata: labels: @@ -35,7 +35,7 @@ spec: sshPublicKey: ${AZURESTACKHCI_SSH_PUBLIC_KEY:=""} vmSize: ${AZURESTACKHCI_CONTROL_PLANE_MACHINE_TYPE} --- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfig metadata: name: ${CLUSTER_NAME}-control-plane-0 diff --git a/templates/kustomizeversions.yaml b/templates/kustomizeversions.yaml index 381361f3..a3bceb6c 100644 --- a/templates/kustomizeversions.yaml +++ b/templates/kustomizeversions.yaml @@ -1,4 +1,4 @@ -apiVersion: controlplane.cluster.x-k8s.io/v1beta1 +apiVersion: controlplane.cluster.x-k8s.io/v1beta2 kind: KubeadmControlPlane metadata: name: "${CLUSTER_NAME}-control-plane" @@ -106,7 +106,7 @@ spec: "useInstanceMetadata": true } --- -apiVersion: bootstrap.cluster.x-k8s.io/v1beta1 +apiVersion: bootstrap.cluster.x-k8s.io/v1beta2 kind: KubeadmConfigTemplate metadata: name: ${CLUSTER_NAME}-md-0