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

Faster GCP Auto attach disk logic #128

Open
shaigbdb opened this issue May 22, 2024 · 0 comments
Open

Faster GCP Auto attach disk logic #128

shaigbdb opened this issue May 22, 2024 · 0 comments

Comments

@shaigbdb
Copy link
Contributor

shuffling the disks to check for an unattached volume wastes time.
We should try to have the syntax filter only the unattached disks and then wait for one to appear (looks like we're already doing this for AWS:

UNATTACHED_VOLUME_ID="$(aws ec2 describe-volumes --region $aws_region --filters Name=tag:ClusterName,Values=$es_cluster Name=tag:AutoAttachGroup,Values=$INSTANCE_ROLE Name=availability-zone,Values=$AV_ZONE | jq -r '.Volumes[] | select(.Attachments | length == 0) | .VolumeId' | shuf -n 1)"
)

If we can't filter, then we should iterate on the list of disks, and then get the list again in case a new disk has appeared.
https://github.com/BigDataBoutique/elasticsearch-cloud-deploy/blob/master/assets/scripts/aws/autoattach-disk.sh

UNATTACHED_VOLUME_ID="$(gcloud compute disks list --filter="zone=$GCP_ZONE AND labels.cluster-name=$es_cluster AND labels.auto-attach-group=$INSTANCE_ROLE" --format json | jq -r '.[] | .name' | shuf -n 1)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant