Skip to content

Commit

Permalink
Install minio on the managed clusters
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
nirs committed Sep 29, 2022
1 parent 7d7bbd3 commit e5fda24
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 0 deletions.
135 changes: 135 additions & 0 deletions test/minio/minio.yaml
Original file line number Diff line number Diff line change
@@ -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"
26 changes: 26 additions & 0 deletions test/minio/start
Original file line number Diff line number Diff line change
@@ -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,
)
2 changes: 2 additions & 0 deletions test/regional-dr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ profiles:
scripts:
- file: olm/start
- file: rook/start
- file: minio/start
- name: "dr2"
network: default
extra_disks: 1
disk_size: "50g"
scripts:
- file: olm/start
- file: rook/start
- file: minio/start
- name: "hub"
network: default
scripts:
Expand Down

0 comments on commit e5fda24

Please sign in to comment.