Skip to content
Closed
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
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.23.11
1.25.9
38 changes: 29 additions & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,22 @@ linters-settings:
- pkg: sigs.k8s.io/controller-runtime/pkg/controller/controllerutil
alias: ctrlutil
# CAPI
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta1
alias: clusterv1
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta2
alias: clusterv2
- pkg: sigs.k8s.io/cluster-api/errors
alias: capierrors
- pkg: sigs.k8s.io/cluster-api/util
alias: capiutil
- pkg: sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1
alias: bootstrapv1
- pkg: sigs.k8s.io/cluster-api/controlplane/kubeadm/api/v1beta1
- pkg: sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta2
alias: bootstrapv2
- pkg: sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta1
alias: controlplanev1
- pkg: sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta2
alias: controlplanev2
- pkg: sigs.k8s.io/cluster-api/test/e2e
alias: capie2e
# CAPE
Expand Down Expand Up @@ -167,18 +173,32 @@ issues:
text: should not use dot imports
- path: _test\.go
text: cyclomatic complexity
# Deprecations for FailureReason
# CAPI v1beta1 deprecations are currently tolerated globally while the project is still on v1beta1 APIs.
- linters:
- staticcheck
text: "SA1019: \"sigs.k8s.io/cluster-api/errors\" is deprecated:"
# Deprecations for FailureMessage, FailureReason, UnavailableReplicas
text: 'SA1019: "sigs.k8s.io/cluster-api/errors" is deprecated:'
- linters:
- staticcheck
text: "SA1019: .*\\.Status\\.(FailureMessage|FailureReason|UnavailableReplicas) is deprecated: This field is deprecated and is going to be removed in the next apiVersion. Please see https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more details."
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/api/bootstrap/kubeadm/v1beta1" is deprecated:'
- linters:
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/api/controlplane/kubeadm/v1beta1" is deprecated:'
- linters:
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/api/core/v1beta1" is deprecated:'
- linters:
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions" is deprecated:'
- linters:
- staticcheck
text: 'SA1019: "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/patch" is deprecated:'
- linters:
- staticcheck
text: 'SA1019: .*\.Status\.(FailureMessage|FailureReason|UnavailableReplicas) is deprecated:'

run:
timeout: 10m
go: "1.23"
go: "1.25"
skip-files:
- "zz_generated.*\\.go$"
allow-parallel-runners: true
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
ARG ARCH

# Build the manager binary
FROM golang:1.23.11 as builder
FROM golang:1.25.9 as builder
WORKDIR /workspace

# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ VERSION ?= $(shell cat clusterctl-settings.json | jq .config.nextVersion -r)
#
# Go.
#
GO_VERSION ?= 1.23.11
GO_VERSION ?= 1.25.9

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -163,7 +163,7 @@ kustomize: ## Download kustomize locally if necessary.

CONTROLLER_GEN = $(shell pwd)/bin/controller-gen
controller-gen: ## Download controller-gen locally if necessary.
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.17.2)
$(call go-get-tool,$(CONTROLLER_GEN),sigs.k8s.io/controller-tools/cmd/controller-gen@v0.18.0)

GINKGO := $(shell pwd)/bin/ginkgo
ginkgo: ## Download ginkgo locally if necessary.
Expand Down
4 changes: 3 additions & 1 deletion api/v1beta1/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ 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 ElfMachine object.

