Skip to content

Commit

Permalink
refs platform/#2978: add support for OSB variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Monska85 committed Aug 8, 2024
1 parent 82224de commit 081f365
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 20 deletions.
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,25 +74,27 @@ The resulting bucket content will be:

## Environment Variables

| Variable | Description | Default |
| -------------------------- | -------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `DEBUG` | If set to `1`, the script prints the debug information. | `0` |
| `BUCKET_NAME` | The name of the bucket to create and populate at startup. | `-` |
| `BUCKET_ROOT` | The folder used by the MinIO server to store the files. | `/data` |
| `INITFILESYSTEM_DIR` | The folder where the root init filesystem is stored. If not empty, the files are copied to the `BUCKET_ROOT` folder. | `/docker-entrypoint-initfs.d` |
| `INITARCHIVES_DIR` | The folder where the seed archives are stored. | `/docker-entrypoint-initarchives.d` |
| `INITFILES_DIR` | The folder where the seed files are stored. | `/docker-entrypoint-initfiles.d` |
| `DO_NOT_PROCESS_INITFILES` | If set to `1`, the seed archives and files are not processed at startup. | `0` |
| `MINIO_ROOT_USER` | The access key used to authenticate with the MinIO server. | `-` |
| `MINIO_ROOT_PASSWORD` | The secret key used to authenticate with the MinIO server. | `-` |
| `MINIO_VERSION_ENABLED` | If set to `1`, the MinIO version is enabled. | `0` |
| `MINIO_OPTS` | Additional options to pass to the MinIO server. | `-` |
| `MINIO_BROWSER` | If set to `on`, the MinIO console is enabled. | `off` |
| `MINIO_CONSOLE_PORT` | The port used by the MinIO console. | `9001` |
| `MC_ALIAS` | The alias used by the MinIO client. | `minio` |
| `MINIO_PROTO` | The protocol used to connect to the MinIO server. | `http` |
| `MINIO_HOST` | The host used to connect to the MinIO server. | `localhost` |
| `MINIO_PORT` | The port used to connect to the MinIO server. | `9000` |
| Variable | Description | Default |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
| `DEBUG` | If set to `1`, the script prints the debug information. | `0` |
| `BUCKET_NAME` | The name of the bucket to create and populate at startup. | `-` |
| `BUCKET_ROOT` | The folder used by the MinIO server to store the files. | `/data` |
| `INITFILESYSTEM_DIR` | The folder where the root init filesystem is stored. If not empty, the files are copied to the `BUCKET_ROOT` folder. | `/docker-entrypoint-initfs.d` |
| `INITARCHIVES_DIR` | The folder where the seed archives are stored. | `/docker-entrypoint-initarchives.d` |
| `INITFILES_DIR` | The folder where the seed files are stored. | `/docker-entrypoint-initfiles.d` |
| `DO_NOT_PROCESS_INITFILES` | If set to `1`, the seed archives and files are not processed at startup. | `0` |
| `MINIO_ROOT_USER` | The access key used to authenticate with the MinIO server. | `-` |
| `OSB_ACCESS_KEY` | Alternative way to configure the access key used to authenticate with the MinIO server. **If `MINIO_ROOT_USER` is not set, this variable is used to configure it.** | `-` |
| `MINIO_ROOT_PASSWORD` | The secret key used to authenticate with the MinIO server. | `-` |
| `OSB_SECRET_KEY` | Alternative way to configure the secret key used to authenticate with the MinIO server. **If `MINIO_ROOT_PASSWORD` is not set, this variable is used to configure it.** | `-` |
| `MINIO_VERSION_ENABLED` | If set to `1`, the MinIO version is enabled. | `0` |
| `MINIO_OPTS` | Additional options to pass to the MinIO server. | `-` |
| `MINIO_BROWSER` | If set to `on`, the MinIO console is enabled. | `off` |
| `MINIO_CONSOLE_PORT` | The port used by the MinIO console. | `9001` |
| `MC_ALIAS` | The alias used by the MinIO client. | `minio` |
| `MINIO_PROTO` | The protocol used to connect to the MinIO server. | `http` |
| `MINIO_HOST` | The host used to connect to the MinIO server. | `localhost` |
| `MINIO_PORT` | The port used to connect to the MinIO server. | `9000` |

### Deprecated Variables

Expand All @@ -103,3 +105,5 @@ The following variables are deprecated and will be removed. Use the new variable
| `OSB_BUCKET` | The name of the bucket to create and populate at startup. **Use `BUCKET_NAME` instead.** |
| `MINIO_ACCESS_KEY` | The access key used to authenticate with the MinIO server. **Use `MINIO_ROOT_USER` instead.** |
| `MINIO_SECRET_KEY` | The secret key used to authenticate with the MinIO server. **Use `MINIO_ROOT_PASSWORD` instead.** |

`MINIO_ACCESS_KEY` and `MINIO_SECRET_KEY` are used only if the new variables (`MINIO_ROOT_USER` or `OSB_ACCESS_KEY` and `MINIO_ROOT_PASSWORD` or `OSB_SECRET_KEY`) are not set.
2 changes: 1 addition & 1 deletion scripts/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ minio_process_seed_archives_and_files() {
fi

if [ "${SOMETHING_UPLOADED}" = "0" ]; then
minio_log_note "No files found after processing archives in '${INITARCHIVES_DIR}' and files in '${INITFILES_DIR}'. The bucket '${BUCKET_NAME}' will remain empty."
minio_log_note "No files found after processing archives in '${INITARCHIVES_DIR}' and files in '${INITFILES_DIR}'. Nothing was uploaded to the bucket."
fi
}

Expand Down
11 changes: 11 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,17 @@ export MINIO_PROTO="${MINIO_PROTO:-"http"}"
export MINIO_HOST="${MINIO_HOST:-"localhost"}"
export MINIO_PORT="${MINIO_PORT:-"9000"}"

# Alternative way to set the MinIO credentials.
# if `OSB_ACCESS_KEY` variable is set, then `OSB_ACCESS_KEY` variable is used to set `MINIO_ROOT_USER`.
# if `OSB_SECRET_KEY` variable is set, then `OSB_SECRET_KEY` variable is used to set `MINIO_ROOT_PASSWORD`.
if [ -z "${MINIO_ROOT_USER}" ] && [ -n "${OSB_ACCESS_KEY}" ]; then
export MINIO_ROOT_USER="${OSB_ACCESS_KEY}"
fi

if [ -z "${MINIO_ROOT_PASSWORD}" ] && [ -n "${OSB_SECRET_KEY}" ]; then
export MINIO_ROOT_PASSWORD="${OSB_SECRET_KEY}"
fi

# Backward compatibility for OSB_BUCKET.
# If `BUCKET_NAME` variable is not set, then `OSB_BUCKET` variable is used to set `BUCKET_NAME`.
if [ -z "${BUCKET_NAME}" ] && [ -n "${OSB_BUCKET}" ]; then
Expand Down

0 comments on commit 081f365

Please sign in to comment.