Skip to content

issue operator 1116

Allan Roger Reid edited this page Dec 14, 2023 · 9 revisions

Steps

Create a vm broker instance, operator-1116

SSH in

ssh -p 20055 [email protected] -o "ServerAliveInterval=5" -o "ServerAliveCountMax=100000" -o "StrictHostKeyChecking=off"

Persist sessions after logout

loginctl enable-linger ubuntu

Clone operator

git clone https://github.com/allanrogerr/operator.git
cd operator && git checkout add-plugin-tenant-fields

Install k3s

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

Install essential packages

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

Install go

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

Install nvm (optional - only to ensure nothing else is broken in operator)

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

Build & install kubectl-minio plugin

cd ~/operator/kubectl-minio
CGO_ENABLED=1 go build --ldflags "-s -w" -trimpath -o ../kubectl-minio

Test cases

PASS EXPECTED

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

image image

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

image image

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 image image

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 image Truncated image

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 image image

Cleanup

kubectl delete ns tenant-ns4

Fail EXPECTED

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 cases

PASS EXPECTED

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

<img width="925" alt="image" src="https://github.com/allanrogerr/public/assets/16472240/afda5340-020f-4257-b99e-b1c1bef2b910">
<img width="931" alt="image" src="https://github.com/allanrogerr/public/assets/16472240/29767b0f-fe0d-46c1-a8ba-85d6cdfe2057">


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

image image

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

<img width="924" alt="image" src="https://github.com/allanrogerr/public/assets/16472240/007f823f-dfde-40e4-a230-eecf012d50b2">
<img width="930" alt="image" src="https://github.com/allanrogerr/public/assets/16472240/b4080764-a20b-4e55-8e05-9d833fadb1cb">


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

image image

Cleanup

kubectl delete ns tenant-ns3

Fail EXPECTED

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
Clone this wiki locally