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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Kubebuilder DevContainer",
"image": "golang:1.23",
"image": "golang:1.25",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/devcontainers/features/git:1": {}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.23 AS builder
FROM golang:1.25 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,8 @@ GOLANGCI_LINT = $(LOCALBIN)/golangci-lint
KUSTOMIZE_VERSION ?= v5.4.3
CONTROLLER_TOOLS_VERSION ?= v0.16.4
ENVTEST_VERSION ?= release-0.19
GOLANGCI_LINT_VERSION ?= v1.61.0
GINKGO_VERSION ?= v2.23.3
GOLANGCI_LINT_VERSION ?= v2.5.0
GINKGO_VERSION ?= v2.23.4

.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
Expand All @@ -289,7 +289,7 @@ $(ENVTEST): $(LOCALBIN)
.PHONY: golangci-lint
golangci-lint: $(GOLANGCI_LINT) ## Download golangci-lint locally if necessary.
$(GOLANGCI_LINT): $(LOCALBIN)
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))
$(call go-install-tool,$(GOLANGCI_LINT),github.com/golangci/golangci-lint/v2/cmd/golangci-lint,$(GOLANGCI_LINT_VERSION))

.PHONY: ginkgo
ginkgo: $(GINKGO) ## Download setup-envtest locally if necessary.
Expand Down
26 changes: 19 additions & 7 deletions api/v1alpha1/metalstackcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck

"github.com/metal-stack/metal-lib/pkg/tag"
Expand All @@ -35,8 +34,7 @@ const (

ClusterControlPlaneEndpointDefaultPort = 443

ClusterControlPlaneIPEnsured clusterv1.ConditionType = "ClusterControlPlaneIPEnsured"
ClusterPaused clusterv1.ConditionType = clusterv1.PausedV1Beta2Condition
ClusterControlPlaneIPEnsured = "ClusterControlPlaneIPEnsured"
)

