Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DS-42169: updating launch.sh with proxy url and cacert options #127

Merged
merged 1 commit into from
Feb 25, 2025
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
13 changes: 11 additions & 2 deletions RemoteEngine/kubernetes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@ To deploy the DataStage operator on cluster without global pull secret configure
# create pull secret for container registry
./launch.sh create-pull-secret --namespace <namespace> --username <username> --password ${api-key} [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)]

# deploy the operator
./launch.sh install --namespace <namespace> [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)]
# create the proxy secrets if proxies are used
# ./launch.sh create-proxy-secret --namespace <namespace> [--proxy <proxy_url>] [--proxy-cacert <cacert_location>] [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)]

# create the api-key for dev or prod environment
./launch.sh create-apikey-secret --namespace <namespace> --apikey ${api-key} [--serviceid ${service-id}] [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)]

# deploy the operator
./launch.sh install --namespace <namespace> [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)]

# create the remote instance - add '--gateway api.dataplatform.cloud.ibm.com' if the instance needs to registers with prod env

./launch.sh create-instance --namespace <namespace> --name <name> --project-id <project_id1,project_id2,project_id3,...> --storage-class <storage-class> [--storage-size <storage-size>] [--size <size>] [--data-center dallas|frankfurt|sydney|toronto (if you are specifically deploying a remote engine for IBM Cloud)] [--additional-users <IBMid-1000000000,IBMid-2000000000,IBMid-3000000000,...>] [--zen-url <zen-url> (if you are specifically deploying a remote engine for CP4D)] --license-accept true
Expand Down Expand Up @@ -132,6 +135,12 @@ storage_size=20
# If you are specifically deploying a remote engine for CP4D, the zen url of the target cluster to use for CP4D environment. Specifying this variable will automatically switch usage from IBM Cloud to CP4D.
zen_url=<zen-url>

# Specify the proxy url (eg. http://<username>:<password>@<proxy_ip>:<port>).
# proxy_url=<proxy-url>

# Specify the absolute location of the custom CA store for the specified proxy - if it is using a self signed certificate.
# cacert_location=<cacert-location>

# the DNS name or IP of the EFS file system; omit if not deploying on AWS's EKS
# the provisioner will use the storage class name specified in storage_class
# nfs_server=<dns-name-or-IP>
Expand Down
47 changes: 46 additions & 1 deletion RemoteEngine/kubernetes/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ OPERATOR_REGISTRY="${DOCKER_REGISTRY}/datastage"
DOCKER_REGISTRY_PREFIX="${DOCKER_REGISTRY}/datastage"
DS_REGISTRY_SECRET="datastage-pull-secret"
DS_API_KEY_SECRET="datastage-api-key-secret"
DS_PROXY_URL="datastage-proxy-url"
DS_GATEWAY="api.dataplatform.cloud.ibm.com"
data_center="dallas"

Expand Down Expand Up @@ -556,6 +557,21 @@ create_apikey_secret() {
$kubernetesCLI -n ${namespace} create secret generic $DS_API_KEY_SECRET --from-literal=api-key=${api_key} --from-literal=service-id=${service_id}
}

create_proxy_secrets() {
if [ ! -z $proxy_url ]; then
CURL_CMD="curl --proxy ${proxy_url}"
$kubernetesCLI -n ${namespace} delete secret $DS_PROXY_URL --ignore-not-found=true ${dryRun}
$kubernetesCLI -n ${namespace} create secret generic $DS_PROXY_URL --from-literal=proxy_url=${proxy_url}
if [ ! -z $cacert_location ] && [ -f $cacert_location ]; then
CURL_CMD="${CURL_CMD} --proxy-insecure"
$kubernetesCLI -n ${namespace} delete secret connection-ca-certs --ignore-not-found=true ${dryRun}
$kubernetesCLI -n ${namespace} create secret generic connection-ca-certs --from-file=${cacert_location}
else
echo "The specified proxy certificate $cacert_location is not found."
fi
fi
}

remove_previous_resources() {
$kubernetesCLI -n ${namespace} delete deploy ${name}-ibm-datastage-px-runtime --ignore-not-found=true
$kubernetesCLI -n ${namespace} delete sts ${name}-ibm-datastage-px-compute --ignore-not-found=true
Expand Down Expand Up @@ -642,7 +658,7 @@ fi

handle_badusage() {
echo ""
echo "Usage: $0 create-pull-secret|create-apikey-secret|install|create-instance|create-nfs-provisioner --help"
echo "Usage: $0 create-pull-secret|create-proxy-secrets|create-apikey-secret|install|create-instance|create-nfs-provisioner --help"
echo ""
exit 3
}
Expand All @@ -666,6 +682,17 @@ handle_pull_secret_usage() {
exit 0
}

handle_proxy_usage() {
echo ""
echo "Description: create a secret used for proxy urls and cacerts"
echo "Usage: $0 create-proxy-usage --namespace <namespace> --proxy <proxy_url> --proxy-cacert <cacert_location>"
echo "--namespace: the namespace to install the DataStage operator"
echo "--proxy: Specify the proxy url (eg. http://<username>:<password>@<proxy_ip>:<port>)"
echo "--proxy-cacert: Specify the absolute location of the custom CA store for the specified proxy - if it is using a self signed certificate"
echo "--zen-url: CP4D zen url. Specifying this will switch flow to cp4d. (required for cp4d)"
exit 0
}

handle_apikey_usage() {
echo ""
echo "Description: creates a secret with the api key for the remote engine to use when calling DataStage services"
Expand Down Expand Up @@ -925,6 +952,14 @@ do
shift
password="${1}"
;;
--proxy)
shift
proxy_url="${1}"
;;
--proxy-cacert)
shift
cacert_location="${1}"
;;
--project-id)
shift
projectId="${1}"
Expand Down Expand Up @@ -991,6 +1026,9 @@ do
create-pull-secret)
action="create-pull-secret"
;;
create-proxy-secrets)
action="create-proxy-secrets"
;;
create-apikey-secret)
action="create-apikey-secret"
;;
Expand Down Expand Up @@ -1046,6 +1084,9 @@ if [[ ! -z $dsdisplayHelp ]]; then
create-pull-secret)
handle_pull_secret_usage
;;
create-proxy-secrets)
handle_proxy_usage
;;
create-apikey-secret)
handle_apikey_usage
;;
Expand Down Expand Up @@ -1074,6 +1115,9 @@ install)
create-pull-secret)
create_pull_secret
;;
create-proxy-secrets)
create_proxy_secrets
;;
create-apikey-secret)
create_apikey_secret
;;
Expand All @@ -1097,6 +1141,7 @@ if [ ! -z $inputFile ]; then
create_nfs_provisioner
fi
create_pull_secret
create_proxy_secrets
create_apikey_secret
determine_registry
handle_action_install
Expand Down