Advanced Clusters > Command reference > delete-clusters.sh
  

delete-clusters.sh

Deletes clusters in a staging directory.
The command uses the following options:
-h | -help

-d | -staging-dir=<cluster-bucket-location-without-prefix-s3://> (AWS environment) or <staging-location-with-prefix-abfs[s]://> (Azure environment)

-azsrg | -azure-storage-resource-group

-s | -deletable-states=state-1[,state-2,...]

-c | -clusters=cluster1[,cluster2,...]

-f | -force

-ac | -azurecpath=azcredfilepath

-ct | -cluster-type
The following table describes each option:
Option
Description
-help
-h
Access the help for the command.
-staging-dir
-d
Staging directory that is configured in the advanced configurations for the clusters.
Use one of the following formats based on your cloud platform:
  • - AWS. -staging-dir=<bucket name>/<folder name>.
  • The directory must include at least the bucket name. Do not include the prefix s3://.
  • - Microsoft Azure. -staging-dir=abfs(s)://<file system>@<storage account>.dfs.core.windows.net/<folder path>
  • Specify the ABFSS protocol if encryption is enabled on the storage location.
-azsrg
-azure-storage-resource-group
Storage resource group that holds the staging storage account and is configured in the advanced configurations for the clusters.
-deletable-states
-s
Comma-separated list of cluster states. If the state of a cluster matches one of the listed states, the cluster is deleted.
You can list any of the following states:
  • - Deleted. Deletes clusters that are not using any resources on the cloud. In an AWS environment, the remaining information that is stored on the cloud is historical metadata on Amazon S3. The command wipes cluster storage and deletes the cluster state, creation history, and staging directories.
  • - Metadata-only. Deletes clusters that have not started. In an AWS environment, the command deletes only the Kubernetes state store for the cluster.
  • - Partial. Deletes clusters that failed to be started, or clusters that were started but were not stopped completely. In an AWS environment, the command runs the Kubernetes delete command to delete the cloud resources that were provisioned for the cluster.
  • - In-use. Deletes clusters that are highly-likely to have virtual machines running, but the clusters might not have running jobs. In an AWS environment, the command runs the Kubernetes delete command to delete the cloud resources that were provisioned for the cluster.
  • - All. Deletes clusters with any of the above states.
In a Microsoft Azure environment, deleting a cluster removes all cluster information from the staging directory.
For example, use -deletable-states=metadata-only,partial to delete clusters that have not started and clusters that failed to start.
To delete clusters with all of these states, use -deletable-states=all.
-clusters
-c
Comma-separated list of clusters that you want the command to examine.
For example, you might have a development environment and a test environment that use the same staging directory. You want to delete clusters with the states partial and in-use that are in the test environment but not the development environment. To delete clusters only from the test environment, list the clusters that are in the test environment.
-force
-f
Skip additional prompts.
If you do not use the -force option, the command lists each advanced cluster and prompts you to confirm that you want to delete the cluster. You can enter Yes or No.
If you use the -force option, the clusters are deleted automatically.
-azurecpath
-ac
Location of the Azure credentials file on the Secure Agent machine which contains APPID, TENANTID, SERVICE PRINCIPAL, SUBSCRIPTION. Not applicable in an AWS environment.
Note: Scripts that contain this option will fail. Use this option in a Microsoft Azure environment only if instructed by Informatica Global Customer Support.
-cluster-type
-ct
Cluster type for advanced clusters in an AWS environment or local clusters in an AWS or Microsoft Azure environment. You can specify local, kubeadm, or kops. By default, the command runs on clusters that are managed by kubeadm. Not applicable in an Azure environment.
For example, the following command examines certain clusters in the staging directory autodeploy/devbld and deletes the clusters that have the status deleted, metadata-only, or in-use:
delete-clusters.sh -d=autodeploy/devbld -deletable-states=deleted,metadata-only,in-use -c=testcluster.k8s.local,testcluster.k8s.local,testcluster2.k8s.local,testcluster3.k8s.local,testcluster4.k8s.local