Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
caaf1d3
config: add namespaces to different levels of deployable kustomizations
friegger May 22, 2026
20479ee
Implement Machine Pool Health checks
friegger May 22, 2026
dfbde77
Remove unnecessary lastObservedTime
friegger Jun 10, 2026
b5cb8db
Migrate to Ginkgo test to stay consistent
friegger Jun 10, 2026
5e558bc
Merge remote-tracking branch 'origin/main' into enh/1472-pool-health-…
friegger Jun 10, 2026
b680ff0
Cleanup healthData if MachinePool is not found
friegger Jun 10, 2026
19013f7
Move MachinePool Ready condition writer to reconciler
friegger Jun 10, 2026
8c93fce
Drop VolumePool/BucketPool condition additions
friegger Jun 12, 2026
2dd3b0a
Regenerate machinepool RBAC aggregator
friegger Jun 12, 2026
4f324d3
Merge remote-tracking branch 'origin/main' into enh/1472-pool-health-…
friegger Jun 12, 2026
9767f6e
Merge remote-tracking branch 'origin/main' into enh/1472-pool-health-…
friegger Jun 29, 2026
25c5ff8
Allow PR images to be published
friegger Jun 30, 2026
5f530b9
Scope down cache for Machine Pool Lease
friegger Jun 30, 2026
396214d
Add list/watch for machinepool-lease
friegger Jun 30, 2026
4d187cb
Scope MachinePool Lease also for controller manager
friegger Jun 30, 2026
647d10a
Add necessary rbac annotations for MachinePool Lifecycle Controller
friegger Jun 30, 2026
12e5ec7
Adjust loglvls and wording
friegger Jun 30, 2026
3da78dd
Merge branch 'main' into enh/1472-pool-health-on-standalone-ks
friegger Jun 30, 2026
76df535
Apply review comments
friegger Jul 15, 2026
5744f71
Merge remote-tracking branch 'origin/main' into enh/1472-pool-health-…
friegger Jul 15, 2026
14e2f89
Fix typos
friegger Jul 15, 2026
10a03d4
Avoid tight requeue loop
friegger Jul 15, 2026
eedce59
Adjust readyConditionChanged
friegger Jul 15, 2026
5690f06
Inline variable
friegger Jul 17, 2026
d89d8e4
Merge remote-tracking branch 'origin/main' into enh/1472-pool-health-…
friegger Jul 17, 2026
58dcd60
Adopt komega
friegger Jul 17, 2026
1eb1426
Adopt komega and rename test
friegger Jul 17, 2026
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
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,20 +228,20 @@ docker-push: ## Push docker image with the manager.
.PHONY: install
install: manifests kustomize ## Install API server & API services into the K8s cluster specified in ~/.kube/config. This requires APISERVER_IMG to be available for the cluster.
cd config/apiserver/server && $(KUSTOMIZE) edit set image apiserver=${APISERVER_IMG}
kubectl apply -k config/apiserver/default
kubectl apply -k config/apiserver/standalone

.PHONY: uninstall
uninstall: manifests kustomize ## Uninstall API server & API services from the K8s cluster specified in ~/.kube/config.
kubectl delete -k config/apiserver/default
kubectl delete -k config/apiserver/standalone

.PHONY: deploy
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/controller/manager && $(KUSTOMIZE) edit set image controller=${CONTROLLER_IMG}
kubectl apply -k config/controller/default
kubectl apply -k config/controller/standalone

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
kubectl delete -k config/controller/default
kubectl delete -k config/controller/standalone

##@ Kind Deployment plumbing

Expand Down Expand Up @@ -358,7 +358,7 @@ PROTOC_GEN_GO_GRPC ?= $(LOCALBIN)/protoc-gen-go-grpc

## Tool Versions
KUSTOMIZE_VERSION ?= v5.1.1
VGOPATH_VERSION ?= v0.1.3
VGOPATH_VERSION ?= v0.1.10
CONTROLLER_TOOLS_VERSION ?= v0.20.0
GEN_CRD_API_REFERENCE_DOCS_VERSION ?= v0.3.0
ADDLICENSE_VERSION ?= v1.1.1
Expand Down
4 changes: 4 additions & 0 deletions api/compute/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
corev1 "k8s.io/api/core/v1"
)

const (
NamespaceMachinePoolLease = "ironcore-machinepool-lease"
)

