diff --git a/manifests/crd.yaml b/manifests/crd.yaml new file mode 100644 index 000000000..1bccb20c4 --- /dev/null +++ b/manifests/crd.yaml @@ -0,0 +1,30 @@ +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: pytorchjobs.kubeflow.org +spec: + group: kubeflow.org + names: + kind: PyTorchJob + plural: pytorchjobs + singular: pytorchjob + scope: Namespaced + validation: + openAPIV3Schema: + properties: + spec: + properties: + pytorchReplicaSpecs: + properties: + Master: + properties: + replicas: + maximum: 1 + minimum: 1 + type: integer + Worker: + properties: + replicas: + minimum: 1 + type: integer + version: v1beta1 diff --git a/manifests/deployment.yaml b/manifests/deployment.yaml new file mode 100644 index 000000000..850012ba8 --- /dev/null +++ b/manifests/deployment.yaml @@ -0,0 +1,29 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: pytorch-operator + namespace: kubeflow +spec: + replicas: 1 + template: + metadata: + labels: + name: pytorch-operator + spec: + containers: + - command: + - /pytorch-operator.v1beta1 + - --alsologtostderr + - -v=1 + env: + - name: MY_POD_NAMESPACE + valueFrom: + fieldRef: + fieldPath: metadata.namespace + - name: MY_POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + image: gcr.io/kubeflow-images-public/pytorch-operator:v0.4.0 + name: pytorch-operator + serviceAccountName: pytorch-operator diff --git a/manifests/namespace.yaml b/manifests/namespace.yaml new file mode 100644 index 000000000..7a940e467 --- /dev/null +++ b/manifests/namespace.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +kind: Namespace +metadata: + name: kubeflow diff --git a/pytorch-operator-chart/templates/rbac.yaml b/manifests/rbac.yaml similarity index 68% rename from pytorch-operator-chart/templates/rbac.yaml rename to manifests/rbac.yaml index 89fbe9c55..18cc9faab 100644 --- a/pytorch-operator-chart/templates/rbac.yaml +++ b/manifests/rbac.yaml @@ -1,35 +1,42 @@ -{{ if .Values.rbac.install }} -apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }} -kind: ClusterRole +apiVersion: v1 +kind: ServiceAccount metadata: + labels: + app: pytorch-operator name: pytorch-operator + namespace: kubeflow +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: labels: app: pytorch-operator + name: pytorch-operator rules: - apiGroups: - kubeflow.org resources: - pytorchjobs verbs: - - "*" + - '*' - apiGroups: - apiextensions.k8s.io resources: - customresourcedefinitions verbs: - - "*" + - '*' - apiGroups: - storage.k8s.io resources: - storageclasses verbs: - - "*" + - '*' - apiGroups: - batch resources: - jobs verbs: - - "*" + - '*' - apiGroups: - "" resources: @@ -40,27 +47,27 @@ rules: - persistentvolumeclaims - events verbs: - - "*" + - '*' - apiGroups: - apps - extensions resources: - deployments verbs: - - "*" + - '*' --- +apiVersion: rbac.authorization.k8s.io/v1beta1 kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/{{ required "A valid .Values.rbac.apiVersion entry required!" .Values.rbac.apiVersion }} metadata: - name: pytorch-operator labels: app: pytorch-operator -subjects: -- kind: ServiceAccount name: pytorch-operator - namespace: {{ .Release.Namespace }} roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole name: pytorch-operator -{{ end }} +subjects: +- kind: ServiceAccount + name: pytorch-operator + namespace: kubeflow +--- diff --git a/pytorch-operator-chart/Chart.yaml b/pytorch-operator-chart/Chart.yaml deleted file mode 100644 index da5e4f49b..000000000 --- a/pytorch-operator-chart/Chart.yaml +++ /dev/null @@ -1,6 +0,0 @@ -appVersion: 0.1.0 -description: K8s Custom Resource and Operator For PyTorch Jobs -home: https://github.com/kubeflow/pytorch-operator -name: pytorch-operator -sources: ['https://github.com/kubeflow/pytorch-operator'] -version: 0.1.0 \ No newline at end of file diff --git a/pytorch-operator-chart/templates/crd.yaml b/pytorch-operator-chart/templates/crd.yaml deleted file mode 100644 index 79784289c..000000000 --- a/pytorch-operator-chart/templates/crd.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: pytorchjobs.kubeflow.org -spec: - group: kubeflow.org - version: v1alpha1 - names: - kind: PyTorchJob - singular: pytorchjob - plural: pytorchjobs diff --git a/pytorch-operator-chart/templates/deployment.yaml b/pytorch-operator-chart/templates/deployment.yaml deleted file mode 100644 index 419f3ff14..000000000 --- a/pytorch-operator-chart/templates/deployment.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: pytorch-operator -spec: - replicas: 1 - template: - metadata: - labels: - name: pytorch-operator - spec: -{{- if .Values.rbac.install }} - serviceAccountName: pytorch-operator -{{- end }} - containers: - - name: pytorch-operator - image: "{{ .Values.image }}" - command: - - /pytorch-operator - {{- if .Values.config.configmap }} - - --controller-config-file={{ .Values.config.file }} - {{- else if .Values.cloud }} - - --controller-config-file=/etc/config/controller-config-file.yaml - {{- end }} - - -alsologtostderr - - -v=1 - {{- if .Values.config.configmap }} - env: - - name: KUBEFLOW_NAMESPACE - value: {{ .Release.namespace }} - volumeMounts: - - name: config-volume - mountPath: /etc/config - volumes: - - name: config-volume - configMap: - name: {{ .Values.config.configmap }} - {{- else if .Values.cloud }} - volumeMounts: - - name: config-volume - mountPath: /etc/config - volumes: - - name: config-volume - configMap: - name: pytorch-operator-config - {{- end }} diff --git a/pytorch-operator-chart/templates/service-account.yaml b/pytorch-operator-chart/templates/service-account.yaml deleted file mode 100644 index af97f6a38..000000000 --- a/pytorch-operator-chart/templates/service-account.yaml +++ /dev/null @@ -1,8 +0,0 @@ -{{ if .Values.rbac.install }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: pytorch-operator - labels: - app: pytorch-operator -{{ end }} \ No newline at end of file diff --git a/pytorch-operator-chart/values.yaml b/pytorch-operator-chart/values.yaml deleted file mode 100644 index 750e73f9c..000000000 --- a/pytorch-operator-chart/values.yaml +++ /dev/null @@ -1,21 +0,0 @@ -# Docker image to use. -image: jgaguirr/pytorch-operator:latest - -# Which cloud provider is kubernetes hosted on. -# Supported values are gke or azure. -# Leave blank to use a default, non-cloud specific config. -cloud: - -## Wether the dashboard should be installed and the kind of service to use -dashboard: - install: false - serviceType: ClusterIP - -config: - configmap: - file: /etc/config/controller-config-file.yaml - -## Install Default RBAC roles and bindings -rbac: - install: false - apiVersion: v1beta1 \ No newline at end of file