From e5fda2459ee9cf3885973f0a3e9c4dd673d2de19 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 29 Sep 2022 19:30:51 +0300 Subject: [PATCH] Install minio on the managed clusters This change installs minio on the managed clusters. The yaml file was copied from the hack directory as is. It would be nice to add a self test ensuring that minio works, but we can do this later. Example usage: $ drenv start regional-dr.yaml 2022-09-29 19:35:11,775 INFO [env] Using regional-dr.yaml 2022-09-29 19:35:11,780 INFO [dr1] Starting cluster 2022-09-29 19:35:11,780 INFO [dr2] Starting cluster 2022-09-29 19:35:11,781 INFO [hub] Starting cluster 2022-09-29 19:35:52,351 INFO [dr2] Cluster started in 40.57 seconds 2022-09-29 19:35:52,351 INFO [dr2] Starting olm/start 2022-09-29 19:36:12,383 INFO [dr1] Cluster started in 60.60 seconds 2022-09-29 19:36:12,383 INFO [dr1] Starting olm/start 2022-09-29 19:36:22,934 INFO [dr2] olm/start completed in 30.58 seconds 2022-09-29 19:36:22,934 INFO [dr2] Starting rook/start 2022-09-29 19:36:32,733 INFO [hub] Cluster started in 80.95 seconds 2022-09-29 19:36:32,733 INFO [hub] Starting olm/start 2022-09-29 19:36:37,277 INFO [dr1] olm/start completed in 24.89 seconds 2022-09-29 19:36:37,277 INFO [dr1] Starting rook/start 2022-09-29 19:37:02,223 INFO [hub] olm/start completed in 29.49 seconds 2022-09-29 19:37:02,223 INFO [hub] Starting cluster-manager/start 2022-09-29 19:38:21,571 INFO [hub] cluster-manager/start completed in 79.35 seconds 2022-09-29 19:39:06,525 INFO [dr2] rook/start completed in 163.59 seconds 2022-09-29 19:39:06,525 INFO [dr2] Starting minio/start 2022-09-29 19:39:20,373 INFO [dr1] rook/start completed in 163.10 seconds 2022-09-29 19:39:20,373 INFO [dr1] Starting minio/start 2022-09-29 19:39:25,599 INFO [dr2] minio/start completed in 19.07 seconds 2022-09-29 19:39:34,447 INFO [dr1] minio/start completed in 14.07 seconds 2022-09-29 19:39:34,447 INFO [env] Starting klusterlet/start 2022-09-29 19:40:28,625 INFO [env] klusterlet/start completed in 54.18 seconds 2022-09-29 19:40:28,625 INFO [env] Starting klusterlet/test 2022-09-29 19:40:50,919 INFO [env] klusterlet/test completed in 22.29 seconds 2022-09-29 19:40:50,919 INFO [env] Started in 339.14 seconds Signed-off-by: Nir Soffer --- test/minio/minio.yaml | 135 ++++++++++++++++++++++++++++++++++++++++++ test/minio/start | 26 ++++++++ test/regional-dr.yaml | 2 + 3 files changed, 163 insertions(+) create mode 100644 test/minio/minio.yaml create mode 100755 test/minio/start diff --git a/test/minio/minio.yaml b/test/minio/minio.yaml new file mode 100644 index 0000000000..6ae7878b97 --- /dev/null +++ b/test/minio/minio.yaml @@ -0,0 +1,135 @@ +# Copyright 2017 the Velero contributors. +# SPDX-FileCopyrightText: The RamenDR authors +# +# SPDX-License-Identifier: Apache-2.0 + +--- +apiVersion: v1 +kind: Namespace +metadata: + name: minio +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: minio + name: minio-config-pvc + labels: + component: minio +spec: + accessModes: ["ReadWriteOnce"] + storageClassName: "rook-ceph-block" + resources: + requests: + storage: 10Gi +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + namespace: minio + name: minio-storage-pvc + labels: + component: minio +spec: + accessModes: ["ReadWriteOnce"] + storageClassName: "rook-ceph-block" + resources: + requests: + storage: 10Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + namespace: minio + name: minio + labels: + component: minio +spec: + strategy: + type: Recreate + selector: + matchLabels: + component: minio + template: + metadata: + labels: + component: minio + spec: + volumes: + - name: storage + persistentVolumeClaim: + claimName: minio-storage-pvc + readOnly: false + - name: config + persistentVolumeClaim: + claimName: minio-config-pvc + readOnly: false + containers: + - name: minio + image: minio/minio:latest + imagePullPolicy: IfNotPresent + args: + - server + - /storage + - --config-dir=/config + env: + - name: MINIO_ACCESS_KEY + value: "minio" + - name: MINIO_SECRET_KEY + value: "minio123" + ports: + - containerPort: 9000 + hostPort: 9000 + volumeMounts: + - name: storage + mountPath: "/storage" + - name: config + mountPath: "/config" +--- +apiVersion: v1 +kind: Service +metadata: + namespace: minio + name: minio + labels: + component: minio +spec: + type: NodePort + ports: + - port: 9000 + targetPort: 9000 + protocol: TCP + nodePort: 30000 + selector: + component: minio +--- +apiVersion: batch/v1 +kind: Job +metadata: + namespace: minio + name: minio-setup + labels: + component: minio +spec: + template: + metadata: + name: minio-setup + spec: + restartPolicy: OnFailure + volumes: + - name: config + persistentVolumeClaim: + claimName: minio-config-pvc + readOnly: false + containers: + - name: mc + image: minio/mc:latest + imagePullPolicy: IfNotPresent + command: + - /bin/sh + - -c + - "mc --config-dir=/config config host add ramen http://minio:9000 + minio minio123 && mc --config-dir=/config mb -p ramen/bucket" + volumeMounts: + - name: config + mountPath: "/config" diff --git a/test/minio/start b/test/minio/start new file mode 100755 index 0000000000..89296fa2c3 --- /dev/null +++ b/test/minio/start @@ -0,0 +1,26 @@ +#!/usr/bin/env -S python3 -u + +# SPDX-FileCopyrightText: The RamenDR authors +# +# SPDX-License-Identifier: Apache-2.0 + +import sys + +import drenv + +if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} cluster") + sys.exit(1) + +cluster = sys.argv[1] + +drenv.log_progress("Deploying minio") +drenv.kubectl("apply", "--filename", "minio/minio.yaml", profile=cluster) + +drenv.log_progress("Waiting until minio is rolled out") +drenv.kubectl( + "rollout", "status", "deployment/minio", + "--namespace", "minio", + "--timeout", "180s", + profile=cluster, +) diff --git a/test/regional-dr.yaml b/test/regional-dr.yaml index dcd33f5bec..c93f1b19cb 100644 --- a/test/regional-dr.yaml +++ b/test/regional-dr.yaml @@ -12,6 +12,7 @@ profiles: scripts: - file: olm/start - file: rook/start + - file: minio/start - name: "dr2" network: default extra_disks: 1 @@ -19,6 +20,7 @@ profiles: scripts: - file: olm/start - file: rook/start + - file: minio/start - name: "hub" network: default scripts: