Merge pull request #4700 from codyrancher/gke-versions-region

Making use of region instead of zone while querying meta/gkeVersion when available
This commit is contained in:
codyrancher 2021-07-07 20:50:26 -07:00 committed by GitHub
commit ea36d73a76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 6 deletions

View File

@ -229,7 +229,7 @@ export default Component.extend(ClusterDriver, {
set(this, 'config.projectId', this.google.parseProjectId(get(this, 'config')));
}),
zoneChanged: observer('config.zone', 'zones.[]', function() {
zoneChanged: observer('config.zone', 'zones.[]', 'locationType', 'config.region', function() {
if (this.saving) {
return;
}
@ -540,13 +540,17 @@ export default Component.extend(ClusterDriver, {
return;
}
const region = get(this, 'config.region');
const zone = region ? undefined : get(this, 'config.zone');
return get(this, 'globalStore').rawRequest({
url: '/meta/gkeVersions',
method: 'POST',
data: {
credentials: get(this, 'config.credential'),
projectId: get(this, 'config.projectId'),
zone: get(this, 'config.zone') || `${ get(this, 'config.region') }-b`,
zone,
region
}
}).then((xhr) => {
const out = xhr.body;

View File

@ -348,12 +348,11 @@ export default Service.extend({
}
const config = get(cluster, 'gkeConfig');
const zone = get(config, 'zone') || `${ get(config, 'region') }-b`;
const neuConfig = { ...config };
delete neuConfig.region;
set(neuConfig, 'zone', zone);
if (config.region && neuConfig.zone) {
delete neuConfig.zone;
}
const neuURL = this.parseRequestData('/meta/gkeVersions', neuConfig, cluster?.id);