Skip to content

Commit

Permalink
feat(deploy): Add standalone deployment yaml (#1218)
Browse files Browse the repository at this point in the history
Signed-off-by: cegao <[email protected]>
  • Loading branch information
gaocegege authored Jan 18, 2021
1 parent 1a160f3 commit 5f002e4
Show file tree
Hide file tree
Showing 2 changed files with 207 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ run distributed or non-distributed TensorFlow jobs on Kubernetes.

Please refer to the [user guide](https://www.kubeflow.org/docs/guides/components/tftraining/) for more information.

## Deploy

```bash
kubectl apply -f ./deploy/v1/tf-operator.yaml
```

## Contributing

Please refer to the [developer_guide](developer_guide.md)
Expand Down
201 changes: 201 additions & 0 deletions deploy/v1/tf-operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# --------------------------------------------------
# - Single configuration deployment YAML for tf-operator
# - Include:
# CRD deployment
# Namespace deployment
# RBAC deployment
# tf-operator container deployment set
# --------------------------------------------------
---
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
versions:
- name: v1
served: true
storage: true
subresources:
status: {}
validation:
openAPIV3Schema:
properties:
spec:
properties:
tfReplicaSpecs:
properties:
# The validation works when the configuration contains
# `Worker`, `PS` , `Chief` or `Evaluator`. 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
Evaluator:
properties:
replicas:
type: integer
minimum: 0
maximum: 1
---
apiVersion: v1
kind: Namespace
metadata:
name: tf-operator
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tf-operator
rules:
- apiGroups:
- ""
resources:
- configmaps
- serviceaccounts
- services
- secrets
- events
- namespaces
- persistentvolumes
- persistentvolumeclaims
verbs:
- "*"
- apiGroups:
- ""
resources:
- pods
- pods/log
- pods/status
verbs:
- create
- get
- list
- watch
- delete
- update
- patch
# This is needed for the launcher Role.
- apiGroups:
- ""
resources:
- pods/exec
verbs:
- create
- apiGroups:
- ""
resources:
- endpoints
verbs:
- create
- get
- update
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- rbac.authorization.k8s.io
resources:
- roles
- rolebindings
verbs:
- create
- list
- watch
- apiGroups:
- policy
resources:
- poddisruptionbudgets
verbs:
- create
- list
- update
- watch
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- create
- get
- apiGroups:
- kubeflow.org
resources:
- tfjobs
- tfjobs/status
verbs:
- "*"
- apiGroups:
- scheduling.incubator.k8s.io
- scheduling.sigs.dev
- scheduling.volcano.sh
resources:
- queues
- podgroups
verbs:
- "*"
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: tf-operator
namespace: tf-operator
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: tf-operator
namespace: tf-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: tf-operator
subjects:
- kind: ServiceAccount
name: tf-operator
namespace: tf-operator
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: tf-operator
namespace: tf-operator
labels:
app: tf-operator
spec:
replicas: 1
selector:
matchLabels:
app: tf-operator
template:
metadata:
labels:
app: tf-operator
spec:
serviceAccountName: tf-operator
containers:
- name: tf-operator
image: ghcr.io/kubeflow-incubator/tf-operator:latest
imagePullPolicy: Always

0 comments on commit 5f002e4

Please sign in to comment.