-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
378 additions
and
2 deletions.
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
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.