Skip to content

Commit

Permalink
Fix presubmits and update TFJob examples for v1beta2 and v1 (#1002)
Browse files Browse the repository at this point in the history
* Update TFJob examples for v1beta2 and v1

* Change to multiple versioned CRD

* update test worker image

* Update gcloud command

* upgrade ksonnet

* Debug

* use latest kubeflow/testing

* Upgrade workflow app

* Upgrade workflow app
  • Loading branch information
richardsliu authored and k8s-ci-robot committed May 23, 2019
1 parent 63de5cb commit d5d783c
Show file tree
Hide file tree
Showing 89 changed files with 1,736 additions and 75,618 deletions.
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
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
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

0 comments on commit d5d783c

Please sign in to comment.