const (
MachineMachinePoolRefNameField = "spec.machinePoolRef.name"
MachineMachineClassRefNameField = "spec.machineClassRef.name"
Expand Down
46 changes: 46 additions & 0 deletions api/compute/v1alpha1/conditions.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

import (
"slices"

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

// FindMachinePoolCondition returns a pointer to the condition of the given type,
// or nil if no condition of that type is present.
func FindMachinePoolCondition(conditions []MachinePoolCondition, typ MachinePoolConditionType) *MachinePoolCondition {
idx := slices.IndexFunc(conditions, func(cond MachinePoolCondition) bool {
return cond.Type == typ
})
if idx < 0 {
return nil
}
return &conditions[idx]
}

// SetMachinePoolCondition inserts or updates a condition of the given type in the
// conditions slice. LastUpdateTime is always set to now. LastTransitionTime is set
// to now only when the condition is newly inserted or its Status differs from the
// previous value.
func SetMachinePoolCondition(conditions []MachinePoolCondition, cond MachinePoolCondition) []MachinePoolCondition {
idx := slices.IndexFunc(conditions, func(c MachinePoolCondition) bool {
return c.Type == cond.Type
})

cond.LastUpdateTime = metav1.Now()

if idx < 0 || conditions[idx].Status != cond.Status {
cond.LastTransitionTime = metav1.Now()
} else {
cond.LastTransitionTime = conditions[idx].LastTransitionTime
}

if idx < 0 {
return append(conditions, cond)
}
conditions[idx] = cond
return conditions
}
83 changes: 83 additions & 0 deletions api/compute/v1alpha1/conditions_test.go
Comment thread
friegger marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// SPDX-FileCopyrightText: 2026 SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1_test

import (
"testing"
"time"

computev1alpha1 "github.com/ironcore-dev/ironcore/api/compute/v1alpha1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

func TestFindMachinePoolCondition_returnsMatch(t *testing.T) {
conds := []computev1alpha1.MachinePoolCondition{
{Type: "Other", Status: corev1.ConditionTrue},
{Type: computev1alpha1.MachinePoolReady, Status: corev1.ConditionFalse, Reason: "X"},
}
got := computev1alpha1.FindMachinePoolCondition(conds, computev1alpha1.MachinePoolReady)
if got == nil || got.Reason != "X" {
t.Fatalf("expected Ready condition with reason X, got %+v", got)
}
}

func TestFindMachinePoolCondition_returnsNilWhenMissing(t *testing.T) {
conds := []computev1alpha1.MachinePoolCondition{{Type: "Other"}}
if got := computev1alpha1.FindMachinePoolCondition(conds, computev1alpha1.MachinePoolReady); got != nil {
t.Fatalf("expected nil, got %+v", got)
}
}

func TestSetMachinePoolCondition_appendsWhenAbsent(t *testing.T) {
out := computev1alpha1.SetMachinePoolCondition(nil, computev1alpha1.MachinePoolCondition{
Type: computev1alpha1.MachinePoolReady,
Status: corev1.ConditionTrue,
})
if len(out) != 1 || out[0].Type != computev1alpha1.MachinePoolReady {
t.Fatalf("expected Ready appended, got %+v", out)
}
if out[0].LastTransitionTime.IsZero() {
t.Fatal("expected LastTransitionTime to be set on first append")
}
if out[0].LastUpdateTime.IsZero() {
t.Fatal("expected LastUpdateTime to be set on first append")
}
}

func TestSetMachinePoolCondition_updatesInPlaceWithoutTransition(t *testing.T) {
earlier := metav1.NewTime(time.Now().Add(-time.Hour))
in := []computev1alpha1.MachinePoolCondition{{
Type: computev1alpha1.MachinePoolReady,
Status: corev1.ConditionTrue,
LastTransitionTime: earlier,
}}
out := computev1alpha1.SetMachinePoolCondition(in, computev1alpha1.MachinePoolCondition{
Type: computev1alpha1.MachinePoolReady,
Status: corev1.ConditionTrue, // same status
Message: "still ready",
})
if !out[0].LastTransitionTime.Equal(&earlier) {
t.Fatalf("expected LastTransitionTime preserved when status unchanged, got %v", out[0].LastTransitionTime)
}
if out[0].LastUpdateTime.IsZero() {
t.Fatal("expected LastUpdateTime advanced")
}
}

func TestSetMachinePoolCondition_advancesTransitionWhenStatusChanges(t *testing.T) {
earlier := metav1.NewTime(time.Now().Add(-time.Hour))
in := []computev1alpha1.MachinePoolCondition{{
Type: computev1alpha1.MachinePoolReady,
Status: corev1.ConditionTrue,
LastTransitionTime: earlier,
}}
out := computev1alpha1.SetMachinePoolCondition(in, computev1alpha1.MachinePoolCondition{
Type: computev1alpha1.MachinePoolReady,
Status: corev1.ConditionFalse,
})
if out[0].LastTransitionTime.Equal(&earlier) {
t.Fatal("expected LastTransitionTime to advance when status changes")
}
}
7 changes: 7 additions & 0 deletions api/compute/v1alpha1/machinepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ type MachinePoolAddress struct {
// MachinePoolConditionType is a type a MachinePoolCondition can have.
type MachinePoolConditionType string

const (
// MachinePoolReady means the machine pool is healthy and ready to accept machines.
MachinePoolReady MachinePoolConditionType = "Ready"
)

// MachinePoolCondition is one of the conditions of a MachinePool.
type MachinePoolCondition struct {
// Type is the type of the condition.
Expand All @@ -97,6 +102,8 @@ type MachinePoolCondition struct {
Message string `json:"message"`
// ObservedGeneration represents the .metadata.generation that the condition was set based upon.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// LastUpdateTime is the last time this condition was updated.
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// LastTransitionTime is the last time the status of a condition has transitioned from one state to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}
Expand Down
1 change: 1 addition & 0 deletions api/compute/v1alpha1/zz_generated.deepcopy.go

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

29 changes: 28 additions & 1 deletion api/storage/v1alpha1/bucketpool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,38 @@ type BucketPoolSpec struct {
// BucketPoolStatus defines the observed state of BucketPool
type BucketPoolStatus struct {
// State represents the infrastructure state of a BucketPool.
State BucketPoolState `json:"state,omitempty"`
State BucketPoolState `json:"state,omitempty"`
Conditions []BucketPoolCondition `json:"conditions,omitempty"`
// AvailableBucketClasses list the references of any supported BucketClass of this pool
AvailableBucketClasses []corev1.LocalObjectReference `json:"availableBucketClasses,omitempty"`
}

// BucketPoolConditionType is a type a BucketPoolCondition can have.
type BucketPoolConditionType string

const (
// BucketPoolReady means the bucket pool is healthy and ready to accept buckets.
BucketPoolReady BucketPoolConditionType = "Ready"
)

// BucketPoolCondition is one of the conditions of a BucketPool.
type BucketPoolCondition struct {
// Type is the type of the condition.
Type BucketPoolConditionType `json:"type"`
// Status is the status of the condition.
Status corev1.ConditionStatus `json:"status"`
// Reason is a machine-readable indication of why the condition is in a certain state.
Reason string `json:"reason"`
// Message is a human-readable explanation of why the condition has a certain reason / state.
Message string `json:"message"`
// ObservedGeneration represents the .metadata.generation that the condition was set based upon.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// LastUpdateTime is the last time this condition was updated.
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// LastTransitionTime is the last time the status of a condition has transitioned from one state to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}

type BucketPoolState string

const (
Expand Down
5 changes: 5 additions & 0 deletions api/storage/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ package v1alpha1

import corev1 "k8s.io/api/core/v1"

const (
NamespaceVolumePoolLease = "ironcore-volumepool-lease"
NamespaceBucketPoolLease = "ironcore-bucketpool-lease"
)

const (
VolumeVolumePoolRefNameField = "spec.volumePoolRef.name"
VolumeVolumeClassRefNameField = "spec.volumeClassRef.name"
Expand Down
7 changes: 7 additions & 0 deletions api/storage/v1alpha1/volumepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ const (
// VolumePoolConditionType is a type a VolumePoolCondition can have.
type VolumePoolConditionType string

const (
// VolumePoolReady means the volume pool is healthy and ready to accept volumes.
VolumePoolReady VolumePoolConditionType = "Ready"
)

// VolumePoolCondition is one of the conditions of a volume.
type VolumePoolCondition struct {
// Type is the type of the condition.
Expand All @@ -55,6 +60,8 @@ type VolumePoolCondition struct {
Message string `json:"message"`
// ObservedGeneration represents the .metadata.generation that the condition was set based upon.
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// LastUpdateTime is the last time this condition was updated.
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// LastTransitionTime is the last time the status of a condition has transitioned from one state to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
}
Expand Down
26 changes: 26 additions & 0 deletions api/storage/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions api/storage/v1alpha1/zz_generated.model_name.go

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

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

Loading