Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
8 changes: 8 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -142,4 +142,12 @@ resources:
kind: BMCVersionSet
path: github.com/ironcore-dev/metal-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
controller: true
domain: ironcore.dev
group: metal
kind: BMCSettingsSet
path: github.com/ironcore-dev/metal-operator/api/v1alpha1
version: v1alpha1
version: "3"
20 changes: 13 additions & 7 deletions api/v1alpha1/bmcsettings_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (

// BMCSettings refer's to Out-Of-Band_management like IDrac for Dell, iLo for HPE etc Settings

// BMCSettingsSpec defines the desired state of BMCSettings.
type BMCSettingsSpec struct {
type BMCSettingsTemplate struct {

// Version defines the BMC firmware for which the settings should be applied.
// +required
Version string `json:"version"`
Expand All @@ -20,11 +20,6 @@ type BMCSettingsSpec struct {
// +optional
SettingsMap map[string]string `json:"settings,omitempty"`

// BMCRef is a reference to a specific BMC to apply setting to.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverRef is immutable"
// +optional
BMCRef *corev1.LocalObjectReference `json:"BMCRef,omitempty"`

// ServerMaintenancePolicy is a maintenance policy to be applied on the server.
// +optional
ServerMaintenancePolicy ServerMaintenancePolicy `json:"serverMaintenancePolicy,omitempty"`
Expand All @@ -35,6 +30,17 @@ type BMCSettingsSpec struct {
ServerMaintenanceRefs []ServerMaintenanceRefItem `json:"serverMaintenanceRefs,omitempty"`
}

// BMCSettingsSpec defines the desired state of BMCSettings.

type BMCSettingsSpec struct {
BMCSettingsTemplate `json:",inline"`

// BMCRef is a reference to a specific BMC to apply setting to.
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverRef is immutable"
// +optional
BMCRef *corev1.LocalObjectReference `json:"BMCRef,omitempty"`
}

// ServerMaintenanceRefItem is a reference to a ServerMaintenance object.
type ServerMaintenanceRefItem struct {
// ServerMaintenanceRef is a reference to a ServerMaintenance object that the BMCSettings has requested for the referred server.
Expand Down
68 changes: 68 additions & 0 deletions api/v1alpha1/bmcsettingsset_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors
// SPDX-License-Identifier: Apache-2.0

package v1alpha1

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

// BMCSettingsSetSpec defines the desired state of BMCSettingsSet.
type BMCSettingsSetSpec struct {
// BMCSettingsTemplate defines the template for the BMCSettings Resource to be applied to the servers.
BMCSettingsTemplate BMCSettingsTemplate `json:"bmcSettingsTemplate,omitempty"`

// BMCSelector specifies a label selector to identify the servers that are to be selected.
// +required
BMCSelector metav1.LabelSelector `json:"bmcSelector"`
}

// BMCSettingsSetStatus defines the observed state of BMCSettingsSet.
type BMCSettingsSetStatus struct {
// FullyLabeledBMCs is the number of BMC in the set.
FullyLabeledBMCs int32 `json:"fullyLabeledBMCs,omitempty"`
// AvailableBMCSettings is the number of BMCSettings currently created by the set.
AvailableBMCSettings int32 `json:"availableBMCSettings,omitempty"`
// PendingBMCSettings is the total number of pending BMC in the set.
PendingBMCSettings int32 `json:"pendingBMCSettings,omitempty"`
// InProgressBMCSettings is the total number of BMC in the set that are currently in progress.
InProgressBMCSettings int32 `json:"inProgressBMCSettings,omitempty"`
// CompletedBMCSettings is the total number of completed BMC in the set.
CompletedBMCSettings int32 `json:"completedBMCSettings,omitempty"`
// FailedBMCSettings is the total number of failed BMC in the set.
FailedBMCSettings int32 `json:"failedBMCSettings,omitempty"`
}

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:printcolumn:name="BMCVersion",type=string,JSONPath=`.spec.bmcSettingsTemplate.version`
// +kubebuilder:printcolumn:name="TotalBMCs",type="integer",JSONPath=`.status.fullyLabeledBMCs`
// +kubebuilder:printcolumn:name="AvailableBMCSettings",type="integer",JSONPath=`.status.availableBMCSettings`
// +kubebuilder:printcolumn:name="Pending",type="integer",JSONPath=`.status.pendingBMCSettings`
// +kubebuilder:printcolumn:name="InProgress",type="integer",JSONPath=`.status.inProgressBMCSettings`
// +kubebuilder:printcolumn:name="Completed",type="integer",JSONPath=`.status.completedBMCSettings`
// +kubebuilder:printcolumn:name="Failed",type="integer",JSONPath=`.status.failedBMCSettings`
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"

// BMCSettingsSet is the Schema for the bmcsettingssets API.
type BMCSettingsSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec BMCSettingsSetSpec `json:"spec,omitempty"`
Status BMCSettingsSetStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

// BMCSettingsSetList contains a list of BMCSettingsSet.
type BMCSettingsSetList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []BMCSettingsSet `json:"items"`
}

func init() {
SchemeBuilder.Register(&BMCSettingsSet{}, &BMCSettingsSetList{})
}
133 changes: 120 additions & 13 deletions api/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,13 @@ func main() { // nolint: gocyclo
setupLog.Error(err, "unable to create controller", "controller", "BIOSSettingsSet")
os.Exit(1)
}
if err := (&controller.BMCSettingsSetReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "BMCSettingsSet")
os.Exit(1)
}
//+kubebuilder:scaffold:builder

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/metal.ironcore.dev_bmcsettings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ spec:
metadata:
type: object
spec:
description: BMCSettingsSpec defines the desired state of BMCSettings.
properties:
BMCRef:
description: BMCRef is a reference to a specific BMC to apply setting
Expand Down
Loading
Loading