-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* enable test for v1alpha2 * add KATIB-CORE-NAMESPACE env for controller * update example filed * share same image for two version controller * add status in subresources of crd
- Loading branch information
1 parent
bc57a6d
commit 78a4563
Showing
31 changed files
with
1,478 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
apiVersion: "kubeflow.org/v1alpha2" | ||
kind: Experiment | ||
metadata: | ||
namespace: kubeflow | ||
name: random-experiment | ||
spec: | ||
parallelTrialCount: 3 | ||
maxTrialCount: 12 | ||
maxFailedTrialCount: 3 | ||
objective: | ||
type: maximize | ||
goal: 0.99 | ||
objectiveMetricName: Validation-accuracy | ||
additionalMetricsNames: | ||
- accuracy | ||
algorithm: | ||
algorithmName: random | ||
trialTemplate: | ||
goTemplate: | ||
rawTemplate: |- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{.Trial}} | ||
namespace: {{.NameSpace}} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{.Trial}} | ||
image: katib/mxnet-mnist-example | ||
command: | ||
- "python" | ||
- "/mxnet/example/image-classification/train_mnist.py" | ||
- "--batch-size=64" | ||
{{- with .HyperParameters}} | ||
{{- range .}} | ||
- "{{.Name}}={{.Value}}" | ||
{{- end}} | ||
{{- end}} | ||
restartPolicy: Never | ||
parameters: | ||
- name: --lr | ||
parameterType: double | ||
feasibleSpace: | ||
min: "0.01" | ||
max: "0.03" | ||
- name: --num-layers | ||
parameterType: int | ||
feasibleSpace: | ||
min: "2" | ||
max: "5" | ||
- name: --optimizer | ||
parameterType: categorical | ||
feasibleSpace: | ||
list: | ||
- sgd | ||
- adam | ||
- ftrl |
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,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: kubeflow |
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,29 @@ | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: experiments.kubeflow.org | ||
spec: | ||
group: kubeflow.org | ||
version: v1alpha2 | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
names: | ||
kind: Experiment | ||
singular: experiment | ||
plural: experiments | ||
--- | ||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
name: trials.kubeflow.org | ||
spec: | ||
group: kubeflow.org | ||
version: v1alpha2 | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
names: | ||
kind: Trial | ||
singular: trial | ||
plural: trials |
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,32 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: katib-controller | ||
namespace: kubeflow | ||
labels: | ||
app: katib-controller | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: katib-controller | ||
template: | ||
metadata: | ||
labels: | ||
app: katib-controller | ||
spec: | ||
serviceAccountName: katib-controller | ||
containers: | ||
- name: katib-controller | ||
image: katib/katib-controller | ||
imagePullPolicy: Always | ||
command: ["./katib-controller.v1alpha2"] | ||
ports: | ||
- containerPort: 443 | ||
name: webhook | ||
protocol: TCP | ||
env: | ||
- name: KATIB_CORE_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace |
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,77 @@ | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: katib-controller | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
- serviceaccounts | ||
- services | ||
verbs: | ||
- "*" | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- pods | ||
- pods/log | ||
- pods/status | ||
verbs: | ||
- "*" | ||
- apiGroups: | ||
- batch | ||
resources: | ||
- jobs | ||
- cronjobs | ||
verbs: | ||
- "*" | ||
- apiGroups: | ||
- apiextensions.k8s.io | ||
resources: | ||
- customresourcedefinitions | ||
verbs: | ||
- create | ||
- get | ||
- apiGroups: | ||
- admissionregistration.k8s.io | ||
resources: | ||
- validatingwebhookconfigurations | ||
- mutatingwebhookconfigurations | ||
verbs: | ||
- '*' | ||
- apiGroups: | ||
- kubeflow.org | ||
resources: | ||
- experiments | ||
- experiments/status | ||
- trials | ||
- trials/status | ||
verbs: | ||
- "*" | ||
- apiGroups: | ||
- kubeflow.org | ||
resources: | ||
- tfjobs | ||
- pytorchjobs | ||
verbs: | ||
- "*" | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: katib-controller | ||
namespace: kubeflow | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: katib-controller | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: katib-controller | ||
subjects: | ||
- kind: ServiceAccount | ||
name: katib-controller | ||
namespace: kubeflow |
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,12 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: katib-controller | ||
namespace: kubeflow | ||
spec: | ||
ports: | ||
- port: 443 | ||
protocol: TCP | ||
targetPort: 443 | ||
selector: | ||
app: katib-controller |
20 changes: 20 additions & 0 deletions
20
manifests/v1alpha2/katib-controller/trialTemplateConfigmap.yaml
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,20 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: trial-template | ||
namespace: kubeflow | ||
data: | ||
defaultTrialTemplate.yaml : |- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{.Trial}} | ||
namespace: {{.NameSpace}} | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: {{.Trial}} | ||
image: alpine | ||
restartPolicy: Never | ||
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,28 @@ | ||
#!/bin/bash | ||
|
||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
PREFIX="katib" | ||
CMD_PREFIX="cmd" | ||
|
||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../.. | ||
|
||
cd ${SCRIPT_ROOT} | ||
|
||
docker build -t ${PREFIX}/katib-controller -f ${CMD_PREFIX}/katib-controller/Dockerfile . |
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,31 @@ | ||
#!/bin/bash | ||
|
||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
set -o xtrace | ||
|
||
SCRIPT_ROOT=$(dirname ${BASH_SOURCE})/../.. | ||
|
||
cd ${SCRIPT_ROOT} | ||
kubectl apply -f manifests/v1alpha2/0-namespace.yaml | ||
kubectl apply -f manifests/v1alpha2/katib-controller/crds.yaml | ||
kubectl apply -f manifests/v1alpha2/katib-controller/rbac.yaml | ||
kubectl apply -f manifests/v1alpha2/katib-controller/service.yaml | ||
kubectl apply -f manifests/v1alpha2/katib-controller/trialTemplateConfigmap.yaml | ||
kubectl apply -f manifests/v1alpha2/katib-controller/katib-controller.yaml | ||
cd - > /dev/null |
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,44 @@ | ||
#!/bin/bash | ||
|
||
# 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. | ||
|
||
# This shell script is used to build an image from our argo workflow | ||
|
||
exit 0 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
export PATH=${GOPATH}/bin:/usr/local/go/bin:${PATH} | ||
REGISTRY="${GCP_REGISTRY}" | ||
PROJECT="${GCP_PROJECT}" | ||
GO_DIR=${GOPATH}/src/github.com/${REPO_OWNER}/${REPO_NAME}-earlystopping-median | ||
VERSION=$(git describe --tags --always --dirty) | ||
|
||
echo "Activating service-account" | ||
gcloud auth activate-service-account --key-file=${GOOGLE_APPLICATION_CREDENTIALS} | ||
|
||
echo "Copy source to GOPATH" | ||
mkdir -p ${GO_DIR} | ||
cp -r cmd ${GO_DIR}/cmd | ||
cp -r pkg ${GO_DIR}/pkg | ||
cp -r vendor ${GO_DIR}/vendor | ||
|
||
cd ${GO_DIR} | ||
|
||
cp cmd/earlystopping/medianstopping/Dockerfile . | ||
gcloud builds submit . --tag=${REGISTRY}/${REPO_NAME}/earlystopping-medianstopping:${VERSION} --project=${PROJECT} | ||
gcloud container images add-tag --quiet ${REGISTRY}/${REPO_NAME}/earlystopping-medianstopping:${VERSION} ${REGISTRY}/${REPO_NAME}/earlystopping-medianstopping:latest --verbosity=info |
Oops, something went wrong.