-
Notifications
You must be signed in to change notification settings - Fork 7
Add BIOSVersion resource and controller implementation
#311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a1abd1f
Add biosVersion resource and controller
nagadeesh-nagaraja e7a46f1
Change types and fix logic to handle vendor variations
nagadeesh-nagaraja 453a598
Stabilize some unit tests
nagadeesh-nagaraja 968927d
fix some of flaky test in server and biossetting controller
nagadeesh-nagaraja 0e609d0
remove bool from Spec and update finalizers
nagadeesh-nagaraja 1143290
Rebase with the testHelpers
nagadeesh-nagaraja b4ffc64
Revert some unwanted changes
nagadeesh-nagaraja d466b32
Do not error when waiting for verifications
nagadeesh-nagaraja f0d594d
Some cosmetic issue fixes
nagadeesh-nagaraja 5f32cd6
Review comments change to follow naming conventions
nagadeesh-nagaraja d665049
Fix docs and reconcile error when job has stalled
nagadeesh-nagaraja aa1539f
small adjustments
nagadeesh-nagaraja 06f0cdb
Add validation webhook for `BIOSVersion` type (#325)
nagadeesh-nagaraja 939b608
Add ResyncInterval in unit tests
nagadeesh-nagaraja c23c301
Use Pointer and mark required fields
nagadeesh-nagaraja File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| // SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| package v1alpha1 | ||
|
|
||
| import ( | ||
| "github.com/stmcginnis/gofish/common" | ||
| "github.com/stmcginnis/gofish/redfish" | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| type BIOSVersionState string | ||
|
|
||
| const ( | ||
| // BIOSVersionStatePending specifies that the bios upgrade maintenance is waiting | ||
| BIOSVersionStatePending BIOSVersionState = "Pending" | ||
| // BIOSVersionStateInProgress specifies that upgrading bios is in progress. | ||
| BIOSVersionStateInProgress BIOSVersionState = "Processing" | ||
| // BIOSVersionStateCompleted specifies that the bios upgrade maintenance has been completed. | ||
| BIOSVersionStateCompleted BIOSVersionState = "Completed" | ||
| // BIOSVersionStateFailed specifies that the bios upgrade maintenance has failed. | ||
| BIOSVersionStateFailed BIOSVersionState = "Failed" | ||
| ) | ||
|
|
||
| type BIOSUpdateType string | ||
|
|
||
| const ( | ||
| // BIOSVersionStatePending specifies that the bios upgrade maintenance is waiting | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ForceUpdatBIOS BIOSUpdateType = "ForceUpdate" | ||
| NormalUpdatBIOS BIOSUpdateType = "NormalUpdate" | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
| // BIOSVersionSpec defines the desired state of BIOSVersion. | ||
| type BIOSVersionSpec struct { | ||
| // Version contains BIOS version to upgrade to | ||
| // +required | ||
| Version string `json:"version"` | ||
| // An indication of whether the server's upgrade service should bypass vendor update policies | ||
| UpdateType BIOSUpdateType `json:"UpdateType,omitempty"` | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // details regarding the image to use to upgrade to given BIOS version | ||
| Image ImageSpec `json:"image,omitempty"` | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // ServerRef is a reference to a specific server to apply bios upgrade on. | ||
| // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="serverRef is immutable" | ||
| ServerRef *corev1.LocalObjectReference `json:"serverRef,omitempty"` | ||
|
|
||
| // ServerMaintenancePolicy is maintenance policy to be enforced on the server. | ||
| ServerMaintenancePolicy ServerMaintenancePolicy `json:"serverMaintenancePolicy,omitempty"` | ||
|
|
||
| // ServerMaintenanceRef is a reference to a ServerMaintenance object that that Controller has requested for the referred server. | ||
| ServerMaintenanceRef *corev1.ObjectReference `json:"serverMaintenanceRef,omitempty"` | ||
| } | ||
|
|
||
| type ImageSpec struct { | ||
| // ImageSecretRef is a reference to the Kubernetes Secret (of type SecretTypeBasicAuth) object that contains the credentials | ||
| // to access the ImageURI. This secret includes sensitive information such as usernames and passwords. | ||
| SecretRef *corev1.LocalObjectReference `json:"secretRef,omitempty"` | ||
| // The network protocol that the server's update service uses to retrieve 'ImageURI' | ||
| TransferProtocol string `json:"transferProtocol,omitempty"` | ||
| // The URI of the software image to update/install." | ||
| // +required | ||
| URI string `json:"URI,omitempty"` | ||
| } | ||
|
|
||
| // BIOSVersionStatus defines the observed state of BIOSVersion. | ||
| type BIOSVersionStatus struct { | ||
| // State represents the current state of the bios configuration task. | ||
| State BIOSVersionState `json:"state,omitempty"` | ||
|
|
||
| // UpgradeTask contains the state of the Upgrade Task created by the BMC | ||
| UpgradeTask *TaskStatus `json:"upgradeTask,omitempty"` | ||
| // Conditions represents the latest available observations of the Bios version upgrade state. | ||
| // +patchStrategy=merge | ||
| // +patchMergeKey=type | ||
| // +optional | ||
| Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` | ||
| } | ||
|
|
||
| type TaskStatus struct { | ||
| TaskURI string `json:"taskURI,omitempty"` | ||
| State redfish.TaskState `json:"taskState,omitempty"` | ||
| Status common.Health `json:"taskStatus,omitempty"` | ||
| PercentComplete int `json:"percentageComplete,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:scope=Cluster | ||
| // +kubebuilder:printcolumn:name="BIOSVersion",type=string,JSONPath=`.spec.biosVersionSpec.version` | ||
| // +kubebuilder:printcolumn:name="ForceUpdate",type=string,JSONPath=`.spec.biosVersionSpec.forceUpdate` | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // +kubebuilder:printcolumn:name="State",type=string,JSONPath=`.status.state` | ||
| // +kubebuilder:printcolumn:name="TaskState",type=string,JSONPath=`.status.upgradeTask.taskState` | ||
| // +kubebuilder:printcolumn:name="TaskStatus",type=string,JSONPath=`.status.upgradeTask.taskStatus` | ||
| // +kubebuilder:printcolumn:name="TaskProgress",type=integer,JSONPath=`.status.upgradeTask.percentageComplete` | ||
| // +kubebuilder:printcolumn:name="ServerRef",type=string,JSONPath=`.spec.serverRef.name` | ||
| // +kubebuilder:printcolumn:name="ServerMaintenanceRef",type=string,JSONPath=`.spec.serverMaintenanceRef.name` | ||
nagadeesh-nagaraja marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // BIOSVersion is the Schema for the biosversions API. | ||
| type BIOSVersion struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
|
||
| Spec BIOSVersionSpec `json:"spec,omitempty"` | ||
| Status BIOSVersionStatus `json:"status,omitempty"` | ||
| } | ||
|
|
||
| // +kubebuilder:object:root=true | ||
|
|
||
| // BIOSVersionList contains a list of BIOSVersion. | ||
| type BIOSVersionList struct { | ||
| metav1.TypeMeta `json:",inline"` | ||
| metav1.ListMeta `json:"metadata,omitempty"` | ||
| Items []BIOSVersion `json:"items"` | ||
| } | ||
|
|
||
| func init() { | ||
| SchemeBuilder.Register(&BIOSVersion{}, &BIOSVersionList{}) | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.