-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add ServerMaintenance
API type
#208
Open
afritzler
wants to merge
2
commits into
main
Choose a base branch
from
enh/servermaintenance
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+792
−15
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 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 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 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,84 @@ | ||
// SPDX-FileCopyrightText: 2025 SAP SE or an SAP affiliate company and IronCore contributors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
corev1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
const ( | ||
ServerMaintenanceReasonAnnotationKey = "metal.ironcore.dev/reason" | ||
) | ||
|
||
// ServerBootConfigurationTemplate defines the parameters to be used for rendering a boot configuration. | ||
type ServerBootConfigurationTemplate struct { | ||
// Name specifies the name of the boot configuration. | ||
Name string `json:"name"` | ||
// Parameters specifies the parameters to be used for rendering the boot configuration. | ||
Spec ServerBootConfigurationSpec `json:"spec"` | ||
} | ||
|
||
// ServerMaintenanceSpec defines the desired state of a ServerMaintenance | ||
type ServerMaintenanceSpec struct { | ||
// Policy specifies the maintenance policy to be enforced on the server. | ||
Policy ServerMaintenancePolicy `json:"policy,omitempty"` | ||
// ServerRef is a reference to the server that is to be maintained. | ||
ServerRef corev1.LocalObjectReference `json:"serverRef"` | ||
// ServerPower specifies the power state of the server during maintenance. | ||
ServerPower Power `json:"serverPower,omitempty"` | ||
// ServerBootConfigurationTemplate specifies the boot configuration to be applied to the server during maintenance. | ||
ServerBootConfigurationTemplate *ServerBootConfigurationTemplate `json:"serverBootConfigurationTemplate,omitempty"` | ||
} | ||
|
||
type ServerMaintenancePolicy string | ||
|
||
const ( | ||
ServerMaintenancePolicyOwnerApproval ServerMaintenancePolicy = "OwnerApproval" | ||
ServerMaintenancePolicyEnforced ServerMaintenancePolicy = "Enforced" | ||
) | ||
|
||
// ServerMaintenanceStatus defines the observed state of a ServerMaintenance | ||
type ServerMaintenanceStatus struct { | ||
State ServerMaintenanceState `json:"state,omitempty"` | ||
} | ||
|
||
type ServerMaintenanceState string | ||
|
||
const ( | ||
ServerMaintenanceStatePending ServerMaintenanceState = "Pending" | ||
ServerMaintenanceStateInMaintenance ServerMaintenanceState = "InMaintenance" | ||
ServerMaintenanceStateCompleted ServerMaintenanceState = "Completed" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:printcolumn:name="Server",type="string",JSONPath=".spec.serverRef.name" | ||
// +kubebuilder:printcolumn:name="Policy",type="string",JSONPath=`.spec.policy` | ||
// +kubebuilder:printcolumn:name="BootConfiguration",type="string",JSONPath=`.spec.serverBootConfigurationTemplate.name` | ||
// +kubebuilder:printcolumn:name="Reason",type="string",JSONPath=`.metadata.annotations.metal\.ironcore\.dev\/reason` | ||
// +kubebuilder:printcolumn:name="State",type="string",JSONPath=`.status.state` | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
|
||
// ServerMaintenance is the Schema for the ServerMaintenance API | ||
type ServerMaintenance struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec ServerMaintenanceSpec `json:"spec,omitempty"` | ||
Status ServerMaintenanceStatus `json:"status,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// ServerMaintenanceList contains a list of ServerMaintenances | ||
type ServerMaintenanceList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []ServerMaintenance `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&ServerMaintenance{}, &ServerMaintenanceList{}) | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
151 changes: 151 additions & 0 deletions
151
config/crd/bases/metal.ironcore.dev_servermaintenances.yaml
This file contains 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,151 @@ | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.17.1 | ||
name: servermaintenances.metal.ironcore.dev | ||
spec: | ||
group: metal.ironcore.dev | ||
names: | ||
kind: ServerMaintenance | ||
listKind: ServerMaintenanceList | ||
plural: servermaintenances | ||
singular: servermaintenance | ||
scope: Namespaced | ||
versions: | ||
- additionalPrinterColumns: | ||
- jsonPath: .spec.serverRef.name | ||
name: Server | ||
type: string | ||
- jsonPath: .spec.policy | ||
name: Policy | ||
type: string | ||
- jsonPath: .spec.serverBootConfigurationTemplate.name | ||
name: BootConfiguration | ||
type: string | ||
- jsonPath: .metadata.annotations.metal\.ironcore\.dev\/reason | ||
name: Reason | ||
type: string | ||
- jsonPath: .status.state | ||
name: State | ||
type: string | ||
- jsonPath: .metadata.creationTimestamp | ||
name: Age | ||
type: date | ||
name: v1alpha1 | ||
schema: | ||
openAPIV3Schema: | ||
description: ServerMaintenance is the Schema for the ServerMaintenance API | ||
properties: | ||
apiVersion: | ||
description: |- | ||
APIVersion defines the versioned schema of this representation of an object. | ||
Servers should convert recognized schemas to the latest internal value, and | ||
may reject unrecognized values. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources | ||
type: string | ||
kind: | ||
description: |- | ||
Kind is a string value representing the REST resource this object represents. | ||
Servers may infer this from the endpoint the client submits requests to. | ||
Cannot be updated. | ||
In CamelCase. | ||
More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds | ||
type: string | ||
metadata: | ||
type: object | ||
spec: | ||
description: ServerMaintenanceSpec defines the desired state of a ServerMaintenance | ||
properties: | ||
policy: | ||
description: Policy specifies the maintenance policy to be enforced | ||
on the server. | ||
type: string | ||
serverBootConfigurationTemplate: | ||
description: ServerBootConfigurationTemplate specifies the boot configuration | ||
to be applied to the server during maintenance. | ||
properties: | ||
name: | ||
description: Name specifies the name of the boot configuration. | ||
type: string | ||
spec: | ||
description: Parameters specifies the parameters to be used for | ||
rendering the boot configuration. | ||
properties: | ||
ignitionSecretRef: | ||
description: |- | ||
IgnitionSecretRef is a reference to the Kubernetes Secret object that contains | ||
the ignition configuration for the server. This field is optional and can be omitted if not specified. | ||
properties: | ||
name: | ||
default: "" | ||
description: |- | ||
Name of the referent. | ||
This field is effectively required, but due to backwards compatibility is | ||
allowed to be empty. Instances of this type with an empty value here are | ||
almost certainly wrong. | ||
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
image: | ||
description: |- | ||
Image specifies the boot image to be used for the server. | ||
This field is optional and can be omitted if not specified. | ||
type: string | ||
serverRef: | ||
description: ServerRef is a reference to the server for which | ||
this boot configuration is intended. | ||
properties: | ||
name: | ||
default: "" | ||
description: |- | ||
Name of the referent. | ||
This field is effectively required, but due to backwards compatibility is | ||
allowed to be empty. Instances of this type with an empty value here are | ||
almost certainly wrong. | ||
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
required: | ||
- serverRef | ||
type: object | ||
required: | ||
- name | ||
- spec | ||
type: object | ||
serverPower: | ||
description: ServerPower specifies the power state of the server during | ||
maintenance. | ||
type: string | ||
serverRef: | ||
description: ServerRef is a reference to the server that is to be | ||
maintained. | ||
properties: | ||
name: | ||
default: "" | ||
description: |- | ||
Name of the referent. | ||
This field is effectively required, but due to backwards compatibility is | ||
allowed to be empty. Instances of this type with an empty value here are | ||
almost certainly wrong. | ||
More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
required: | ||
- serverRef | ||
type: object | ||
status: | ||
description: ServerMaintenanceStatus defines the observed state of a ServerMaintenance | ||
properties: | ||
state: | ||
type: string | ||
type: object | ||
type: object | ||
served: true | ||
storage: true | ||
subresources: | ||
status: {} |
This file contains 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should there be a way to refer if the Maintenance process failed for some reason?