|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Copyright 2022 IBM, Red Hat |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | + |
| 17 | +set -euo pipefail |
| 18 | +: "${KUBERAY_VERSION}" |
| 19 | + |
| 20 | +echo Deploying KubeRay "${KUBERAY_VERSION}" |
| 21 | +kubectl apply --server-side -k "github.com/ray-project/kuberay/ray-operator/config/default?ref=${KUBERAY_VERSION}&timeout=90s" |
| 22 | + |
| 23 | +kubectl create ns codeflare-system --dry-run=client -o yaml | kubectl apply -f - |
| 24 | + |
| 25 | +echo Deploying MCAD controller |
| 26 | +cat <<EOF | kubectl apply -n codeflare-system -f - |
| 27 | +apiVersion: codeflare.codeflare.dev/v1alpha1 |
| 28 | +kind: MCAD |
| 29 | +metadata: |
| 30 | + name: mcad |
| 31 | +spec: |
| 32 | + controllerResources: {} |
| 33 | +EOF |
| 34 | + |
| 35 | +cat <<EOF | kubectl apply -n codeflare-system -f - |
| 36 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 37 | +kind: ClusterRole |
| 38 | +metadata: |
| 39 | + name: mcad-controller-rayclusters |
| 40 | +rules: |
| 41 | + - apiGroups: |
| 42 | + - ray.io |
| 43 | + resources: |
| 44 | + - rayclusters |
| 45 | + - rayclusters/finalizers |
| 46 | + - rayclusters/status |
| 47 | + verbs: |
| 48 | + - get |
| 49 | + - list |
| 50 | + - watch |
| 51 | + - create |
| 52 | + - update |
| 53 | + - patch |
| 54 | + - delete |
| 55 | +EOF |
| 56 | + |
| 57 | +cat <<EOF | kubectl apply -n codeflare-system -f - |
| 58 | +kind: ClusterRoleBinding |
| 59 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 60 | +metadata: |
| 61 | + name: mcad-controller-rayclusters |
| 62 | +subjects: |
| 63 | + - kind: ServiceAccount |
| 64 | + name: mcad-controller-mcad |
| 65 | + namespace: codeflare-system |
| 66 | +roleRef: |
| 67 | + apiGroup: rbac.authorization.k8s.io |
| 68 | + kind: ClusterRole |
| 69 | + name: mcad-controller-rayclusters |
| 70 | +EOF |
| 71 | + |
| 72 | +echo "Waiting for the MCAD deployment to become ready..." |
| 73 | +kubectl wait --timeout=120s --for=condition=Available=true deployment -n codeflare-system mcad-controller-mcad |
0 commit comments