Skip to content
Draft
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
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ DOCKER_BUILD_ARGS ?= \
IMG_MANAGER := ${DOCKER_IMAGE_MANAGER}
IMG_SOUTHBOUND := ${DOCKER_IMAGE_SOUTHBOUND}

# Allow IMG to override IMG_MANAGER for e2e testing and CI
ifneq ($(IMG),)
IMG_MANAGER := $(IMG)
endif

# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.31.0

Expand Down Expand Up @@ -484,10 +489,18 @@ RS_IMG_SOUTHBOUND ?= ${RS_REGISTRY}/${REGISTRY_NO_AUTH}/${REPOSITORY}/capi-provi

.PHONY: kind-load
kind-load: docker-build
ifndef IMG
docker tag ${IMG_MANAGER} ${RS_IMG_MANAGER}
docker tag ${IMG_SOUTHBOUND} ${RS_IMG_SOUTHBOUND}
kind load docker-image ${RS_IMG_MANAGER} -n ${KIND_CLUSTER}
kind load docker-image ${RS_IMG_SOUTHBOUND} -n ${KIND_CLUSTER}
else
kind load docker-image ${IMG_MANAGER} -n ${KIND_CLUSTER}
# docker tag ${IMG_MANAGER} ${IMG}-manager:test
# docker tag ${IMG_SOUTHBOUND} ${IMG}-southbound:test
# kind load docker-image ${IMG}-manager:test -n ${KIND_CLUSTER}
# kind load docker-image ${IMG}-southbound:test -n ${KIND_CLUSTER}
endif

.PHONY: clusterctl-init
clusterctl-init:
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/condition_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

package v1alpha1

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

// Conditions and condition Reasons for the IntelMachine object.

Expand Down
56 changes: 17 additions & 39 deletions api/v1alpha1/intelcluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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"
)

