Skip to content

Commit 1cff960

Browse files
add hyperparameterconfigurations
1 parent 9edab1e commit 1cff960

File tree

16 files changed

+946
-19
lines changed

16 files changed

+946
-19
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: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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+
}

pkg/apis/config/v1alpha1/register.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha
4141

4242
// ResourceName const is used to construct standard gvr
4343
const (
44-
ResourceNameKatalystCustomConfigs = "katalystcustomconfigs"
45-
ResourceNameCustomNodeConfigs = "customnodeconfigs"
46-
ResourceNameAdminQoSConfigurations = "adminqosconfigurations"
47-
ResourceNameAuthConfigurations = "authconfigurations"
48-
ResourceNameTMOConfigurations = "transparentmemoryoffloadingconfigurations"
44+
ResourceNameKatalystCustomConfigs = "katalystcustomconfigs"
45+
ResourceNameCustomNodeConfigs = "customnodeconfigs"
46+
ResourceNameAdminQoSConfigurations = "adminqosconfigurations"
47+
ResourceNameAuthConfigurations = "authconfigurations"
48+
ResourceNameTMOConfigurations = "transparentmemoryoffloadingconfigurations"
49+
ResourceNameHyperParameterConfigurations = "hyperparameterconfigurations"
4950
)
5051

5152
// Resource takes an unqualified resource and returns a Group qualified GroupResource
@@ -81,6 +82,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
8182
&AuthConfigurationList{},
8283
&TransparentMemoryOffloadingConfiguration{},
8384
&TransparentMemoryOffloadingConfigurationList{},
85+
&HyperParameterConfiguration{},
86+
&HyperParameterConfigurationList{},
8487
)
8588

8689
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)

0 commit comments

Comments
 (0)