Skip to content

Commit

Permalink
[patch] Rename AI Broker role variables for consistency (#1414)
Browse files Browse the repository at this point in the history
  • Loading branch information
karol-czarnecki authored Aug 23, 2024
1 parent 1da5dde commit e957e01
Show file tree
Hide file tree
Showing 21 changed files with 244 additions and 233 deletions.
148 changes: 74 additions & 74 deletions docs/playbooks/oneclick-aibroker.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ AI Broker supports **AWS** and **Minio** storage providers.
* `MAS_INSTANCE_ID` Declare the instance ID for the AI Broker install
* `MAS_ENTITLEMENT_KEY` Your IBM Entitlement key to access the IBM Container Registry
* `MAS_ENTITLEMENT_USERNAME` Your IBM Entitlement user to access the IBM Container Registry
* `STORAGE_ACCESSKEY` Your strage provider access key
* `STORAGE_SECRETKEY` Your storage provider secret key
* `STORAGE_HOST` Your storage provider host
* `STORAGE_REGION` Your storage provider region - only when use AWS S3 instance
* `STORAGE_PROVIDER` Your storage provider name
* `STORAGE_SSL` Your storage ssl (true/false)
* `STORAGE_PIPELINES_BUCKET` Your piplines bucket
* `STORAGE_TENANTS_BUCKET` Your tenants bucket
* `STORAGE_TEMPLATES_BUCKET` Your templates bucket
* `WATSONXAI_APIKEY` You WatsonX AI api key
* `WATSONXAI_URL` You WatsonX AI url
* `WATSONXAI_PROJECT_ID` You WatsonX projedt Id
* `DB_HOST` Your database instance host
* `DB_PORT` Your database instance port
* `DB_USER` Your database instance user
* `DB_DATABASE` Your database instance datbase name
* `DB_SECRET_NAME` Your database instance secret name
* `DB_SECRET_VALUE` Your database instance password
* `MAS_AIBROKER_STORAGE_ACCESSKEY` Your strage provider access key
* `MAS_AIBROKER_STORAGE_SECRETKEY` Your storage provider secret key
* `MAS_AIBROKER_STORAGE_HOST` Your storage provider host
* `MAS_AIBROKER_STORAGE_REGION` Your storage provider region - only when use AWS S3 instance
* `MAS_AIBROKER_STORAGE_PROVIDER` Your storage provider name
* `MAS_AIBROKER_STORAGE_SSL` Your storage ssl (true/false)
* `MAS_AIBROKER_STORAGE_PIPELINES_BUCKET` Your piplines bucket
* `MAS_AIBROKER_STORAGE_TENANTS_BUCKET` Your tenants bucket
* `MAS_AIBROKER_STORAGE_TEMPLATES_BUCKET` Your templates bucket
* `MAS_AIBROKER_WATSONXAI_APIKEY` You WatsonX AI api key
* `MAS_AIBROKER_WATSONXAI_URL` You WatsonX AI url
* `MAS_AIBROKER_WATSONXAI_PROJECT_ID` You WatsonX projedt Id
* `MAS_AIBROKER_DB_HOST` Your database instance host
* `MAS_AIBROKER_DB_PORT` Your database instance port
* `MAS_AIBROKER_DB_USER` Your database instance user
* `MAS_AIBROKER_DB_DATABASE` Your database instance datbase name
* `MAS_AIBROKER_DB_SECRET_NAME` Your database instance secret name
* `MAS_AIBROKER_DB_SECRET_VALUE` Your database instance password

## Optional environment variables

Expand All @@ -66,10 +66,10 @@ AI Broker supports **AWS** and **Minio** storage providers.
* `MAS_CATALOG_VERSION` Your custom AI broker catalog version
* `ARTIFACTORY_USERNAME` Your artifactory user name to access - this is needed if user deploy from custom registry for example `docker-na-public.artifactory.swg-devops.com`
* `ARTIFACTORY_TOKEN` Your artifactory token for user to access - this is needed if user deploy from custom registry for example `docker-na-public.artifactory.swg-devops.com`
* `TENANT_ACTION` Whether to install or remove tenant (default value is: install)
* `APIKEY_ACTION` Whether to install or remove or update apikey (default value is: install)
* `WATSONX_ACTION` Whether to install or remove watsonx secret (default value is: install)
* `S3_ACTION` Whether to install or remove s3 (default value is: install)
* `MAS_AIBROKER_TENANT_ACTION` Whether to install or remove tenant (default value is: install)
* `MAS_AIBROKER_APIKEY_ACTION` Whether to install or remove or update apikey (default value is: install)
* `MAS_AIBROKER_WATSONX_ACTION` Whether to install or remove watsonx secret (default value is: install)
* `MAS_AIBROKER_S3_ACTION` Whether to install or remove s3 (default value is: install)

## Usage

Expand All @@ -93,25 +93,25 @@ export ARTIFACTORY_TOKEN="<artifactory token>"
export MAS_ICR_CP="<internal redistry for aibroker applications>"
export MAS_ICR_CPOPEN="<internal redistry for aibroker operator>"
export MAS_INSTANCE_ID="<instanceId>"
export STORAGE_ACCESSKEY="<storage provider access key>"
export STORAGE_SECRETKEY="<storage provider secret key>"
export STORAGE_HOST="<storage provider host>"
export STORAGE_SSL="true or false"
export STORAGE_REGION="<storage provider region - only for aws>"
export STORAGE_PROVIDER="<storage provider name>"
export STORAGE_PORT="<storage provider port - only for minio>"
export STORAGE_PIPELINES_BUCKET="<pipelines bucket name>"
export STORAGE_TENANTS_BUCKET="<tenants bucket name>"
export STORAGE_TEMPLATES_BUCKET="<templates bucket name>"
export WATSONXAI_APIKEY="<watsonx AI api key>"
export WATSONXAI_URL="<watsonx AI learning url>"
export WATSONXAI_PROJECT_ID="<watsonx AI project ID>"
export DB_HOST="<database instance host>"
export DB_PORT="<database instance port>"
export DB_USER="<database instance user>"
export DB_DATABASE="<database instance datbase name>"
export DB_SECRET_NAME="<database instance secret name>"
export DB_SECRET_VALUE="<database instance password>"
export MAS_AIBROKER_STORAGE_ACCESSKEY="<storage provider access key>"
export MAS_AIBROKER_STORAGE_SECRETKEY="<storage provider secret key>"
export MAS_AIBROKER_STORAGE_HOST="<storage provider host>"
export MAS_AIBROKER_STORAGE_SSL="true or false"
export MAS_AIBROKER_STORAGE_REGION="<storage provider region - only for aws>"
export MAS_AIBROKER_STORAGE_PROVIDER="<storage provider name>"
export MAS_AIBROKER_STORAGE_PORT="<storage provider port - only for minio>"
export MAS_AIBROKER_STORAGE_PIPELINES_BUCKET="<pipelines bucket name>"
export MAS_AIBROKER_STORAGE_TENANTS_BUCKET="<tenants bucket name>"
export MAS_AIBROKER_STORAGE_TEMPLATES_BUCKET="<templates bucket name>"
export MAS_AIBROKER_WATSONXAI_APIKEY="<watsonx AI api key>"
export MAS_AIBROKER_WATSONXAI_URL="<watsonx AI learning url>"
export MAS_AIBROKER_WATSONXAI_PROJECT_ID="<watsonx AI project ID>"
export MAS_AIBROKER_DB_HOST="<database instance host>"
export MAS_AIBROKER_DB_PORT="<database instance port>"
export MAS_AIBROKER_DB_USER="<database instance user>"
export MAS_AIBROKER_DB_DATABASE="<database instance datbase name>"
export MAS_AIBROKER_DB_SECRET_NAME="<database instance secret name>"
export MAS_AIBROKER_DB_SECRET_VALUE="<database instance password>"

oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/oneclick_add_aibroker.yml
Expand All @@ -123,25 +123,25 @@ ansible-playbook playbooks/oneclick_add_aibroker.yml
export MAS_ENTITLEMENT_USERNAME="<user>"
export MAS_ENTITLEMENT_KEY="<token>"
export MAS_INSTANCE_ID="<instanceId>"
export STORAGE_ACCESSKEY="<storage provider access key>"
export STORAGE_SECRETKEY="<storage provider secret key>"
export STORAGE_HOST="<storage provider host>"
export STORAGE_SSL="true or false"
export STORAGE_REGION="<storage provider region - only for aws>"
export STORAGE_PROVIDER="<storage provider name>"
export STORAGE_PORT="<storage provider port - only for minio>"
export STORAGE_PIPELINES_BUCKET="<pipelines bucket name>"
export STORAGE_TENANTS_BUCKET="<tenants bucket name>"
export STORAGE_TEMPLATES_BUCKET="<templates bucket name>"
export WATSONXAI_APIKEY="<watsonx AI api key>"
export WATSONXAI_URL="<watsonx AI url>"
export WATSONXAI_PROJECT_ID="<watsonx AI project ID>"
export DB_HOST="<database instance host>"
export DB_PORT="<database instance port>"
export DB_USER="<database instance user>"
export DB_DATABASE="<database instance datbase name>"
export DB_SECRET_NAME="<database instance secret name>"
export DB_SECRET_VALUE="<database instance password>"
export MAS_AIBROKER_STORAGE_ACCESSKEY="<storage provider access key>"
export MAS_AIBROKER_STORAGE_SECRETKEY="<storage provider secret key>"
export MAS_AIBROKER_STORAGE_HOST="<storage provider host>"
export MAS_AIBROKER_STORAGE_SSL="true or false"
export MAS_AIBROKER_STORAGE_REGION="<storage provider region - only for aws>"
export MAS_AIBROKER_STORAGE_PROVIDER="<storage provider name>"
export MAS_AIBROKER_STORAGE_PORT="<storage provider port - only for minio>"
export MAS_AIBROKER_STORAGE_PIPELINES_BUCKET="<pipelines bucket name>"
export MAS_AIBROKER_STORAGE_TENANTS_BUCKET="<tenants bucket name>"
export MAS_AIBROKER_STORAGE_TEMPLATES_BUCKET="<templates bucket name>"
export MAS_AIBROKER_WATSONXAI_APIKEY="<watsonx AI api key>"
export MAS_AIBROKER_WATSONXAI_URL="<watsonx AI url>"
export MAS_AIBROKER_WATSONXAI_PROJECT_ID="<watsonx AI project ID>"
export MAS_AIBROKER_DB_HOST="<database instance host>"
export MAS_AIBROKER_DB_PORT="<database instance port>"
export MAS_AIBROKER_DB_USER="<database instance user>"
export MAS_AIBROKER_DB_DATABASE="<database instance datbase name>"
export MAS_AIBROKER_DB_SECRET_NAME="<database instance secret name>"
export MAS_AIBROKER_DB_SECRET_VALUE="<database instance password>"

oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/oneclick_add_aibroker.yml
Expand Down Expand Up @@ -186,11 +186,11 @@ ansible-playbook playbooks/oneclick_add_aibroker.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export STORAGE_ACCESSKEY="<storage provider access key>"
export STORAGE_SECRETKEY="<storage provider secret key>"
export STORAGE_HOST="<storage provider host>"
export STORAGE_REGION="<storage provider region>"
export S3_ACTION="install"
export MAS_AIBROKER_STORAGE_ACCESSKEY="<storage provider access key>"
export MAS_AIBROKER_STORAGE_SECRETKEY="<storage provider secret key>"
export MAS_AIBROKER_STORAGE_HOST="<storage provider host>"
export MAS_AIBROKER_STORAGE_REGION="<storage provider region>"
export MAS_AIBROKER_S3_ACTION="install"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
Expand All @@ -206,11 +206,11 @@ ansible-playbook playbooks/run_role.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export STORAGE_ACCESSKEY="<storage provider access key>"
export STORAGE_SECRETKEY="<storage provider secret key>"
export STORAGE_HOST="<storage provider host>"
export STORAGE_REGION="<storage provider region>"
export S3_ACTION="remove"
export MAS_AIBROKER_STORAGE_ACCESSKEY="<storage provider access key>"
export MAS_AIBROKER_STORAGE_SECRETKEY="<storage provider secret key>"
export MAS_AIBROKER_STORAGE_HOST="<storage provider host>"
export MAS_AIBROKER_STORAGE_REGION="<storage provider region>"
export MAS_AIBROKER_S3_ACTION="remove"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
Expand All @@ -226,7 +226,7 @@ ansible-playbook playbooks/run_role.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export APIKEY_ACTION="install"
export MAS_AIBROKER_APIKEY_ACTION="install"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
Expand All @@ -242,7 +242,7 @@ ansible-playbook playbooks/run_role.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export APIKEY_ACTION="remove"
export MAS_AIBROKER_APIKEY_ACTION="remove"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
Expand All @@ -258,7 +258,7 @@ ansible-playbook playbooks/run_role.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export WATSONX_ACTION="install"
export MAS_AIBROKER_WATSONX_ACTION="install"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
Expand All @@ -274,7 +274,7 @@ ansible-playbook playbooks/run_role.yml

```bash
export MAS_INSTANCE_ID="<instanceId>"
export WATSONX_ACTION="remove"
export MAS_AIBROKER_WATSONX_ACTION="remove"
export ROLE_NAME="aibroker"
oc login --token=xxxx --server=https://myocpserver
ansible-playbook playbooks/run_role.yml
35 changes: 17 additions & 18 deletions ibm/mas_devops/playbooks/oneclick_add_aibroker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,23 @@
that:
- lookup('env', 'MAS_ENTITLEMENT_KEY') != ""
- lookup('env', 'MAS_INSTANCE_ID') != ""
- lookup('env', 'STORAGE_ACCESSKEY') != ""
- lookup('env', 'STORAGE_SECRETKEY') != ""
- lookup('env', 'STORAGE_HOST') != ""
- lookup('env', 'STORAGE_SSL') != ""
- lookup('env', 'STORAGE_PROVIDER') != ""
- lookup('env', 'STORAGE_PIPELINES_BUCKET') != ""
- lookup('env', 'STORAGE_TENANTS_BUCKET') != ""
- lookup('env', 'STORAGE_TEMPLATES_BUCKET') != ""
- lookup('env', 'WATSONXAI_PROJECT_ID') != ""
- lookup('env', 'WATSONXAI_APIKEY') != ""
- lookup('env', 'WATSONXAI_URL') != ""
- lookup('env', 'WATSONXAI_PROJECT_ID') != ""
- lookup('env', 'DB_HOST') != ""
- lookup('env', 'DB_PORT') != ""
- lookup('env', 'DB_USER') != ""
- lookup('env', 'DB_DATABASE') != ""
- lookup('env', 'DB_SECRET_NAME') != ""
- lookup('env', 'DB_SECRET_VALUE') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_ACCESSKEY') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_SECRETKEY') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_HOST') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_SSL') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_PROVIDER') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_PIPELINES_BUCKET') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_TENANTS_BUCKET') != ""
- lookup('env', 'MAS_AIBROKER_STORAGE_TEMPLATES_BUCKET') != ""
- lookup('env', 'MAS_AIBROKER_WATSONXAI_APIKEY') != ""
- lookup('env', 'MAS_AIBROKER_WATSONXAI_URL') != ""
- lookup('env', 'MAS_AIBROKER_WATSONXAI_PROJECT_ID') != ""
- lookup('env', 'MAS_AIBROKER_DB_HOST') != ""
- lookup('env', 'MAS_AIBROKER_DB_PORT') != ""
- lookup('env', 'MAS_AIBROKER_DB_USER') != ""
- lookup('env', 'MAS_AIBROKER_DB_DATABASE') != ""
- lookup('env', 'MAS_AIBROKER_DB_SECRET_NAME') != ""
- lookup('env', 'MAS_AIBROKER_DB_SECRET_VALUE') != ""
fail_msg: "One or more required environment variables are not defined"

roles:
Expand Down
38 changes: 19 additions & 19 deletions ibm/mas_devops/roles/aibroker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Action to be performed by AI Broker role. Valid values are `install` or `remove`

The tenant name for AI Broker role.

* Environment Variable: `TENANT_NAME`
* Environment Variable: `MAS_AIBROKER_TENANT_NAME`
* Default Value: `user`

### app_domain
Expand All @@ -33,67 +33,67 @@ The application domain for AI Broker role. Valid values is domain string `apps.d
* Environment Variable: `APP_DOMAIN`
* Default Value: ``

### s3_action
### mas_aibroker_s3_action

Action to be performed by AI Broker role. Valid values are `install` or `remove`

* Environment Variable: `S3_ACTION`
* Environment Variable: `MAS_AIBROKER_S3_ACTION`
* Default Value: `install`

### storage_host
### mas_aibroker_storage_host

The storge host for AI Broker role.

* Environment Variable: `STORAGE_HOST`
* Environment Variable: `MAS_AIBROKER_STORAGE_HOST`
* Default Value: ``

### storage_accesskey
### mas_aibroker_storage_accesskey

The storage accesskey for AI Broker role.

* Environment Variable: `STORAGE_ACCESSKEY`
* Environment Variable: `MAS_AIBROKER_STORAGE_ACCESSKEY`
* Default Value: ``

### storage_secretkey
### mas_aibroker_storage_secretkey

The storage secretkey for AI Broker role.

* Environment Variable: `STORAGE_SECRETKEY`
* Environment Variable: `MAS_AIBROKER_STORAGE_SECRETKEY`
* Default Value: ``

### storage_region
### mas_aibroker_storage_region

The storage region for AI Broker role.

* Environment Variable: `STORAGE_REGION`
* Environment Variable: `MAS_AIBROKER_STORAGE_REGION`
* Default Value: ``

### watsonx_action
### mas_aibroker_watsonx_action

Action to be performed by AI Broker role. Valid values are `install` or `remove`

* Environment Variable: `WATSONX_ACTION`
* Environment Variable: `MAS_AIBROKER_WATSONX_ACTION`
* Default Value: `install`

### watsonxai_apikey
### mas_aibroker_watsonxai_apikey

The watsonxai apikey for AI Broker role.

* Environment Variable: `WATSONXAI_APIKEY`
* Environment Variable: `MAS_AIBROKER_WATSONXAI_APIKEY`
* Default Value: ``

### watsonxai_url
### mas_aibroker_watsonxai_url

The watsonxai url for AI Broker role.

* Environment Variable: `WATSONXAI_URL`
* Environment Variable: `MAS_AIBROKER_WATSONXAI_URL`
* Default Value: ``

### watsonxai_project_id
### mas_aibroker_watsonxai_project_id

The watsonxai project id for AI Broker role.

* Environment Variable: `WATSONXAI_PROJECT_ID`
* Environment Variable: `MAS_AIBROKER_WATSONXAI_PROJECT_ID`
* Default Value: ``

License
Expand Down
6 changes: 3 additions & 3 deletions ibm/mas_devops/roles/aibroker/tasks/apikey/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
- name: "API Key: Debug properties"
debug:
msg:
- "Api Key action ........................ {{ apikey_action }}"
- "Api Key action ........................ {{ mas_aibroker_apikey_action }}"

# 1. Perform the selected action
# -----------------------------------------------------------------------------
# Two actions are supported:
# - install
# - remove
# - update
- include_tasks: "apikey/{{ apikey_action }}/main.yml"
- include_tasks: "apikey/{{ mas_aibroker_apikey_action }}/main.yml"
when:
- apikey_action != "none"
- mas_aibroker_apikey_action != "none"
2 changes: 1 addition & 1 deletion ibm/mas_devops/roles/aibroker/tasks/s3/install/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
register: s3_apikey_secret_info

- name: Create S3 API Key
script: "{{ role_path }}/files/create_s3.sh {{ tenantNamespace }} {{ aibroker_namespace }} {{ storage_host }} {{ storage_accesskey }} {{ storage_secretkey }} {{ storage_provider }} {{ storage_port }} {{ storage_region }}"
script: "{{ role_path }}/files/create_s3.sh {{ tenantNamespace }} {{ aibroker_namespace }} {{ mas_aibroker_storage_host }} {{ mas_aibroker_storage_accesskey }} {{ mas_aibroker_storage_secretkey }} {{ mas_aibroker_storage_provider }} {{ mas_aibroker_storage_port }} {{ mas_aibroker_storage_region }}"
when:
- s3_apikey_secret_info.resources | length == 0
register: script_output
6 changes: 3 additions & 3 deletions ibm/mas_devops/roles/aibroker/tasks/s3/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
- name: "S3: Debug properties"
debug:
msg:
- "S3 action ........................ {{ s3_action }}"
- "S3 action ........................ {{ mas_aibroker_s3_action }}"

# 1. Perform the selected action
# -----------------------------------------------------------------------------
# Two actions are supported:
# - install
# - remove
- include_tasks: "s3/{{ s3_action }}/main.yml"
- include_tasks: "s3/{{ mas_aibroker_s3_action }}/main.yml"
when:
- s3_action != "none"
- mas_aibroker_s3_action != "none"
Loading

0 comments on commit e957e01

Please sign in to comment.