Skip to content

Commit f5b0269

Browse files
add hyperparameterconfigurations
1 parent 9edab1e commit f5b0269

File tree

6 files changed

+385
-14
lines changed

6 files changed

+385
-14
lines changed
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.9.0
7+
creationTimestamp: null
8+
name: hyperparameterconfigurations.config.katalyst.kubewharf.io
9+
spec:
10+
group: config.katalyst.kubewharf.io
11+
names:
12+
kind: HyperParameterConfiguration
13+
listKind: HyperParameterConfigurationList
14+
plural: hyperparameterconfigurations
15+
shortNames:
16+
- hpc
17+
singular: hyperparameterconfiguration
18+
scope: Namespaced
19+
versions:
20+
- additionalPrinterColumns:
21+
- jsonPath: .metadata.creationTimestamp
22+
name: AGE
23+
type: date
24+
- jsonPath: .spec.nodeLabelSelector
25+
name: SELECTOR
26+
type: string
27+
- jsonPath: .spec.priority
28+
name: PRIORITY
29+
type: string
30+
- jsonPath: .spec.ephemeralSelector.nodeNames
31+
name: NODES
32+
type: string
33+
- jsonPath: .spec.ephemeralSelector.lastDuration
34+
name: DURATION
35+
type: string
36+
- jsonPath: .status.conditions[?(@.type=="Valid")].status
37+
name: VALID
38+
type: string
39+
- jsonPath: .status.conditions[?(@.type=="Valid")].reason
40+
name: REASON
41+
type: string
42+
- jsonPath: .status.conditions[?(@.type=="Valid")].message
43+
name: MESSAGE
44+
type: string
45+
name: v1alpha1
46+
schema:
47+
openAPIV3Schema:
48+
description: HyperParameterConfiguration is the Schema for the hyperparameterconfigurations
49+
API
50+
properties:
51+
apiVersion:
52+
description: 'APIVersion defines the versioned schema of this representation
53+
of an object. Servers should convert recognized schemas to the latest
54+
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
55+
type: string
56+
kind:
57+
description: 'Kind is a string value representing the REST resource this
58+
object represents. Servers may infer this from the endpoint the client
59+
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
60+
type: string
61+
metadata:
62+
type: object
63+
spec:
64+
description: HyperParameterConfigurationSpec defines the desired state
65+
of HyperParameterConfiguration
66+
properties:
67+
config:
68+
properties:
69+
borweinProvisionConfig:
70+
description: BorweinProvisionConfig is configuration related to
71+
Borwein provision policy
72+
properties:
73+
borweinProvisionParams:
74+
description: BorweinProvisionParams is the list of parameter
75+
set for Borwein provision policy
76+
items:
77+
properties:
78+
indicatorTargetOffsetMax:
79+
type: number
80+
indicatorTargetOffsetMin:
81+
type: number
82+
indicatorTargetRampDownStep:
83+
type: number
84+
indicatorTargetRampUpStep:
85+
type: number
86+
modelAbnormalRatioThreshold:
87+
type: number
88+
paramID:
89+
type: integer
90+
paramVersion:
91+
type: integer
92+
type: object
93+
type: array
94+
type: object
95+
type: object
96+
type: object
97+
status:
98+
properties:
99+
collisionCount:
100+
description: Count of hash collisions for this cr. The kcc controller
101+
uses this field as a collision avoidance mechanism when it needs
102+
to create the name for the newest ControllerRevision.
103+
format: int32
104+
type: integer
105+
conditions:
106+
description: Represents the latest available observations of a config's
107+
current state.
108+
items:
109+
properties:
110+
lastTransitionTime:
111+
description: Last time the condition transit from one status
112+
to another.
113+
format: date-time
114+
type: string
115+
message:
116+
description: message is a human-readable explanation containing
117+
details about the transition
118+
type: string
119+
reason:
120+
description: reason is the reason for the condition's last transition.
121+
type: string
122+
status:
123+
description: Status of the condition, one of True, False, Unknown.
124+
type: string
125+
type:
126+
description: Type of config condition
127+
type: string
128+
required:
129+
- status
130+
- type
131+
type: object
132+
type: array
133+
observedGeneration:
134+
description: The most recent generation observed by the kcc controller.
135+
format: int64
136+
type: integer
137+
type: object
138+
type: object
139+
served: true
140+
storage: true
141+
subresources:
142+
status: {}

