Getting most recent GKE security patch version available, with gcloud and yq 1.6
Getting most recent GKE security patch version available, with gcloud and yq 1.6
i don’t know why GCP makes this so frickin hard, but it does. querying their container API for available GKE security patch versions works pretty well at the surface if you are a human accustomed to clickops -
okay, so this is all helpful if i’m a human. but if i’m a robot, i probably don’t care about all the context like what’s going on in the various channels. let’s filter it down to only the NodeVersions:
furthermore, since i’m using this code in the context of automatically installing patches for my current minor version, i don’t care one whit about anything other than the minor Kubernetes version i’m working on, which happens to be 1.15 at the time of this writing. how do i filter out all the extras and just get the master and node versions for the minor.patch versions i’m working on?
well, that’s better, but it still returns a list of things i only want the most recent patch version for 1.15.12. so i pipe it to a head.
now, it still outputs little preamble about what zone it’s working in, but that’s fine for now.
for the record, i futzed with this for a couple of hours, trying to use jq. i just couldn’t get jq to parse the “list” that was returned. so that’s why i ended up going with yq on this.