Skip to content
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

Fix presubmits and update TFJob examples for v1beta2 and v1 #1002

Merged
merged 9 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 4 additions & 28 deletions developer_guide.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Developer Guide

There are two versions of the TF operator: one for v1alpha2 (to be deprecated) and one for v1beta1.
Tf-operator is currently at v1. The v1beta2 version will still be supported and is compatible with v1.

## Building the operator

Expand All @@ -24,13 +24,7 @@ dep ensure
Build it

```sh
go install github.com/kubeflow/tf-operator/cmd/tf-operator.v1beta1
```

If you want to build the operator for v1alpha2, please use the command here:

```sh
go install github.com/kubeflow/tf-operator/cmd/tf-operator.v2
go install github.com/kubeflow/tf-operator/cmd/tf-operator.v1
```

## Building all the artifacts.
Expand Down Expand Up @@ -89,15 +83,7 @@ export KUBEFLOW_NAMESPACE=$(your_namespace)
After the cluster is up, the TFJob CRD should be created on the cluster.

```bash
# If you are using v1beta1
kubectl create -f ./examples/crd/crd-v1beta1.yaml
```

Or

```bash
# If you are using v1alpha2
kubectl create -f ./examples/crd/crd-v1alpha2.yaml
kubectl create -f ./examples/crd/crd-v1.yaml
```

### Run Operator
Expand All @@ -111,17 +97,7 @@ tf-operator
To verify local operator is working, create an example job and you should see jobs created by it.

```sh
# If you are using v1beta1
cd ./examples/v1beta1/dist-mnist
docker build -f Dockerfile -t kubeflow/tf-dist-mnist-test:1.0 .
kubectl create -f ./tf_job_mnist.yaml
```

Or

```bash
# If you are using v1alpha2
cd ./examples/v1alpha2/dist-mnist
cd ./examples/v1/dist-mnist
docker build -f Dockerfile -t kubeflow/tf-dist-mnist-test:1.0 .
kubectl create -f ./tf_job_mnist.yaml
```
Expand Down
46 changes: 46 additions & 0 deletions examples/crd/crd-v1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: tfjobs.kubeflow.org
spec:
group: kubeflow.org
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have a single CRD serving two versions? (similar to install package?) WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

scope: Namespaced
names:
kind: TFJob
singular: tfjob
plural: tfjobs
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
spec:
properties:
tfReplicaSpecs:
properties:
# The validation works when the configuration contains
# `Worker`, `PS` or `Chief`. Otherwise it will not be validated.
Worker:
properties:
replicas:
type: integer
minimum: 1
PS:
properties:
replicas:
type: integer
minimum: 1
Chief:
properties:
replicas:
type: integer
minimum: 1
maximum: 1
version: v1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: we can remove this as we use versions.

versions:
- name: v1
served: true
storage: true
- name: v1beta2
served: true
storage: false
18 changes: 18 additions & 0 deletions examples/v1/dist-mnist/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# 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.

FROM tensorflow/tensorflow:1.5.0

ADD . /var/tf_dist_mnist
ENTRYPOINT ["python", "/var/tf_dist_mnist/dist_mnist.py"]
17 changes: 17 additions & 0 deletions examples/v1/dist-mnist/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Distributed mnist model for e2e test

This folder containers Dockerfile and distributed mnist model for e2e test.

**Build Image**

The default image name and tag is `kubeflow/tf-dist-mnist-test:1.0`.

```shell
docker build -f Dockerfile -t kubeflow/tf-dist-mnist-test:1.0 ./
```

**Create TFJob YAML**

```
kubectl create -f ./tf_job_mnist.yaml
```
Loading