| garciadeblas | 8d8cd99 | 2024-05-21 16:04:14 +0200 | [diff] [blame] | 1 | ####################################################################################### |
| 2 | # Copyright ETSI Contributors and Others. |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 13 | # implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | ####################################################################################### |
| 17 | |
| 18 | # Retrieves Minio connection info data |
| 19 | |
| 20 | # Internal services and ports |
| 21 | export MINIO_INTERNAL_CONSOLE_HOST=console.minio-operator |
| 22 | export MINIO_INTERNAL_TENANT_HOST=minio.${MINIO_TENANT_NAME} |
| 23 | export MINIO_CONSOLE_HTTP_PORT=$(kubectl get svc/console -n minio-operator -o jsonpath='{.spec.ports[?(.name=="http")].port}') |
| 24 | export MINIO_CONSOLE_HTTPS_PORT=$(kubectl get svc/console -n minio-operator -o jsonpath='{.spec.ports[?(.name=="https")].port}') |
| 25 | export MINIO_TENANT_HTTPS_PORT=$(kubectl get svc/minio -n ${MINIO_TENANT_NAME} -o jsonpath='{.spec.ports[?(.name=="https-minio")].port}') |
| 26 | # NOTE: There is no HTTP port for the Minio Tenant. For HTTP-like accesses, use the `--insecure` flag in Minio client. |
| 27 | |
| 28 | # Final Minio's Console HTTP service |
| 29 | ## In case it is behind an Ingress |
| 30 | if [[ -n $(kubectl get ingress/minio-console-ingress -n minio-operator 2> /dev/null) ]] |
| 31 | then |
| 32 | # Retrieves the external host name |
| 33 | INGRESS_IP=$(kubectl get svc/ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
| 34 | export MINIO_INGRESS_CONSOLE_HOST="console.s3.${INGRESS_IP}.nip.io" |
| 35 | |
| 36 | # Uses the external host name as the default console endpoint |
| 37 | export MINIO_CONSOLE_HOST=${MINIO_INGRESS_CONSOLE_HOST} |
| 38 | ## Otherwise just uses the internal service name |
| 39 | else |
| 40 | export MINIO_CONSOLE_HOST=${MINIO_INTERNAL_CONSOLE_HOST} |
| 41 | fi |
| 42 | export MINIO_CONSOLE_URL="http://${MINIO_CONSOLE_HOST}" |
| 43 | |
| 44 | # Final Minio's Tenant HTTPS service |
| 45 | ## In case it is behind an Ingress |
| 46 | if [[ -n $(kubectl get ingress/minio-tenant-ingress -n ${MINIO_TENANT_NAME} 2> /dev/null) ]] |
| 47 | then |
| 48 | # Retrieves the external host name |
| 49 | INGRESS_IP=$(kubectl get svc/ingress-nginx-controller -n ingress-nginx -o jsonpath='{.status.loadBalancer.ingress[0].ip}') |
| 50 | export MINIO_INGRESS_TENANT_HOST="${MINIO_TENANT_NAME}.s3.${INGRESS_IP}.nip.io" |
| 51 | |
| 52 | # Uses the external host name as the default console endpoint |
| 53 | export MINIO_TENANT_HOST=${MINIO_INGRESS_TENANT_HOST} |
| 54 | ## Otherwise just uses the internal service name |
| 55 | else |
| 56 | export MINIO_TENANT_HOST=${MINIO_INTERNAL_TENANT_HOST} |
| 57 | fi |
| 58 | export MINIO_TENANT_URL="https://${MINIO_TENANT_HOST}" |
| 59 | |
| 60 | # Determine locations of TLS certificates for tenant's endpoint, if applicable |
| 61 | export MINIO_TENANT_TLS_KEY="${CREDENTIALS_DIR}/tls.${MINIO_TENANT_NAME}.key" |
| 62 | export MINIO_TENANT_TLS_CERT="${CREDENTIALS_DIR}/tls.${MINIO_TENANT_NAME}.cert" |