pkg/apis/config/v1alpha1/hpc.go

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
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+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
24+
// +kubebuilder:object:root=true
25+
// +kubebuilder:resource:path=hyperparameterconfigurations,shortName=hpc
26+
// +kubebuilder:subresource:status
27+
// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=.metadata.creationTimestamp
28+
// +kubebuilder:printcolumn:name="SELECTOR",type=string,JSONPath=".spec.nodeLabelSelector"
29+
// +kubebuilder:printcolumn:name="PRIORITY",type=string,JSONPath=".spec.priority"
30+
// +kubebuilder:printcolumn:name="NODES",type=string,JSONPath=".spec.ephemeralSelector.nodeNames"
31+
// +kubebuilder:printcolumn:name="DURATION",type=string,JSONPath=".spec.ephemeralSelector.lastDuration"
32+
// +kubebuilder:printcolumn:name="VALID",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].status"
33+
// +kubebuilder:printcolumn:name="REASON",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].reason"
34+
// +kubebuilder:printcolumn:name="MESSAGE",type=string,JSONPath=".status.conditions[?(@.type==\"Valid\")].message"
35+
36+
// HyperParameterConfiguration is the Schema for the hyperparameterconfigurations API
37+
type HyperParameterConfiguration struct {
38+
metav1.TypeMeta `json:",inline"`
39+
metav1.ObjectMeta `json:"metadata,omitempty"`
40+
41+
Spec HyperParameterConfigurationSpec `json:"spec,omitempty"`
42+
Status GenericConfigStatus `json:"status,omitempty"`
43+
}
44+
45+
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
46+
// +kubebuilder:object:root=true
47+
48+
// HyperParameterConfigurationList contains a list of HyperParameterConfiguration
49+
type HyperParameterConfigurationList struct {
50+
metav1.TypeMeta `json:",inline"`
51+
metav1.ListMeta `json:"metadata,omitempty"`
52+
53+
Items []HyperParameterConfiguration `json:"items"`
54+
}
55+
56+
// HyperParameterConfigurationSpec defines the desired state of HyperParameterConfiguration
57+
type HyperParameterConfigurationSpec struct {
58+
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
59+
// Important: Run "make" to regenerate code after modifying this file
60+
61+
Config HyperParameterConfig `json:"config,omitempty"`
62+
}
63+
64+
type BorweinProvisionParam struct {
65+
// +optional
66+
ModelAbnormalRatioThreshold float64 `json:"modelAbnormalRatioThreshold,omitempty"`
67+
// +optional
68+
IndicatorTargetOffsetMax float64 `json:"indicatorTargetOffsetMax,omitempty"`
69+
// +optional
70+
IndicatorTargetOffsetMin float64 `json:"indicatorTargetOffsetMin,omitempty"`
71+
// +optional
72+
IndicatorTargetRampUpStep float64 `json:"indicatorTargetRampUpStep,omitempty"`
73+
// +optional
74+
IndicatorTargetRampDownStep float64 `json:"indicatorTargetRampDownStep,omitempty"`
75+
// +optional
76+
ParamVersion int `json:"paramVersion,omitempty"`
77+
// +optional
78+
ParamID int `json:"paramID,omitempty"`
79+
}
80+
81+
type BorweinProvisionConfig struct {
82+
// BorweinProvisionParams is the list of parameter set for Borwein provision policy
83+
// +optional
84+
BorweinProvisionParams []BorweinProvisionParam `json:"borweinProvisionParams,omitempty"`
85+
}
86+
87+
type HyperParameterConfig struct {
88+
// BorweinProvisionConfig is configuration related to Borwein provision policy
89+
// +optional
90+
BorweinProvisionConfig *BorweinProvisionConfig `json:"borweinProvisionConfig,omitempty"`
91+
}

pkg/apis/config/v1alpha1/register.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
8181
&AuthConfigurationList{},
8282
&TransparentMemoryOffloadingConfiguration{},
8383
&TransparentMemoryOffloadingConfigurationList{},
84+
&HyperParameterConfiguration{},
85+
&HyperParameterConfigurationList{},
8486
)
8587

8688
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

pkg/apis/config/v1alpha1/zz_generated.deepcopy.go

Lines changed: 136 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)