-
Notifications
You must be signed in to change notification settings - Fork 0
issue operator 1116
Allan Roger Reid edited this page Dec 4, 2024
·
9 revisions
ssh -p 20055 ubuntu@1.2.3.4 -o "ServerAliveInterval=5" -o "ServerAliveCountMax=100000" -o "StrictHostKeyChecking=off"
loginctl enable-linger ubuntu
git clone https://github.com/allanrogerr/operator.git
cd operator && git checkout add-plugin-tenant-fields
cd ~
sudo touch /dev/kmsg
curl -sfL https://get.k3s.io | K3S_KUBECONFIG_MODE="644" sh -s - --snapshotter=fuse-overlayfs
export KUBECONFIG=/etc/rancher/k3s/k3s.yaml
k3s --version
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install vim -y
sudo apt-get install zip -y
sudo apt-get install make -y
sudo apt install build-essential -y
cd ~
wget https://go.dev/dl/go1.21.3.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.21.3.linux-amd64.tar.gz
cat <<EOF >> $HOME/.profile
export PATH=$PATH:/usr/local/go/bin:~/go/bin
EOF
cat $HOME/.profile
source $HOME/.profile
go version
sudo apt-get install nodejs -y
sudo apt-get install npm -y
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
source ~/.bashrc
nvm install && nvm use && npm install -g yarn
Install podman. Push newly compile operator to docker (optional - only to ensure nothing else is broken in operator)
sudo apt-get install podman -y
sudo apt-get install podman-docker -y
TAG=minio/operator:noop
mkdir ~/operator/minio-operator
cd ~/operator && make assets && make binary && docker build -t $TAG .
podman save minio/operator:noop | sudo k3s ctr images import -
sudo k3s ctr images ls | grep minio/operator:noop
cd ~/operator/kubectl-minio
CGO_ENABLED=1 go build --ldflags "-s -w" -trimpath -o ../kubectl-minio
Test 0
kubectl delete ns tenant-ns0
kubectl create ns tenant-ns0
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns0 --servers 1 --volumes 1 --capacity 1Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns0', Total capacity 1.0 GiB
Current status: Initialized
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 1 1 1 1.0 GiB 1.0 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns0
Test 1
kubectl delete ns tenant-ns1
kubectl create ns tenant-ns1
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns1 --servers 4 --volumes 8 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns1', Total capacity 16 GiB
Current status: Initialized
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 2 8 2.0 GiB 16 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns1
Test 2
kubectl delete ns tenant-ns2
kubectl create ns tenant-ns2
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns2 --servers 4 --volumes 4 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns2', Total capacity 16 GiB
Current status: Initialized
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 1 4 4.0 GiB 16 GiB
Console screenshot
Cleanup
kubectl delete ns tenant-ns2
Test 3
kubectl delete ns tenant-ns3
kubectl create ns tenant-ns3
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns3 --servers 4 --volumes-per-server 8 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns3', Total capacity 16 GiB
Current status:
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 8 32 512 MiB 16 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns3
Test 4
kubectl delete ns tenant-ns4
kubectl create ns tenant-ns4
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns4 --servers 4 --volumes-per-server 2 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns4', Total capacity 16 GiB
Current status:
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 2 8 2.0 GiB 16 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns4
kubectl delete ns tenant-ns-fail
kubectl create ns tenant-ns-fail
Test 5
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 1 --volumes 1 --capacity --enable-host-sharing
Output
Error: --capacity flag is incorrectly formatted. Use a suffix like 'T' or 'Ti' only
Test 6
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 4 --volumes 8 --capacity -1Gi --enable-host-sharing
Output
Error: --capacity needs to be greater than zero
Test 7
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 4 --volumes 8 --capacity 1 --enable-host-sharing
Output
W1214 05:09:51.848972 170592 tenant-create.go:72] capacity per volume needs to be greater than zero
Error: capacity per volume needs to be greater than zero
Test 8
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 4 --volumes 8 --volumes-per-server 2 --capacity 16Gi --enable-host-sharing
Output
Error: only either --volumes or --volumes-per-server may be specified
Test 9
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 4 --volumes 9 --capacity 16Gi --enable-host-sharing
Output
Error: --volumes should be a multiple of --servers
Test 10
kubectl delete ns tenant-ns0
kubectl create ns tenant-ns0
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns0 --servers 1 --volumes 1 --capacity 1Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --pool ss-1 --servers 1 --volumes 1 --capacity 1Gi --namespace tenant-ns0 --enable-host-sharing
Output
Expanding Tenant 'myminio/tenant-ns0' from 1.0 GiB to 2.0 GiB
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns0', Total capacity 2.0 GiB
Current status: Provisioning MinIO Statefulset
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 1 1 1 1.0 GiB 1.0 GiB
1 1 1 1 1.0 GiB 1.0 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns0
Test 11
kubectl delete ns tenant-ns1
kubectl create ns tenant-ns1
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns1 --servers 4 --volumes 8 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --pool ss-1 --servers 4 --volumes 8 --capacity 16Gi --namespace tenant-ns1 --enable-host-sharing
Output
Expanding Tenant 'myminio/tenant-ns1' from 16 GiB to 32 GiB
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns2', Total capacity 36 GiB
Current status: Provisioning initial users
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 1 4 4.0 GiB 16 GiB
1 4 1 4 5.0 GiB 20 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns1
Test 12
kubectl delete ns tenant-ns2
kubectl create ns tenant-ns2
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns2 --servers 4 --volumes 4 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --pool ss-1 --servers 1 --volumes-per-server 1 --capacity 20Gi --namespace tenant-ns2 --enable-host-sharing
Output
Expanding Tenant 'myminio/tenant-ns2' from 16 GiB to 36 GiB
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns2', Total capacity 36 GiB
Current status: Provisioning MinIO Headless Service
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 1 4 4.0 GiB 16 GiB
1 1 1 1 20 GiB 20 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns2
Test 13
kubectl delete ns tenant-ns3
kubectl create ns tenant-ns3
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns3 --servers 4 --volumes-per-server 2 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --pool ss-1 --servers 2 --volumes-per-server 4 --capacity 2Gi --namespace tenant-ns3 --enable-host-sharing
Output
Expanding Tenant 'myminio/tenant-ns3' from 16 GiB to 18 GiB
~/operator/kubectl-minio/kubectl-minio tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns3', Total capacity 18 GiB
Current status: Waiting for MinIO TLS Certificate
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 443)
Console service: myminio-console/ClusterIP (port 9443)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 2 8 2.0 GiB 16 GiB
1 2 4 8 256 MiB 2.0 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns3
Test 14
kubectl delete ns tenant-ns-fail
kubectl create ns tenant-ns-fail
~/operator/kubectl-minio/kubectl-minio tenant create myminio --namespace tenant-ns-fail --servers 4 --volumes-per-server 2 --capacity 16Gi --enable-host-sharing
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --namespace tenant-ns-fail --pool ss-1 --servers 1 --volumes 1 --capacity --enable-host-sharing
Output
Error: --capacity flag is incorrectly formatted. Use a suffix like 'T' or 'Ti' only
Test 16
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --namespace tenant-ns-fail --pool ss-1 --servers 4 --volumes 8 --capacity -1Gi --enable-host-sharing
Output
Error: --capacity needs to be greater than zero
Test 17
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --namespace tenant-ns-fail --pool ss-1 --servers 4 --volumes 8 --capacity 1 --enable-host-sharing
Output
Error: capacity per volume needs to be greater than zero
Test 18
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --namespace tenant-ns-fail --pool ss-1 --servers 4 --volumes 8 --volumes-per-server 2 --capacity 16Gi --enable-host-sharing
Output
Error: only either --volumes or --volumes-per-server may be specified
Test 19
~/operator/kubectl-minio/kubectl-minio tenant expand myminio --namespace tenant-ns-fail --pool ss-1 --servers 4 --volumes 9 --capacity 16Gi --enable-host-sharing
Output
Error: --volumes should be a multiple of --servers
Test 20
kubectl delete ns tenant-ns0
kubectl create ns tenant-ns0
~/operator/kubectl-minio/kubectl-minio tenant create --interactive
Output
Tenant name: myminio
Total of servers: 4
? Define 'Total of volumes'? [y/N] y█
✔ Namespace: tenant-ns0█
Capacity: 8Gi
Disable TLS: y
Expose Minio Service: y
? Expose Console Service? [y/N] y█
? Enable SFTP? [y/N] y█
Disable Anti-Affinity (unsupported in production environment): y
~/operator/kubectl-minio/kubectl-minio --namespace tenant-ns0 tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns0', Total capacity 8.0 GiB
Current status: Provisioning initial users
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 80)
Console service: myminio-console/ClusterIP (port 9090)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 2 8 1.0 GiB 8.0 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns0
Test 21
kubectl delete ns tenant-ns1
kubectl create ns tenant-ns1
~/operator/kubectl-minio/kubectl-minio tenant create --interactive
Output
Tenant name: myminio
Total of servers: 4
✗ Define 'Total of volumes':
Volumes per server: 2
✔ Namespace: tenant-ns1█
Capacity: 8Gi
Disable TLS: y
Expose Minio Service: y
Expose Console Service: y
? Disable Anti-Affinity (unsupported in production environment)? [y/N] y█
~/operator/kubectl-minio/kubectl-minio --namespace tenant-ns1 tenant info myminio
Output
Tenant 'myminio', Namespace 'tenant-ns1', Total capacity 8.0 GiB
Current status: Provisioning initial users
MinIO version: minio/minio:RELEASE.2023-11-15T20-43-25Z
MinIO service: minio/ClusterIP (port 80)
Console service: myminio-console/ClusterIP (port 9090)
POOL SERVERS VOLUMES PER SERVER VOLUMES CAPACITY PER VOLUME CAPACITY
0 4 2 8 1.0 GiB 8.0 GiB
Console screenshot


Cleanup
kubectl delete ns tenant-ns1