var (
Expand Down Expand Up @@ -80,9 +78,14 @@ type APIEndpoint struct {
// MetalStackClusterStatus defines the observed state of MetalStackCluster.
type MetalStackClusterStatus struct {
// Ready denotes that the cluster is ready.
// NOTE: this field is part of the Cluster API v1beta1 contract.
// +kubebuilder:default=false
Ready bool `json:"ready"`

// Initialization provides information about the initialization status of the MetalStackCluster.
// +optional
Initialization MetalStackClusterInitializationStatus `json:"initialization,omitzero"`

// FailureReason indicates that there is a fatal problem reconciling the
// state, and will be set to a token value suitable for
// programmatic interpretation.
Expand All @@ -96,7 +99,16 @@ type MetalStackClusterStatus struct {

// Conditions defines current service state of the MetalStackCluster.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// MetalStackClusterInitializationStatus defines the observed initialization status of the MetalStackCluster.
// +kubebuilder:validation:MinProperties=1
type MetalStackClusterInitializationStatus struct {
// Provisioned indicates that the initial provisioning has been completed.
// NOTE: this field is part of the Cluster API v1beta2 contract, and it is used to orchestrate initial Cluster provisioning.
// +optional
Provisioned *bool `json:"provisioned,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -106,7 +118,7 @@ type MetalStackClusterStatus struct {
// +kubebuilder:printcolumn:name="Partition",type="string",priority=1,JSONPath=".spec.partition",description="The partition within metal-stack"
// +kubebuilder:printcolumn:name="Project",type="string",priority=1,JSONPath=".spec.projectID",description="The project within metal-stack"
// +kubebuilder:printcolumn:name="Network",type="string",priority=1,JSONPath=".spec.nodeNetworkID",description="The network within metal-stack"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="MetalStackCluster is ready"
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.initialization.provisioned",description="MetalStackCluster is ready"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Uptime of the cluster"

// MetalStackCluster is the Schema for the metalstackclusters API.
Expand All @@ -132,12 +144,12 @@ func init() {
}

// GetConditions returns the list of conditions.
func (c *MetalStackCluster) GetConditions() clusterv1.Conditions {
func (c *MetalStackCluster) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

// SetConditions will set the given conditions.
func (c *MetalStackCluster) SetConditions(conditions clusterv1.Conditions) {
func (c *MetalStackCluster) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

Expand Down
31 changes: 22 additions & 9 deletions api/v1alpha1/metalstackmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package v1alpha1

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/v1beta2"
capierrors "sigs.k8s.io/cluster-api/errors" //nolint:staticcheck
)

Expand All @@ -28,10 +28,9 @@ const (

TagInfraMachineResource = "metal-stack.infrastructure.cluster.x-k8s.io/machine-resource"

ProviderMachineCreated clusterv1.ConditionType = "MachineCreated"
ProviderMachineReady clusterv1.ConditionType = "MachineReady"
ProviderMachineHealthy clusterv1.ConditionType = "MachineHealthy"
ProviderMachinePaused clusterv1.ConditionType = clusterv1.PausedV1Beta2Condition
ProviderMachineCreated = "MachineCreated"
ProviderMachineReady = "MachineReady"
ProviderMachineHealthy = "MachineHealthy"
)

// MetalStackMachineSpec defines the desired state of MetalStackMachine.
Expand All @@ -50,9 +49,14 @@ type MetalStackMachineSpec struct {
// MetalStackMachineStatus defines the observed state of MetalStackMachine.
type MetalStackMachineStatus struct {
// Ready denotes that the machine is ready.
// NOTE: this field is part of the Cluster API v1beta1 contract.
// +kubebuilder:default=false
Ready bool `json:"ready"`

// Initialization provides information about the initialization status of the MetalStackMachine.
// +optional
Initialization MetalStackMachineInitializationStatus `json:"initialization,omitzero"`

// FailureReason indicates that there is a fatal problem reconciling the
// state, and will be set to a token value suitable for
// programmatic interpretation.
Expand All @@ -66,19 +70,28 @@ type MetalStackMachineStatus struct {

// Conditions defines current service state of the MetalStackMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`

// MachineAddresses contains all host names, external or internal IP addresses and external or internal DNS names.
Addresses clusterv1.MachineAddresses `json:"addresses,omitempty"`
}

// MetalStackMachineInitializationStatus defines the observed initialization status of the MetalStackMachine.
// +kubebuilder:validation:MinProperties=1
type MetalStackMachineInitializationStatus struct {
// Provisioned indicates that the initial provisioning has been completed.
// NOTE: this field is part of the Cluster API v1beta2 contract, and it is used to orchestrate initial Cluster provisioning.
// +optional
Provisioned *bool `json:"provisioned,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Cluster",type="string",JSONPath=".metadata.labels.cluster\\.x-k8s\\.io/cluster-name",description="Cluster to which this MetalStackMachine belongs"
// +kubebuilder:printcolumn:name="ProviderID",type="string",JSONPath=".spec.providerID",description="ProviderID reference for the MetalStackMachine"
// +kubebuilder:printcolumn:name="Size",type="string",JSONPath=".spec.size",priority=1,description="Size of the MetalStackMachine"
// +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".spec.image",description="OS image of the MetalStackMachine"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="MetalStackMachine is ready for worker nodes"
// +kubebuilder:printcolumn:name="Provisioned",type="string",JSONPath=".status.initialization.provisioned",description="MetalStackCluster is ready"
// +kubebuilder:printcolumn:name="Healthy",type="string",JSONPath=".status.conditions[1].status",description="Health of the provider machine"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

Expand All @@ -105,11 +118,11 @@ func init() {
}

// GetConditions returns the list of conditions.
func (c *MetalStackMachine) GetConditions() clusterv1.Conditions {
func (c *MetalStackMachine) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

// SetConditions will set the given conditions.
func (c *MetalStackMachine) SetConditions(conditions clusterv1.Conditions) {
func (c *MetalStackMachine) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}
51 changes: 47 additions & 4 deletions api/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
metricsserver "sigs.k8s.io/controller-runtime/pkg/metrics/server"
"sigs.k8s.io/controller-runtime/pkg/webhook"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"

infrastructurev1alpha1 "github.com/metal-stack/cluster-api-provider-metal-stack/api/v1alpha1"
"github.com/metal-stack/cluster-api-provider-metal-stack/internal/controller"
Expand Down
Loading