Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ module "ocp_base" {
}
```

### Customizing default cloud service endpoints.

The user must export the endpoint as an environment variable in order to use custom cloud service endpoints with this module. [Learn more](https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/guides/custom-service-endpoints#1-define-service-endpoints-by-using-environment-variables).

**Important** The only supported method for customizing cloud service endpoints is to export the endpoint; be sure to export the value for `IBMCLOUD_API_ENDPOINT`. For example,
```
export IBMCLOUD_API_ENDPOINT="<endpoint_url>"
```

### Secure by default cluster settings

In OCP version 4.15, outbound traffic is disabled by default. [Learn more](https://cloud.ibm.com/docs/openshift?topic=openshift-vpc-security-group-reference).
Expand Down
11 changes: 9 additions & 2 deletions scripts/confirm_lb_active.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,25 @@ set -euo pipefail
REGION="$1"
LB_ID="$2"
PRIVATE_ENV="$3"
CLOUD_ENDPOINT=""
API_VERSION="2024-03-01"

if [[ -z "${REGION}" ]]; then
echo "Region must be passed as first input script argument" >&2
exit 1
fi

get_cloud_endpoint() {
cloud_endpoint="${IBMCLOUD_API_ENDPOINT:-"cloud.ibm.com"}"
CLOUD_ENDPOINT=${cloud_endpoint#https://}
}

get_cloud_endpoint
lb_attempts=1
if [ "$PRIVATE_ENV" = true ]; then
URL="https://$REGION.private.iaas.cloud.ibm.com/v1/load_balancers/$LB_ID?version=$API_VERSION&generation=2"
URL="https://$REGION.private.iaas.$CLOUD_ENDPOINT/v1/load_balancers/$LB_ID?version=$API_VERSION&generation=2"
else
URL="https://$REGION.iaas.cloud.ibm.com/v1/load_balancers/$LB_ID?version=$API_VERSION&generation=2"
URL="https://$REGION.iaas.$CLOUD_ENDPOINT/v1/load_balancers/$LB_ID?version=$API_VERSION&generation=2"
fi

while true; do
Expand Down
18 changes: 13 additions & 5 deletions scripts/reset_iks_api_key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RESOURCE_GROUP_ID="$2"
APIKEY_KEY_NAME="containers-kubernetes-key"
PRIVATE_ENV="$3"
CLUSTER_ENDPOINT="$4"
CLOUD_ENDPOINT=""

if [[ -z "${REGION}" ]]; then
echo "Region must be passed as first input script argument" >&2
Expand All @@ -18,10 +19,17 @@ if [[ -z "${RESOURCE_GROUP_ID}" ]]; then
exit 1
fi

get_cloud_endpoint() {
cloud_endpoint="${IBMCLOUD_API_ENDPOINT:-"cloud.ibm.com"}"
CLOUD_ENDPOINT=${cloud_endpoint#https://}
}

get_cloud_endpoint

if [ "$PRIVATE_ENV" = true ]; then
IAM_URL="https://private.iam.cloud.ibm.com/v1/apikeys?account_id=$ACCOUNT_ID&scope=account&pagesize=100&type=user&sort=name"
IAM_URL="https://private.iam.$CLOUD_ENDPOINT/v1/apikeys?account_id=$ACCOUNT_ID&scope=account&pagesize=100&type=user&sort=name"
else
IAM_URL="https://iam.cloud.ibm.com/v1/apikeys?account_id=$ACCOUNT_ID&scope=account&pagesize=100&type=user&sort=name"
IAM_URL="https://iam.$CLOUD_ENDPOINT/v1/apikeys?account_id=$ACCOUNT_ID&scope=account&pagesize=100&type=user&sort=name"
fi

reset=true
Expand Down Expand Up @@ -53,16 +61,16 @@ fetch_data
if [ "${reset}" == true ]; then
if [ "$PRIVATE_ENV" = true ]; then
if [ "$CLUSTER_ENDPOINT" == "private" ] || [ "$CLUSTER_ENDPOINT" == "default" ]; then
RESET_URL="https://private.$REGION.containers.cloud.ibm.com/v1/keys"
RESET_URL="https://private.$REGION.containers.$CLOUD_ENDPOINT/v1/keys"
result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null)
status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2)
elif [ "$CLUSTER_ENDPOINT" == "vpe" ]; then
RESET_URL="https://api.$REGION.containers.cloud.ibm.com/v1/keys"
RESET_URL="https://api.$REGION.containers.$CLOUD_ENDPOINT/v1/keys"
result=$(curl -i -H "accept: application/json" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" 2>/dev/null)
status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2)
fi
else
RESET_URL="https://containers.cloud.ibm.com/global/v1/keys"
RESET_URL="https://containers.$CLOUD_ENDPOINT/global/v1/keys"
result=$(curl -i -H "accept: application/json" -H "X-Region: $REGION" -H "Authorization: $IAM_TOKEN" -H "X-Auth-Resource-Group: $RESOURCE_GROUP_ID" -X POST "$RESET_URL" -d '' 2>/dev/null)
status_code=$(echo "$result" | head -n 1 | cut -d$' ' -f2)
fi
Expand Down