Expand Down
16 changes: 16 additions & 0 deletions api/v1beta1/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ const (
// It is the name of compute cluster where the virtual machine runs on.
ComputeClusterNameLabel = "cape.infrastructure.cluster.x-k8s.io/compute-cluster-name"

// StorageClusterIDLabel is the label set on nodes.
// It is the ID of the storage cluster where the virtual machine's storage resides.
StorageClusterIDLabel = "cape.infrastructure.cluster.x-k8s.io/storage-cluster-id"

// StorageClusterNameLabel is the label set on nodes.
// It is the name of the storage cluster where the virtual machine's storage resides.
StorageClusterNameLabel = "cape.infrastructure.cluster.x-k8s.io/storage-cluster-name"

// DataStoreIDLabel is the label set on nodes.
// It is the ID of the datastore where the virtual machine's storage resides.
DataStoreIDLabel = "cape.infrastructure.cluster.x-k8s.io/datastore-id"

// DataStoreNameLabel is the label set on nodes.
// It is the name of the datastore where the virtual machine's storage resides.
DataStoreNameLabel = "cape.infrastructure.cluster.x-k8s.io/datastore-name"

// ZoneIDLabel is the label set on nodes.
// It is the Tower ID of zone where the virtual machine runs on.
ZoneIDLabel = "cape.infrastructure.cluster.x-k8s.io/zone-id"
Expand Down
7 changes: 6 additions & 1 deletion api/v1beta1/elfcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,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 All @@ -37,6 +37,11 @@ type ElfClusterSpec struct {
// Cluster is a unique identifier for a ELF cluster.
Cluster string `json:"cluster,omitempty"`

// StorageCluster defines the storage configuration used for VM disks.
// If unset, the compute cluster's storage is used.
// +optional
StorageCluster StorageConfig `json:"storageCluster,omitempty"`

// ClusterType is the type of the ELF cluster.
// If ClusterType is empty, it will be automatically set.
// +kubebuilder:validation:Enum=Standard;Stretched
Expand Down
12 changes: 10 additions & 2 deletions api/v1beta1/elfmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util/conditions"
conditions "sigs.k8s.io/cluster-api/util/deprecated/v1beta1/conditions"
)

const (
Expand Down Expand Up @@ -224,6 +224,14 @@ type ElfMachineStatus struct {
// ComputeCluster is the status of the compute cluster.
// +optional
ComputeCluster ComputeClusterStatus `json:"computeCluster,omitempty"`

// StorageCluster is the status of the storage cluster used by the VM.
// +optional
StorageCluster StorageClusterStatus `json:"storageCluster,omitempty"`

// DataStore is the status of the datastore used by the VM.
// +optional
DataStore DataStoreStatus `json:"dataStore,omitempty"`
}

//+kubebuilder:object:root=true
Expand Down
69 changes: 69 additions & 0 deletions api/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,40 @@ func (z ElfClusterZoneType) ToLower() string {
return strings.ToLower(string(z))
}

// StorageConfig defines the target storage for VM disks.
// Exactly one of DatastoreID or StorageClusterID must be specified.
// +kubebuilder:validation:XValidation:rule="has(self.datastoreID) != has(self.storageClusterID)",message="exactly one of datastoreID or storageClusterID must be specified"
type StorageConfig struct {
// DatastoreID is the ID of a VCFS datastore used for VM disks.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=128
// +optional
DatastoreID string `json:"datastoreID,omitempty"`

// StorageClusterID is the ID of a clustered storage resource used for VM disks.
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=128
// +optional
StorageClusterID string `json:"storageClusterID,omitempty"`
}

type Tower struct {
TowerClientConfig `json:",inline"`

// SecretRef is the reference to the secret containing the tower information.
SecretRef *corev1.SecretReference `json:"secretRef,omitempty"`
}

func (t *Tower) String() string {
if t.SecretRef != nil {
return fmt.Sprintf("%s/%s", t.SecretRef.Namespace, t.SecretRef.Name)
}

return t.TowerClientConfig.Server
}

// TowerClientConfig is the connection information for the tower server.
type TowerClientConfig struct {
// Server is address of the tower server.
Server string `json:"server,omitempty"`

Expand Down Expand Up @@ -298,6 +331,42 @@ type ComputeClusterStatus struct {
Name string `json:"name,omitempty"`
}

// StorageClusterStatus is the status of a storage cluster.
type StorageClusterStatus struct {
// ClusterID is the ID of the storage cluster.
ClusterID string `json:"clusterId,omitempty"`

// Name is the name of the storage cluster.
Name string `json:"name,omitempty"`
}

// String returns a string representation of this StorageClusterStatus.
func (sc *StorageClusterStatus) String() string {
return fmt.Sprintf("%s:%s", sc.ClusterID, sc.Name)
}

func (sc *StorageClusterStatus) Equal(other *StorageClusterStatus) bool {
return sc.ClusterID == other.ClusterID && sc.Name == other.Name
}

// DataStoreStatus is the status of a datastore.
type DataStoreStatus struct {
// DataStoreID is the ID of the datastore.
DataStoreID string `json:"dataStoreId,omitempty"`

// Name is the name of the datastore.
Name string `json:"name,omitempty"`
}

// String returns a string representation of this DataStoreStatus.
func (ds *DataStoreStatus) String() string {
return fmt.Sprintf("%s:%s", ds.DataStoreID, ds.Name)
}

func (ds *DataStoreStatus) Equal(other *DataStoreStatus) bool {
return ds.DataStoreID == other.DataStoreID && ds.Name == other.Name
}

// String returns a string representation of this ComputeClusterStatus.
func (cc *ComputeClusterStatus) String() string {
return fmt.Sprintf("%s:%s", cc.ClusterID, cc.Name)
Expand Down
Loading
Loading