const (
Expand All @@ -22,30 +22,22 @@ type IntelClusterSpec struct {
ProviderId string `json:"providerId"`
}

// IntelClusterV1Beta2Status groups all the fields that will be added or modified in IntelCluster with the V1Beta2 version.
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
type IntelClusterV1Beta2Status struct {
// conditions represents the observations of an IntelCluster's current state.
// Known condition types are Ready, Provisioned, BootstrapExecSucceeded, Deleting, Paused.
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=32
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// IntelClusterStatus defines the observed state of IntelCluster
type IntelClusterStatus struct {
// ready denotes that the Intel cluster 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. Please use conditions
// to check the operational state of the infa cluster.
// +optional
Ready bool `json:"ready"`
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
// v1beta2 groups all the fields that will be added or modified in IntelCluster's status with the V1Beta2 version.
Ready bool `json:"ready"`

// conditions represents the observations of an IntelCluster's current state.
// Known condition types are Ready, Provisioned, Deleting, Paused.
// +optional
V1Beta2 *IntelClusterV1Beta2Status `json:"v1beta2,omitempty"`
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=32
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

// +kubebuilder:object:root=true
Expand All @@ -55,7 +47,7 @@ type IntelClusterStatus struct {
// +kubebuilder:printcolumn:name="ProviderId",type="string",JSONPath=".spec.providerId",description="ProviderId associated with the cluster"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.ready",description="IntelCluster is ready for IntelMachine"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time duration since creation of IntelCluster"
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta1=v1alpha1"
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta2=v1alpha1"

// IntelCluster is the Schema for the intelclusters API
type IntelCluster struct {
Expand All @@ -67,29 +59,15 @@ type IntelCluster struct {
}

// GetConditions returns the observations of the operational state of the IntelCluster resource.
func (r *IntelCluster) GetConditions() clusterv1.Conditions {
return r.Status.Conditions
}

// SetConditions sets the underlying service state of the IntelCluster to the predescribed clusterv1.Conditions.
func (r *IntelCluster) SetConditions(conditions clusterv1.Conditions) {
r.Status.Conditions = conditions
}

// GetV1Beta2Conditions returns the set of conditions for this object.
func (c *IntelCluster) GetV1Beta2Conditions() []metav1.Condition {
if c.Status.V1Beta2 == nil {
return nil
}
return c.Status.V1Beta2.Conditions
// This implements the v1beta2 Getter interface.
func (c *IntelCluster) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

// SetV1Beta2Conditions sets conditions for an API object.
func (c *IntelCluster) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &IntelClusterV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
// SetConditions sets the underlying service state of the IntelCluster to the predescribed conditions.
// This implements the v1beta2 Setter interface.
func (c *IntelCluster) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

// +kubebuilder:object:root=true
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/intelclustertemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,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"
)

// IntelClusterTemplateSpec defines the desired state of IntelClusterTemplate
Expand All @@ -16,7 +16,7 @@ type IntelClusterTemplateSpec struct {
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=intelclustertemplates,scope=Namespaced,categories=cluster-api
// +kubebuilder:storageversion
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta1=v1alpha1"
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta2=v1alpha1"

// IntelClusterTemplate is the Schema for the intelclustertemplates API
type IntelClusterTemplate struct {
Expand Down
37 changes: 5 additions & 32 deletions api/v1alpha1/intelmachine_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

const (
Expand Down Expand Up @@ -43,25 +42,13 @@ type IntelMachineSpec struct {

// IntelMachineStatus defines the observed state of IntelMachine.
type IntelMachineStatus struct {
// Conditions is a list of conditions that describe the state of the IntelMachine.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`

// v1beta2 groups all the fields that will be added or modified in IntelMachine's status with the V1Beta2 version.
// +optional
V1Beta2 *IntelMachineV1Beta2Status `json:"v1beta2,omitempty"`

// ready denotes that the Intel machine 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. Please use conditions
// to check the operational state of the infra machine.
// +optional
Ready bool `json:"ready,omitempty"`
}

// IntelMachineV1Beta2Status groups all the fields that will be added or modified in IntelMachine with the V1Beta2 version.
// See https://github.com/kubernetes-sigs/cluster-api/blob/main/docs/proposals/20240916-improve-status-in-CAPI-resources.md for more context.
type IntelMachineV1Beta2Status struct {
// conditions represents the observations of an IntelMachine's current state.
// Known condition types are Ready, Provisioned, BootstrapExecSucceeded, Deleting, Paused.
// +optional
Expand All @@ -76,7 +63,7 @@ type IntelMachineV1Beta2Status struct {
// +kubebuilder:printcolumn:name="Provider ID",type=string,JSONPath=`.spec.providerID`
// +kubebuilder:printcolumn:name="Node GUID",type=string,JSONPath=`.spec.nodeGUID`
// +kubebuilder:printcolumn:name="Ready",type=boolean,JSONPath=`.status.ready`
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta1=v1alpha1"
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta2=v1alpha1"

// IntelMachine is the Schema for the intelmachines API.
type IntelMachine struct {
Expand All @@ -88,31 +75,17 @@ type IntelMachine struct {
}

// GetConditions returns the set of conditions for this object.
func (c *IntelMachine) GetConditions() clusterv1.Conditions {
// This implements the v1beta2 Getter interface.
func (c *IntelMachine) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

// SetConditions sets the conditions on this object.
func (c *IntelMachine) SetConditions(conditions clusterv1.Conditions) {
// This implements the v1beta2 Setter interface.
func (c *IntelMachine) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

// GetV1Beta2Conditions returns the set of conditions for this object.
func (c *IntelMachine) GetV1Beta2Conditions() []metav1.Condition {
if c.Status.V1Beta2 == nil {
return nil
}
return c.Status.V1Beta2.Conditions
}

// SetV1Beta2Conditions sets conditions for an API object.
func (c *IntelMachine) SetV1Beta2Conditions(conditions []metav1.Condition) {
if c.Status.V1Beta2 == nil {
c.Status.V1Beta2 = &IntelMachineV1Beta2Status{}
}
c.Status.V1Beta2.Conditions = conditions
}

// +kubebuilder:object:root=true

// IntelMachineList contains a list of IntelMachine.
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/intelmachinetemplate_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ type IntelMachineTemplateStatus struct {

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta1=v1alpha1"
// +kubebuilder:metadata:labels="cluster.x-k8s.io/v1beta2=v1alpha1"

// IntelMachineTemplate is the Schema for the intelmachinetemplates API.
type IntelMachineTemplate struct {
Expand Down
59 changes: 2 additions & 57 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/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
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/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
Expand Down
Loading
Loading