|
| 1 | +/* |
| 2 | +Copyright 2022 The Katalyst Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package v1alpha1 |
| 18 | + |
| 19 | +import ( |
| 20 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 21 | +) |
| 22 | + |
| 23 | +// +genclient |
| 24 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 25 | +// +kubebuilder:object:root=true |
| 26 | +// +kubebuilder:resource:path=hyperparameterconfigurations,shortName=hpc |
| 27 | +// +kubebuilder:subresource:status |
| 28 | +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=.metadata.creationTimestamp |
| 29 | +// +kubebuilder:printcolumn:name="SELECTOR",type=string,JSONPath=".spec.nodeLabelSelector" |
| 30 | +// +kubebuilder:printcolumn:name="PRIORITY",type=string,JSONPath=".spec.priority" |
| 31 | +// +kubebuilder:printcolumn:name="NODES",type=string,JSONPath=".spec.ephemeralSelector.nodeNames" |
| 32 | +// +kubebuilder:printcolumn:name="DURATION",type=string,JSONPath=".spec.ephemeralSelector.lastDuration" |
| 33 | +// +kubebuilder:printcolumn:name="VALID",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].status" |
| 34 | +// +kubebuilder:printcolumn:name="REASON",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].reason" |
| 35 | +// +kubebuilder:printcolumn:name="MESSAGE",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].message" |
| 36 | + |
| 37 | +// HyperParameterConfiguration is the Schema for the hyperparameterconfigurations API |
| 38 | +type HyperParameterConfiguration struct { |
| 39 | + metav1.TypeMeta `json:",inline"` |
| 40 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 41 | + |
| 42 | + Spec HyperParameterConfigurationSpec `json:"spec,omitempty"` |
| 43 | + Status GenericConfigStatus `json:"status,omitempty"` |
| 44 | +} |
| 45 | + |
| 46 | +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object |
| 47 | +// +kubebuilder:object:root=true |
| 48 | + |
| 49 | +// HyperParameterConfigurationList contains a list of HyperParameterConfiguration |
| 50 | +type HyperParameterConfigurationList struct { |
| 51 | + metav1.TypeMeta `json:",inline"` |
| 52 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 53 | + |
| 54 | + Items []HyperParameterConfiguration `json:"items"` |
| 55 | +} |
| 56 | + |
| 57 | +// HyperParameterConfigurationSpec defines the desired state of HyperParameterConfiguration |
| 58 | +type HyperParameterConfigurationSpec struct { |
| 59 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 60 | + // Important: Run "make" to regenerate code after modifying this file |
| 61 | + |
| 62 | + Config HyperParameterConfig `json:"config,omitempty"` |
| 63 | +} |
| 64 | + |
| 65 | +type BorweinProvisionParam struct { |
| 66 | + // +optional |
| 67 | + ModelAbnormalRatioThreshold float64 `json:"modelAbnormalRatioThreshold,omitempty"` |
| 68 | + // +optional |
| 69 | + IndicatorTargetOffsetMax float64 `json:"indicatorTargetOffsetMax,omitempty"` |
| 70 | + // +optional |
| 71 | + IndicatorTargetOffsetMin float64 `json:"indicatorTargetOffsetMin,omitempty"` |
| 72 | + // +optional |
| 73 | + IndicatorTargetRampUpStep float64 `json:"indicatorTargetRampUpStep,omitempty"` |
| 74 | + // +optional |
| 75 | + IndicatorTargetRampDownStep float64 `json:"indicatorTargetRampDownStep,omitempty"` |
| 76 | + // +optional |
| 77 | + ParamVersion int `json:"paramVersion,omitempty"` |
| 78 | + // +optional |
| 79 | + ParamID int `json:"paramID,omitempty"` |
| 80 | +} |
| 81 | + |
| 82 | +type BorweinProvisionConfig struct { |
| 83 | + // BorweinProvisionParams is the list of parameter set for Borwein provision policy |
| 84 | + // +optional |
| 85 | + BorweinProvisionParams []BorweinProvisionParam `json:"borweinProvisionParams,omitempty"` |
| 86 | +} |
| 87 | + |
| 88 | +type HyperParameterConfig struct { |
| 89 | + // BorweinProvisionConfig is configuration related to Borwein provision policy |
| 90 | + // +optional |
| 91 | + BorweinProvisionConfig *BorweinProvisionConfig `json:"borweinProvisionConfig,omitempty"` |
| 92 | +} |
0 commit comments