diff --git a/docs/submarine-server/setup-kubernetes.md b/docs/submarine-server/setup-kubernetes.md index 9da3bdab49..3eb8ed2d44 100644 --- a/docs/submarine-server/setup-kubernetes.md +++ b/docs/submarine-server/setup-kubernetes.md @@ -98,6 +98,39 @@ cd /dev-support/k8s/pytorchjob ``` + +### Use Helm Chart to deploy + +#### Create images +submarine server +```bash +./dev-support/docker-images/submarine/build.sh +``` + +submarine database +```bash +./dev-support/docker-images/database/build.sh +``` + +#### install helm +For more info see https://helm.sh/docs/intro/install/ + +#### Deploy submarine server, mysql +You can modify some settings in ./helm-charts/submarine/values.yaml +```bash +helm install submarine ./helm-charts/submarine +``` + +#### Delete deployment +```bash +helm delete submarine +``` + +#### port-forward {host port}:{container port} +```bash +kubectl port-forward svc/submarine-server 8080:8080 --address 0.0.0.0 +``` + ## Production environment ### Setup Kubernetes diff --git a/helm-charts/submarine/.helmignore b/helm-charts/submarine/.helmignore new file mode 100644 index 0000000000..b92c4a41bd --- /dev/null +++ b/helm-charts/submarine/.helmignore @@ -0,0 +1,42 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ +# ignore dolder +ignore/* + diff --git a/helm-charts/submarine/Chart.yaml b/helm-charts/submarine/Chart.yaml new file mode 100644 index 0000000000..46e4730785 --- /dev/null +++ b/helm-charts/submarine/Chart.yaml @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v2 +appVersion: "0.4.0-SNAPSHOT" +description: Submarine is Cloud Native Machine Learning Platform. +name: submarine +version: 0.4.0 +icon: https://submarine.apache.org/assets/themes/submarine/img/submarine_white_logo.png + diff --git a/helm-charts/submarine/charts/pytorchjob/.helmignore b/helm-charts/submarine/charts/pytorchjob/.helmignore new file mode 100644 index 0000000000..cab781adbf --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/.helmignore @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/submarine/charts/pytorchjob/Chart.yaml b/helm-charts/submarine/charts/pytorchjob/Chart.yaml new file mode 100644 index 0000000000..2c4b80bde9 --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/Chart.yaml @@ -0,0 +1,38 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v2 +name: pytorchjob +description: pytorchjob + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: 1.0.0 diff --git a/helm-charts/submarine/charts/pytorchjob/crds/crd.yaml b/helm-charts/submarine/charts/pytorchjob/crds/crd.yaml new file mode 100644 index 0000000000..5804ccd1b2 --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/crds/crd.yaml @@ -0,0 +1,59 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: pytorchjobs.kubeflow.org +spec: + additionalPrinterColumns: + - JSONPath: .status.conditions[-1:].type + name: State + type: string + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: kubeflow.org + names: + kind: PyTorchJob + plural: pytorchjobs + singular: pytorchjob + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + pytorchReplicaSpecs: + properties: + Master: + properties: + replicas: + maximum: 1 + minimum: 1 + type: integer + Worker: + properties: + replicas: + minimum: 1 + type: integer + versions: + - name: v1 + served: true + storage: true diff --git a/helm-charts/submarine/charts/pytorchjob/templates/deployment.yaml b/helm-charts/submarine/charts/pytorchjob/templates/deployment.yaml new file mode 100644 index 0000000000..a63632d174 --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/templates/deployment.yaml @@ -0,0 +1,49 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: pytorch-operator +spec: + replicas: 1 + selector: + matchLabels: + name: pytorch-operator + template: + metadata: + labels: + name: pytorch-operator + spec: + containers: + - command: + - /pytorch-operator.v1 + - --alsologtostderr + - -v=1 + - --monitoring-port=8443 + 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:v1.0.0-g047cf0f + name: pytorch-operator + serviceAccountName: pytorch-operator diff --git a/helm-charts/submarine/charts/pytorchjob/templates/podgroup.yaml b/helm-charts/submarine/charts/pytorchjob/templates/podgroup.yaml new file mode 100644 index 0000000000..109d9a3328 --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/templates/podgroup.yaml @@ -0,0 +1,56 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: podgroups.scheduling.incubator.k8s.io +spec: + group: scheduling.incubator.k8s.io + names: + kind: PodGroup + plural: podgroups + scope: Namespaced + validation: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + minMember: + format: int32 + type: integer + type: object + status: + properties: + succeeded: + format: int32 + type: integer + failed: + format: int32 + type: integer + running: + format: int32 + type: integer + type: object + type: object + version: v1alpha1 diff --git a/helm-charts/submarine/charts/pytorchjob/templates/rbac.yaml b/helm-charts/submarine/charts/pytorchjob/templates/rbac.yaml new file mode 100644 index 0000000000..09170407ad --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/templates/rbac.yaml @@ -0,0 +1,69 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: pytorch-operator + name: pytorch-operator +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + labels: + app: pytorch-operator + name: pytorch-operator +rules: +- apiGroups: + - kubeflow.org + resources: + - pytorchjobs + - pytorchjobs/status + verbs: + - '*' +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - '*' +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - events + verbs: + - '*' +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + labels: + app: pytorch-operator + name: pytorch-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: pytorch-operator +subjects: +- kind: ServiceAccount + name: pytorch-operator + namespace: {{ .Release.Namespace }} +--- diff --git a/helm-charts/submarine/charts/pytorchjob/templates/service.yaml b/helm-charts/submarine/charts/pytorchjob/templates/service.yaml new file mode 100644 index 0000000000..c0580f0eeb --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/templates/service.yaml @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/path: /metrics + prometheus.io/port: "8443" + prometheus.io/scrape: "true" + labels: + app: pytorch-operator + name: pytorch-operator +spec: + ports: + - name: monitoring-port + port: 8443 + targetPort: 8443 + selector: + name: pytorch-operator + type: ClusterIP diff --git a/helm-charts/submarine/charts/pytorchjob/values.yaml b/helm-charts/submarine/charts/pytorchjob/values.yaml new file mode 100644 index 0000000000..555eccfe85 --- /dev/null +++ b/helm-charts/submarine/charts/pytorchjob/values.yaml @@ -0,0 +1,17 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + diff --git a/helm-charts/submarine/charts/tfjob/.helmignore b/helm-charts/submarine/charts/tfjob/.helmignore new file mode 100644 index 0000000000..cab781adbf --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/.helmignore @@ -0,0 +1,40 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/helm-charts/submarine/charts/tfjob/Chart.yaml b/helm-charts/submarine/charts/tfjob/Chart.yaml new file mode 100644 index 0000000000..adffae8e15 --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/Chart.yaml @@ -0,0 +1,38 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v2 +name: tfjob +description: tfjob + +# A chart can be either an 'application' or a 'library' chart. +# +# Application charts are a collection of templates that can be packaged into versioned archives +# to be deployed. +# +# Library charts provide useful utilities or functions for the chart developer. They're included as +# a dependency of application charts to inject those utilities and functions into the rendering +# pipeline. Library charts do not define any templates and therefore cannot be deployed. +type: application + +# This is the chart version. This version number should be incremented each time you make changes +# to the chart and its templates, including the app version. +version: 0.1.0 + +# This is the version number of the application being deployed. This version number should be +# incremented each time you make changes to the application. +appVersion: 1.0.0 diff --git a/helm-charts/submarine/charts/tfjob/crds/crd.yaml b/helm-charts/submarine/charts/tfjob/crds/crd.yaml new file mode 100644 index 0000000000..1064757b28 --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/crds/crd.yaml @@ -0,0 +1,64 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: tfjobs.kubeflow.org +spec: + additionalPrinterColumns: + - JSONPath: .status.conditions[-1:].type + name: State + type: string + - JSONPath: .metadata.creationTimestamp + name: Age + type: date + group: kubeflow.org + names: + kind: TFJob + plural: tfjobs + singular: tfjob + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + spec: + properties: + tfReplicaSpecs: + properties: + Chief: + properties: + replicas: + maximum: 1 + minimum: 1 + type: integer + PS: + properties: + replicas: + minimum: 1 + type: integer + Worker: + properties: + replicas: + minimum: 1 + type: integer + versions: + - name: v1 + served: true + storage: true diff --git a/helm-charts/submarine/charts/tfjob/templates/cluster-role-binding.yaml b/helm-charts/submarine/charts/tfjob/templates/cluster-role-binding.yaml new file mode 100644 index 0000000000..3f148398fa --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/templates/cluster-role-binding.yaml @@ -0,0 +1,31 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + labels: + app: tf-job-operator + name: tf-job-operator +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: tf-job-operator +subjects: +- kind: ServiceAccount + name: tf-job-operator + namespace: {{ .Release.Namespace }} diff --git a/helm-charts/submarine/charts/tfjob/templates/cluster-role.yaml b/helm-charts/submarine/charts/tfjob/templates/cluster-role.yaml new file mode 100644 index 0000000000..2620ca9d7a --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/templates/cluster-role.yaml @@ -0,0 +1,111 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +--- +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + labels: + app: tf-job-operator + name: tf-job-operator +rules: +- apiGroups: + - kubeflow.org + resources: + - tfjobs + - tfjobs/status + verbs: + - '*' +- apiGroups: + - apiextensions.k8s.io + resources: + - customresourcedefinitions + verbs: + - '*' +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - events + verbs: + - '*' +- apiGroups: + - apps + - extensions + resources: + - deployments + verbs: + - '*' + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kubeflow-tfjobs-admin + labels: + rbac.authorization.kubeflow.org/aggregate-to-kubeflow-admin: "true" +aggregationRule: + clusterRoleSelectors: + - matchLabels: + rbac.authorization.kubeflow.org/aggregate-to-kubeflow-tfjobs-admin: "true" +rules: [] + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kubeflow-tfjobs-edit + labels: + rbac.authorization.kubeflow.org/aggregate-to-kubeflow-edit: "true" + rbac.authorization.kubeflow.org/aggregate-to-kubeflow-tfjobs-admin: "true" +rules: +- apiGroups: + - kubeflow.org + resources: + - tfjobs + - tfjobs/status + verbs: + - get + - list + - watch + - create + - delete + - deletecollection + - patch + - update + +--- + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: kubeflow-tfjobs-view + labels: + rbac.authorization.kubeflow.org/aggregate-to-kubeflow-view: "true" +rules: +- apiGroups: + - kubeflow.org + resources: + - tfjobs + - tfjobs/status + verbs: + - get + - list + - watch diff --git a/helm-charts/submarine/charts/tfjob/templates/deployment.yaml b/helm-charts/submarine/charts/tfjob/templates/deployment.yaml new file mode 100644 index 0000000000..b9e26eb7be --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/templates/deployment.yaml @@ -0,0 +1,54 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tf-job-operator + labels: + app: tf-job-operator + name: tf-job-operator +spec: + replicas: 1 + selector: + matchLabels: + app: tf-job-operator + name: tf-job-operator + template: + metadata: + labels: + app: tf-job-operator + name: tf-job-operator + spec: + containers: + - command: + - /opt/kubeflow/tf-operator.v1 + - --alsologtostderr + - -v=1 + - --monitoring-port=8443 + 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/tf_operator:kubeflow-tf-operator-postsubmit-v1-5adee6f-6109-a25c + name: tf-job-operator + serviceAccountName: tf-job-operator diff --git a/helm-charts/submarine/charts/tfjob/templates/service-account.yaml b/helm-charts/submarine/charts/tfjob/templates/service-account.yaml new file mode 100644 index 0000000000..217e05b958 --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/templates/service-account.yaml @@ -0,0 +1,30 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: tf-job-dashboard + name: tf-job-dashboard +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + app: tf-job-operator + name: tf-job-operator diff --git a/helm-charts/submarine/charts/tfjob/templates/service.yaml b/helm-charts/submarine/charts/tfjob/templates/service.yaml new file mode 100644 index 0000000000..e84ad6d2ab --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/templates/service.yaml @@ -0,0 +1,35 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# +--- +apiVersion: v1 +kind: Service +metadata: + annotations: + prometheus.io/path: /metrics + prometheus.io/scrape: "true" + prometheus.io/port: "8443" + labels: + app: tf-job-operator + name: tf-job-operator +spec: + ports: + - name: monitoring-port + port: 8443 + targetPort: 8443 + selector: + name: tf-job-operator + type: ClusterIP diff --git a/helm-charts/submarine/charts/tfjob/values.yaml b/helm-charts/submarine/charts/tfjob/values.yaml new file mode 100644 index 0000000000..cce3acad34 --- /dev/null +++ b/helm-charts/submarine/charts/tfjob/values.yaml @@ -0,0 +1,16 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# diff --git a/helm-charts/submarine/templates/rbac.yaml b/helm-charts/submarine/templates/rbac.yaml new file mode 100644 index 0000000000..fe0f5a545b --- /dev/null +++ b/helm-charts/submarine/templates/rbac.yaml @@ -0,0 +1,52 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: "{{ .Values.submarine.server.name }}" +rules: +- apiGroups: + - kubeflow.org + resources: + - tfjobs + - tfjobs/status + - pytorchjobs + - pytorchjobs/status + verbs: + - get + - list + - watch + - create + - delete + - deletecollection + - patch + - update + +--- +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: "{{ .Values.submarine.server.name }}" +subjects: +- kind: ServiceAccount + namespace: {{ .Release.Namespace }} + name: "{{ .Values.submarine.server.name }}" +roleRef: + kind: ClusterRole + name: "{{ .Values.submarine.server.name }}" + apiGroup: "" diff --git a/helm-charts/submarine/templates/submarine-database.yaml b/helm-charts/submarine/templates/submarine-database.yaml new file mode 100644 index 0000000000..b7b5d27cae --- /dev/null +++ b/helm-charts/submarine/templates/submarine-database.yaml @@ -0,0 +1,53 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: apps/v1beta1 +kind: Deployment +metadata: + name: "{{ .Values.submarine.database.name }}" +spec: + replicas: {{ .Values.submarine.database.replicas }} + selector: + matchLabels: + app: "{{ .Values.submarine.database.name }}" + template: + metadata: + labels: + app: "{{ .Values.submarine.database.name }}" + spec: + containers: + - name: "{{ .Values.submarine.database.name }}" + image: "{{ .Values.submarine.database.image }}" + imagePullPolicy: {{ .Values.submarine.database.imagePullPolicy }} + ports: + - containerPort: 3306 + env: + - name: MYSQL_ROOT_PASSWORD + value: "{{ .Values.submarine.database.mysqlRootPassword }}" + +--- +apiVersion: v1 +kind: Service +metadata: + name: "{{ .Values.submarine.database.name }}" +spec: + ports: + - name: "{{ .Values.submarine.database.name }}" + port: 3306 + targetPort: {{ .Values.submarine.database.servicePort }} + selector: + app: "{{ .Values.submarine.database.name }}" diff --git a/helm-charts/submarine/templates/submarine-server.yaml b/helm-charts/submarine/templates/submarine-server.yaml new file mode 100644 index 0000000000..2b22e3a1f3 --- /dev/null +++ b/helm-charts/submarine/templates/submarine-server.yaml @@ -0,0 +1,69 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +apiVersion: v1 +kind: Service +metadata: + name: "{{ .Values.submarine.server.name }}" + labels: + run: "{{ .Values.submarine.server.name }}" +spec: + ports: + - port: 8080 + targetPort: {{ .Values.submarine.server.servicePort }} + protocol: TCP + selector: + run: "{{ .Values.submarine.server.name }}" + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: "{{ .Values.submarine.server.name }}" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: "{{ .Values.submarine.server.name }}" +spec: + selector: + matchLabels: + run: "{{ .Values.submarine.server.name }}" + replicas: {{ .Values.submarine.server.replicas }} + template: + metadata: + labels: + run: "{{ .Values.submarine.server.name }}" + spec: + serviceAccountName: "{{ .Values.submarine.server.name }}" + containers: + - name: "{{ .Values.submarine.server.name }}" + env: + - name: SUBMARINE_SERVER_PORT + value: "8080" + - name: SUBMARINE_SERVER_PORT_8080_TCP + value: "8080" + - name: K8S_APISERVER_URL + value: "kubernetes.default.svc" + + image: "{{ .Values.submarine.server.image }}" + imagePullPolicy: {{ .Values.submarine.server.imagePullPolicy }} + command: ["/bin/bash", "-c"] + args: ["/opt/submarine-current/bin/submarine.sh start getMysqlJar"] + ports: + - containerPort: 8080 + diff --git a/helm-charts/submarine/values.yaml b/helm-charts/submarine/values.yaml new file mode 100644 index 0000000000..edb2202be5 --- /dev/null +++ b/helm-charts/submarine/values.yaml @@ -0,0 +1,32 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. +# + +submarine: + server: + imagePullPolicy: IfNotPresent + replicas: 1 + name: submarine-server + image: apache/submarine:server-0.4.0-SNAPSHOT + servicePort: 8080 + database: + imagePullPolicy: IfNotPresent + replicas: 1 + name: submarine-database + image: apache/submarine:database-0.4.0-SNAPSHOT + servicePort: 3306 + mysqlRootPassword: password +