forked from kubeflow/katib
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1alpha3: Add suggestion CRD #1
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a7a144
Adding initial v1alpha2 API controller (#457)
johnugeorge 728b37b
chore: Skip test when code is not changed (#467)
gaocegege bc57a6d
Add serviceAccountName in UI deployment (#469)
andreyvelich 6213e63
feat: Introduce suggestion
gaocegege 1c3994c
owners: Add xinyi yu
gaocegege File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,68 @@ | ||
/* | ||
Copyright 2018 The Kubeflow Authors | ||
|
||
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. | ||
*/ | ||
|
||
/* | ||
Katib-controller is a controller (operator) for Experiments and Trials | ||
*/ | ||
package main | ||
|
||
import ( | ||
"log" | ||
|
||
"github.com/kubeflow/katib/pkg/api/operators/apis" | ||
controller "github.com/kubeflow/katib/pkg/controller/v1alpha3" | ||
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp" | ||
"sigs.k8s.io/controller-runtime/pkg/client/config" | ||
"sigs.k8s.io/controller-runtime/pkg/manager" | ||
logf "sigs.k8s.io/controller-runtime/pkg/runtime/log" | ||
"sigs.k8s.io/controller-runtime/pkg/runtime/signals" | ||
) | ||
|
||
func main() { | ||
logf.SetLogger(logf.ZapLogger(false)) | ||
// Get a config to talk to the apiserver | ||
cfg, err := config.GetConfig() | ||
if err != nil { | ||
log.Printf("config.GetConfig()") | ||
log.Fatal(err) | ||
} | ||
|
||
// Create a new katib controller to provide shared dependencies and start components | ||
mgr, err := manager.New(cfg, manager.Options{}) | ||
if err != nil { | ||
log.Printf("manager.New") | ||
log.Fatal(err) | ||
} | ||
|
||
log.Printf("Registering Components.") | ||
|
||
// Setup Scheme for all resources | ||
if err := apis.AddToScheme(mgr.GetScheme()); err != nil { | ||
log.Printf("apis.AddToScheme") | ||
log.Fatal(err) | ||
} | ||
|
||
// Setup katib controller | ||
if err := controller.AddToManager(mgr); err != nil { | ||
log.Printf("controller.AddToManager(mgr)") | ||
log.Fatal(err) | ||
} | ||
|
||
log.Printf("Starting the Cmd.") | ||
|
||
// Starting the katib controller | ||
log.Fatal(mgr.Start(signals.SetupSignalHandler())) | ||
} |
26 changes: 26 additions & 0 deletions
26
pkg/api/operators/apis/addtoscheme_experiments_v1alpha3.go
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,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/experiment/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
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,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/suggestion/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
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,26 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 apis | ||
|
||
import ( | ||
"github.com/kubeflow/katib/pkg/api/operators/apis/trial/v1alpha2" | ||
) | ||
|
||
func init() { | ||
// Register the types with the Scheme so the components can map objects to GroupVersionKinds and back | ||
AddToSchemes = append(AddToSchemes, v1alpha2.SchemeBuilder.AddToScheme) | ||
} |
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,18 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 suggestion contains suggestions API versions | ||
package suggestion |
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,23 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 v1alpha2 contains API Schema definitions for the suggestions v1alpha2 API group | ||
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/suggestions | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=suggestions.kubeflow.org | ||
package v1alpha2 |
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,46 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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. | ||
*/ | ||
|
||
// NOTE: Boilerplate only. Ignore this file. | ||
|
||
// Package v1alpha2 contains API Schema definitions for the suggestions v1alpha2 API group | ||
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=github.com/kubeflow/katib/pkg/apis/suggestions | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +groupName=suggestions.kubeflow.org | ||
package v1alpha2 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
"sigs.k8s.io/controller-runtime/pkg/runtime/scheme" | ||
) | ||
|
||
var ( | ||
// SchemeGroupVersion is group version used to register these objects | ||
SchemeGroupVersion = schema.GroupVersion{Group: "suggestions.kubeflow.org", Version: "v1alpha2"} | ||
|
||
// SchemeBuilder is used to add go types to the GroupVersionKind scheme | ||
SchemeBuilder = &scheme.Builder{GroupVersion: SchemeGroupVersion} | ||
|
||
// AddToScheme is required by pkg/client/... | ||
AddToScheme = SchemeBuilder.AddToScheme | ||
) | ||
|
||
// Resource is required by pkg/client/listers/... | ||
func Resource(resource string) schema.GroupResource { | ||
return SchemeGroupVersion.WithResource(resource).GroupResource() | ||
} |
125 changes: 125 additions & 0 deletions
125
pkg/api/operators/apis/suggestion/v1alpha2/suggestion_types.go
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,125 @@ | ||
/* | ||
Copyright 2019 The Kubernetes Authors. | ||
|
||
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 v1alpha2 | ||
|
||
import ( | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// SuggestionSpec defines the desired state of Suggestion | ||
type SuggestionSpec struct { | ||
// Number of desired pods. This is a pointer to distinguish between explicit | ||
// zero and not specified. Defaults to 1. | ||
// +optional | ||
Replicas *int32 `json:"replicas,omitempty"` | ||
|
||
// Type of the suggestion. | ||
Type SuggestionType `json:"type,omitempty"` | ||
|
||
// Defines if the suggestion needs previous results. | ||
NeedHistory bool `json:"needHistory,omitempty"` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If NeedHistory == true, what does it mean for ES and HP? For HP, it means it needs trial final metrics (opposite: random search), while in ES, it needs periodical metrics? |
||
|
||
// Template describes the pods that will be created. | ||
Template v1.PodTemplateSpec `json:"template"` | ||
} | ||
|
||
type SuggestionType string | ||
|
||
const ( | ||
SuggestionTypeNAS = "NAS" | ||
SuggestionTypeEarlyStopping = "EarlyStopping" | ||
SuggestionTypeHPTuning = "HyperParameter" | ||
) | ||
|
||
// SuggestionStatus defines the observed state of Suggestion | ||
type SuggestionStatus struct { | ||
// Represents time when the Experiment was acknowledged by the Experiment controller. | ||
// It is not guaranteed to be set in happens-before order across separate operations. | ||
// It is represented in RFC3339 form and is in UTC. | ||
StartTime *metav1.Time `json:"startTime,omitempty"` | ||
|
||
// Represents time when the Experiment was completed. It is not guaranteed to | ||
// be set in happens-before order across separate operations. | ||
// It is represented in RFC3339 form and is in UTC. | ||
CompletionTime *metav1.Time `json:"completionTime,omitempty"` | ||
|
||
// Represents last time when the Experiment was reconciled. It is not guaranteed to | ||
// be set in happens-before order across separate operations. | ||
// It is represented in RFC3339 form and is in UTC. | ||
LastReconcileTime *metav1.Time `json:"lastReconcileTime,omitempty"` | ||
|
||
// List of observed runtime conditions for this Experiment. | ||
Conditions []SuggestionCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen=true | ||
// SuggestionCondition describes the state of the suggestion at a certain point. | ||
type SuggestionCondition struct { | ||
// Type of experiment condition. | ||
Type SuggestionConditionType `json:"type"` | ||
|
||
// Status of the condition, one of True, False, Unknown. | ||
Status v1.ConditionStatus `json:"status"` | ||
|
||
// The reason for the condition's last transition. | ||
Reason string `json:"reason,omitempty"` | ||
|
||
// A human readable message indicating details about the transition. | ||
Message string `json:"message,omitempty"` | ||
|
||
// The last time this condition was updated. | ||
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"` | ||
|
||
// Last time the condition transitioned from one status to another. | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
} | ||
|
||
// SuggestionConditionType defines the state of an Suggestion. | ||
type SuggestionConditionType string | ||
|
||
const ( | ||
SuggestionDeploymentAvailable SuggestionConditionType = "DeploymentAvailable" | ||
SuggestionDeploymentProgressing SuggestionConditionType = "DeploymentProgressing" | ||
SuggestionDeploymentReplicaFailure SuggestionConditionType = "DeploymentReplicaFailure" | ||
) | ||
|
||
// +genclient | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// Suggestion is the Schema for the suggestions API | ||
// +k8s:openapi-gen=true | ||
type Suggestion struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
Spec SuggestionSpec `json:"spec,omitempty"` | ||
Status SuggestionStatus `json:"status,omitempty"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// SuggestionList contains a list of Suggestion | ||
type SuggestionList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []Suggestion `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&Suggestion{}, &SuggestionList{}) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
experiment: v1alpha3
trial: v1alpha2 (?)
suggestion: v1alpha2 (?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API
GRPC API
controller