diff --git a/cmd/image/import/import.go b/cmd/image/import/import.go index 84fcc953..2ca7c91b 100644 --- a/cmd/image/import/import.go +++ b/cmd/image/import/import.go @@ -116,7 +116,7 @@ var Cmd = &cobra.Command{ pvsadm image import --help for information # Set the API key or feed the --api-key commandline argument -export IBMCLOUD_API_KEY= +export IBMCLOUD_APIKEY= # To Import the image across the two different IBM account use "--accesskey" and "--secretkey" options diff --git a/cmd/image/sync/sync.go b/cmd/image/sync/sync.go index 9b5a1b17..d6b2d018 100644 --- a/cmd/image/sync/sync.go +++ b/cmd/image/sync/sync.go @@ -212,7 +212,7 @@ var Cmd = &cobra.Command{ pvsadm image sync --help for information # Set the API key or feed the --api-key commandline argument -export IBMCLOUD_API_KEY= +export IBMCLOUD_APIKEY= Examples: diff --git a/cmd/image/upload/upload.go b/cmd/image/upload/upload.go index 97181804..2e55c299 100644 --- a/cmd/image/upload/upload.go +++ b/cmd/image/upload/upload.go @@ -41,7 +41,7 @@ var Cmd = &cobra.Command{ pvsadm image upload --help for information # Set the API key or feed the --api-key commandline argument -export IBMCLOUD_API_KEY= +export IBMCLOUD_APIKEY= Examples: diff --git a/cmd/purge/purge.go b/cmd/purge/purge.go index 50bb983c..0b675d71 100644 --- a/cmd/purge/purge.go +++ b/cmd/purge/purge.go @@ -34,7 +34,7 @@ var Cmd = &cobra.Command{ Long: `Purge the PowerVS resources # Set the API key or feed the --api-key commandline argument -export IBMCLOUD_API_KEY= +export IBMCLOUD_APIKEY= Examples: # Delete all the virtual machines which are created before 4hrs diff --git a/cmd/root.go b/cmd/root.go index a341c45b..237b4086 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -46,9 +46,7 @@ Integrated with the IBM Cloud platform for on-demand provisioning. This is a tool built for the Power Systems Virtual Server helps managing and maintaining the resources easily`, PersistentPreRunE: func(cmd *cobra.Command, args []string) error { if pkg.Options.APIKey == "" { - // TODO : deprecate IBMCLOUD_API_KEY for IBMCLOUD_APIKEY - // The GetAuthenticatorFromEnvironment requires "IBMCLOUD_APIKEY" to be set, apart from IBMCLOUD_API_KEY used in the project. - // In order to use the resourcecontrollerv2's functionality, the IBMCLOUD_API_KEY is re-exported as IBMCLOUD_APIKEY. + // The GetAuthenticatorFromEnvironment requires "IBMCLOUD_APIKEY" to be set. // Ref: github.com/ibm/go-sdk-core/v5@v5.17.2/core/config_utils.go, which is available from either from a credentials file, environment or VCAP service. if pkg.Options.APIKey = os.Getenv("IBMCLOUD_API_KEY"); pkg.Options.APIKey != "" { klog.Warning("IBMCLOUD_API_KEY will be deprecated in future releases. Use IBMCLOUD_APIKEY instead.") diff --git a/docs/How to Import Image to PowerVS Instance.md b/docs/How to Import Image to PowerVS Instance.md index df69aa78..de008e7e 100644 --- a/docs/How to Import Image to PowerVS Instance.md +++ b/docs/How to Import Image to PowerVS Instance.md @@ -3,7 +3,7 @@ This guide talks about how to import image to PowerVS workspace using pvsadm. # Prerequisite - pvsadm tool -- IBMCLOUD_API_KEY. [How to create API key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key) +- IBMCLOUD_APIKEY. [How to create API key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key) - S3 BucketName, Bucket Region, ObjectName - PowerVS Workspace Name/PowerVS Workspace ID. @@ -30,7 +30,7 @@ Flags: Set the API key variable ```shell -$export IBMCLOUD_API_KEY= +$export IBMCLOUD_APIKEY= ``` ### case 1: diff --git a/docs/How to Upload Image to COS.md b/docs/How to Upload Image to COS.md index d6359a33..3a5a567a 100644 --- a/docs/How to Upload Image to COS.md +++ b/docs/How to Upload Image to COS.md @@ -4,7 +4,7 @@ This guide talks about how to upload image file to Cloud object Storage instance # Prerequisite - pvsadm tool - Image file(RHEL/CENTOS/CoreOS) -- IBMCLOUD_API_KEY. [How to create api key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key) +- IBMCLOUD_APIKEY. [How to create api key](https://cloud.ibm.com/docs/account?topic=account-userapikey#create_user_key) # Image upload command help: ```shell diff --git a/pkg/client/s3client.go b/pkg/client/s3client.go index 955ba871..7c443f56 100644 --- a/pkg/client/s3client.go +++ b/pkg/client/s3client.go @@ -99,7 +99,7 @@ func NewS3Client(c *Client, instanceName, region string) (s3client *S3Client, er } if pkg.Options.APIKey == "" { - s3client.ApiKey = os.Getenv("IBMCLOUD_API_KEY") + s3client.ApiKey = os.Getenv("IBMCLOUD_APIKEY") } else { s3client.ApiKey = pkg.Options.APIKey } diff --git a/samples/convert-upload-images-powervs/convert-upload-images-powervs b/samples/convert-upload-images-powervs/convert-upload-images-powervs index 554fb430..c2bc9686 100755 --- a/samples/convert-upload-images-powervs/convert-upload-images-powervs +++ b/samples/convert-upload-images-powervs/convert-upload-images-powervs @@ -128,9 +128,9 @@ function variables { rm -f "$VAR_TEMPLATE" "$VAR_FILE" debug_switch - [ "${IBMCLOUD_API_KEY}" == "" ] && error "Please export IBMCLOUD_API_KEY" - log "Trying to login with the provided IBMCLOUD_API_KEY..." - $CLI_PATH login --apikey "$IBMCLOUD_API_KEY" -q --no-region > /dev/null + [ "${IBMCLOUD_APIKEY}" == "" ] && error "Please export IBMCLOUD_APIKEY" + log "Trying to login with the provided IBMCLOUD_APIKEY..." + $CLI_PATH login --apikey "$IBMCLOUD_APIKEY" -q --no-region > /dev/null debug_switch service_instance=$SERVICE_NAME @@ -427,7 +427,7 @@ function upload_image_remote { for i in $(seq 1 "$NO_OF_RETRY"); do echo "Attempt: $i/$NO_OF_RETRY" LOG_FILE="logs/upload_image_remote_${i}_${LOGFILE}.log" - ssh -o 'StrictHostKeyChecking no' -o 'ServerAliveInterval 60' -o 'ServerAliveCountMax 10' -i $VAR_PRIVATE_KEY_FILE root@${BASTION_PUBLIC_IP} "cd \"$REMOTE_TEMP_DIR\"; pvsadm image upload --api-key \"$IBMCLOUD_API_KEY\" --bucket \"$cos_bucket_name\" --file \"$image_name\" --bucket-region \"$cos_region_name\" 2>&1" > $LOG_FILE || true + ssh -o 'StrictHostKeyChecking no' -o 'ServerAliveInterval 60' -o 'ServerAliveCountMax 10' -i $VAR_PRIVATE_KEY_FILE root@${BASTION_PUBLIC_IP} "cd \"$REMOTE_TEMP_DIR\"; pvsadm image upload --api-key \"$IBMCLOUD_APIKEY\" --bucket \"$cos_bucket_name\" --file \"$image_name\" --bucket-region \"$cos_region_name\" 2>&1" > $LOG_FILE || true if grep -c "object already exists in the $cos_bucket_name bucket" "$LOG_FILE" >/dev/null; then warn "$image_name object already exists in the $cos_bucket_name bucket. Skipping upload" time_taken "$message" @@ -493,7 +493,7 @@ function import_image_remote { for i in $(seq 1 "$NO_OF_RETRY"); do echo "Attempt: $i/$NO_OF_RETRY" LOG_FILE="logs/import_image_remote_${service_name}_${i}_${LOGFILE}.log" - import_cmd="cd \"$REMOTE_TEMP_DIR\"; pvsadm image import --workspace-name \"$service_name\" --bucket \"$cos_bucket_name\" --bucket-region \"$cos_bucket_region\" --object \"$object_name\" --pvs-image-name \"$image_name\" --api-key \"$IBMCLOUD_API_KEY\" -w --watch-timeout 2h " + import_cmd="cd \"$REMOTE_TEMP_DIR\"; pvsadm image import --workspace-name \"$service_name\" --bucket \"$cos_bucket_name\" --bucket-region \"$cos_bucket_region\" --object \"$object_name\" --pvs-image-name \"$image_name\" --api-key \"$IBMCLOUD_APIKEY\" -w --watch-timeout 2h " if [ -n "${access_key}" ] && [ -n "${secret_key}" ] ; then import_cmd+="--accesskey \"$access_key\" --secretkey \"$secret_key\" " fi diff --git a/samples/image-create-and-upload-sample/image_create_and_upload_script.sh b/samples/image-create-and-upload-sample/image_create_and_upload_script.sh index 4de7432c..feaf29f6 100644 --- a/samples/image-create-and-upload-sample/image_create_and_upload_script.sh +++ b/samples/image-create-and-upload-sample/image_create_and_upload_script.sh @@ -65,7 +65,7 @@ function create_and_upload_image() { dnf install -y qemu-img cloud-utils-growpart echo 'Initializing pvsadm tool !' curl -sL https://raw.githubusercontent.com/ppc64le-cloud/pvsadm/main/get.sh | FORCE=1 bash -export IBMCLOUD_API_KEY=$API_KEY +export IBMCLOUD_APIKEY=$API_KEY if [ -n "$CENTOS_URL" ]; then create_and_upload_image $CENTOS_URL diff --git a/test/e2e/qcow2ova/qcow2ova.go b/test/e2e/qcow2ova/qcow2ova.go index 7ae6524e..90786383 100644 --- a/test/e2e/qcow2ova/qcow2ova.go +++ b/test/e2e/qcow2ova/qcow2ova.go @@ -36,7 +36,7 @@ var _ = CMDDescribe("pvsadm qcow2ova tests", func() { BeforeSuite(func() { var err error - Expect(os.Getenv("IBMCLOUD_API_KEY")).NotTo(BeEmpty(), "IBMCLOUD_API_KEY must be set before running \"make test\"") + Expect(os.Getenv("IBMCLOUD_APIKEY")).NotTo(BeEmpty(), "IBMCLOUD_APIKEY must be set before running \"make test\"") image, err = os.CreateTemp("", "qcow2ova") Expect(err).NotTo(HaveOccurred()) _, err = image.WriteString("some dummy image") diff --git a/test/e2e/sync/sync.go b/test/e2e/sync/sync.go index cc4e5118..954f036b 100644 --- a/test/e2e/sync/sync.go +++ b/test/e2e/sync/sync.go @@ -43,7 +43,7 @@ var ( err error s3client *client.Client serviceInstance *resourcecontrollerv2.ResourceInstance - APIKey = os.Getenv("IBMCLOUD_API_KEY") + APIKey = os.Getenv("IBMCLOUD_APIKEY") objectsFolderName = "tempFolder" SpecFileName = "spec/spec.yaml" )