-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from adrianchiris/add-maintenance-operator-conf…
…ig-api Add maintenance operator config api
- Loading branch information
Showing
17 changed files
with
1,015 additions
and
23 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,81 @@ | ||
/* | ||
Copyright 2024, NVIDIA CORPORATION & AFFILIATES | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
"k8s.io/apimachinery/pkg/util/intstr" | ||
) | ||
|
||
// OperatorLogLevel is the operator log level. one of: ["debug", "info", "error"] | ||
// +kubebuilder:validation:Enum=debug;info;error | ||
type OperatorLogLevel string | ||
|
||
// MaintenanceOperatorConfigSpec defines the desired state of MaintenanceOperatorConfig | ||
type MaintenanceOperatorConfigSpec struct { | ||
// MaxParallelOperations indicates the maximal number nodes that can undergo maintenance | ||
// at a given time. 0 means no limit | ||
// value can be an absolute number (ex: 5) or a percentage of total nodes in the cluster (ex: 10%). | ||
// absolute number is calculated from percentage by rounding up. | ||
// defaults to 1. The actual number of nodes that can undergo maintenance may be lower depending | ||
// on the value of MaintenanceOperatorConfigSpec.MaxUnavailable. | ||
// +kubebuilder:default=1 | ||
// +kubebuilder:validation:XIntOrString | ||
MaxParallelOperations *intstr.IntOrString `json:"maxParallelOperations,omitempty"` | ||
|
||
// MaxUnavailable is the maximum number of nodes that can become unavailable in the cluster. | ||
// value can be an absolute number (ex: 5) or a percentage of total nodes in the cluster (ex: 10%). | ||
// absolute number is calculated from percentage by rounding up. | ||
// by default, unset. | ||
// new nodes will not be processed if the number of unavailable node will exceed this value | ||
// +kubebuilder:validation:XIntOrString | ||
MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"` | ||
|
||
// LogLevel is the operator logging level | ||
// +kubebuilder:default="info" | ||
LogLevel OperatorLogLevel `json:"logLevel,omitempty"` | ||
|
||
// MaxNodeMaintenanceTimeSeconds is the time from when a NodeMaintenance is marked as ready (phase: Ready) | ||
// until the NodeMaintenance is considered stale and removed by the operator. | ||
// should be less than idle time for any autoscaler that is running. | ||
// default to 30m (1600 seconds) | ||
// +kubebuilder:default=1600 | ||
MaxNodeMaintenanceTimeSeconds uint32 `json:"maxNodeMaintenanceTimeSeconds,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// MaintenanceOperatorConfig is the Schema for the maintenanceoperatorconfigs API | ||
type MaintenanceOperatorConfig struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec MaintenanceOperatorConfigSpec `json:"spec,omitempty"` | ||
} | ||
|
||
//+kubebuilder:object:root=true | ||
|
||
// MaintenanceOperatorConfigList contains a list of MaintenanceOperatorConfig | ||
type MaintenanceOperatorConfigList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []MaintenanceOperatorConfig `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&MaintenanceOperatorConfig{}, &MaintenanceOperatorConfigList{}) | ||
} |
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.