Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -74,24 +74,24 @@ 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)

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)

Expand All @@ -103,15 +103,15 @@ 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)

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)

Expand All @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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) \
Expand Down
15 changes: 15 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -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"
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcicluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhciloadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcimachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/azurestackhcivirtualmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
10 changes: 5 additions & 5 deletions api/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions api/v1beta2/azurestackhcicluster_conversion.go
Original file line number Diff line number Diff line change
@@ -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() {}
132 changes: 132 additions & 0 deletions api/v1beta2/azurestackhcicluster_types.go
Original file line number Diff line number Diff line change
@@ -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{})
}
28 changes: 28 additions & 0 deletions api/v1beta2/azurestackhcicluster_webhook.go
Original file line number Diff line number Diff line change
@@ -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()
}
Loading