You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
echo"end - get data to verify proper image is being used"
82
-
}
83
-
84
-
functiondestroy_kind() {
85
-
kind delete cluster
86
-
}
87
-
88
-
functionwait_for_resource() {
89
-
waitdone=0
90
-
totalwait=0
91
-
echo"command to wait on:"
92
-
command_to_wait="kubectl -n $1 get pods -l $3=$2 --no-headers"
93
-
echo$command_to_wait
94
-
95
-
whiletrue;do
96
-
waitdone=$($command_to_wait| wc -l)
97
-
if [ "$waitdone"-ne 0 ];then
98
-
echo"Found $waitdone pods"
99
-
break
100
-
fi
101
-
sleep 5
102
-
totalwait=$((totalwait +5))
103
-
if [ "$totalwait"-gt 305 ];then
104
-
echo"Unable to get resource after 5 minutes, exiting."
105
-
try false
106
-
fi
107
-
done
108
-
}
109
-
110
-
functioncheck_tenant_status() {
111
-
# Check MinIO is accessible
112
-
key=v1.min.io/tenant
113
-
if [ $#-ge 3 ];then
114
-
echo"Third argument provided, then set key value"
115
-
key=$3
116
-
else
117
-
echo"No third argument provided, using default key"
118
-
fi
119
-
120
-
wait_for_resource $1$2$key
121
-
122
-
echo"Waiting for pods to be ready. (5m timeout)"
123
-
124
-
if [ $#-ge 4 ];then
125
-
echo"Fourth argument provided, then get secrets from helm"
126
-
USER=$(kubectl get secret minio1-secret -o jsonpath="{.data.accesskey}"| base64 --decode)
127
-
PASSWORD=$(kubectl get secret minio1-secret -o jsonpath="{.data.secretkey}"| base64 --decode)
128
-
else
129
-
echo"No fourth argument provided, using default USER and PASSWORD"
130
-
USER=$(kubectl -n $1 get secrets $2-env-configuration -o go-template='{{index .data "config.env"|base64decode }}'| grep 'export MINIO_ROOT_USER="'| sed -e 's/export MINIO_ROOT_USER="//g'| sed -e 's/"//g')
131
-
PASSWORD=$(kubectl -n $1 get secrets $2-env-configuration -o go-template='{{index .data "config.env"|base64decode }}'| grep 'export MINIO_ROOT_PASSWORD="'| sed -e 's/export MINIO_ROOT_PASSWORD="//g'| sed -e 's/"//g')
132
-
fi
133
-
134
-
try kubectl wait --namespace $1 \
135
-
--for=condition=ready pod \
136
-
--selector=$key=$2 \
137
-
--timeout=300s
138
-
139
-
echo"Tenant is created successfully, proceeding to validate 'mc admin info minio/'"
140
-
141
-
if [ "$4"="helm" ];then
142
-
# File: operator/helm/tenant/values.yaml
143
-
# Content: s3.bucketDNS: false
144
-
echo"In helm values by default bucketDNS.s3 is disabled, skipping mc validation on helm test"
145
-
else
146
-
kubectl run admin-mc -i --tty --image minio/mc --command -- bash -c "until (mc alias set minio/ https://minio.$1.svc.cluster.local $USER$PASSWORD); do echo \"...waiting... for 5secs\" && sleep 5; done; mc admin info minio/;"
147
-
fi
148
-
149
-
echo"Done."
150
-
}
151
-
152
-
# Install tenant function is being used by deploy-tenant and check-prometheus
153
-
functioninstall_tenant() {
154
-
155
-
namespace=tenant-lite
156
-
key=v1.min.io/tenant
157
-
value=storage-lite
158
-
echo"Installing lite tenant"
159
-
160
-
try kubectl apply -k "${SCRIPT_DIR}/tenant-lite"
161
-
162
-
echo"Waiting for the tenant statefulset, this indicates the tenant is being fulfilled"
163
-
echo$namespace
164
-
echo$value
165
-
echo$key
166
-
wait_for_resource $namespace$value$key
167
-
168
-
echo"Waiting for tenant pods to come online (5m timeout)"
169
-
try kubectl wait --namespace $namespace \
170
-
--for=condition=ready pod \
171
-
--selector $key=$value \
172
-
--timeout=300s
173
-
174
-
echo"Wait for Prometheus PVC to be bound"
175
-
while [[ $(kubectl get pvc storage-lite-prometheus-storage-lite-prometheus-0 -n tenant-lite -o 'jsonpath={..status.phase}')!="Bound" ]];doecho"waiting for PVC status"&& sleep 1 && kubectl get pvc -A;done
0 commit comments