mirror of https://github.com/rancher/ui.git
commit
cfd4dfa03f
|
|
@ -102,7 +102,7 @@ export const DEFAULT_GKE_CONFIG = {
|
|||
clusterAddons: {
|
||||
horizontalPodAutoscaling: true,
|
||||
httpLoadBalancing: true,
|
||||
networkPolicyConfig: true
|
||||
networkPolicyConfig: false
|
||||
},
|
||||
clusterIpv4Cidr: null,
|
||||
clusterName: null,
|
||||
|
|
|
|||
|
|
@ -365,9 +365,17 @@ export default Component.extend(ViewNewEdit, {
|
|||
},
|
||||
|
||||
fetchZones() {
|
||||
const credentials = get(this, 'config.authEncodedJson');
|
||||
const config = JSON.parse(credentials || '{}');
|
||||
const { project_id: projectId } = config;
|
||||
let credentials = null;
|
||||
let config = null;
|
||||
let projectId = null;
|
||||
|
||||
try {
|
||||
credentials = get(this, 'config.authEncodedJson');
|
||||
config = JSON.parse(credentials || '{}');
|
||||
projectId = get(config, 'project_id');
|
||||
} catch (error) {
|
||||
return Promise.reject({ message: 'Invalid JSON' });
|
||||
}
|
||||
|
||||
return get(this, 'globalStore').rawRequest({
|
||||
url: '/meta/gkeZones',
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ export default Component.extend(ClusterDriver, {
|
|||
}
|
||||
}),
|
||||
|
||||
clusterSecondaryRangeNameChanged: observer('config.ipAllocationPolicy.clusterSecondaryRangeName', function() {
|
||||
clusterSecondaryRangeNameChanged: observer('config.ipAllocationPolicy.clusterSecondaryRangeName', 'secondaryIpRangeContent.[]', function() {
|
||||
if (this.isDestroyed || this.isDestroying || this.saving) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -277,22 +277,6 @@ export default Component.extend(ClusterDriver, {
|
|||
'config.ipAllocationPolicy.subnetworkName': null,
|
||||
'config.ipAllocationPolicy.nodeIpv4CidrBlock': null,
|
||||
});
|
||||
|
||||
const secondaryIpRangeContent = get(this, 'secondaryIpRangeContent') || []
|
||||
|
||||
if (secondaryIpRangeContent.length > 0) {
|
||||
const value = secondaryIpRangeContent[0] && secondaryIpRangeContent[0].value
|
||||
|
||||
setProperties(this, {
|
||||
'config.ipAllocationPolicy.clusterSecondaryRangeName': value,
|
||||
'config.ipAllocationPolicy.servicesSecondaryRangeName': value,
|
||||
});
|
||||
} else {
|
||||
setProperties(this, {
|
||||
'config.ipAllocationPolicy.clusterSecondaryRangeName': null,
|
||||
'config.ipAllocationPolicy.servicesSecondaryRangeName': null,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
setProperties(this, {
|
||||
'config.subnetwork': '',
|
||||
|
|
@ -303,7 +287,7 @@ export default Component.extend(ClusterDriver, {
|
|||
}
|
||||
}),
|
||||
|
||||
servicesSecondaryRangeNameChanged: observer('config.ipAllocationPolicy.servicesSecondaryRangeName', function() {
|
||||
servicesSecondaryRangeNameChanged: observer('config.ipAllocationPolicy.servicesSecondaryRangeName', 'secondaryIpRangeContent.[]', function() {
|
||||
if (this.isDestroyed || this.isDestroying || this.saving) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -321,7 +305,7 @@ export default Component.extend(ClusterDriver, {
|
|||
}
|
||||
}),
|
||||
|
||||
secondaryIpRangeContentChange: observer('secondaryIpRangeContent.[]', 'config.ipAllocationPolicy.useIpAliases', function() {
|
||||
secondaryIpRangeContentChange: observer('secondaryIpRangeContent.[]', 'config.ipAllocationPolicy.useIpAliases', 'config.{network,subnetwork}', function() {
|
||||
if (this.isDestroyed || this.isDestroying || this.saving) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -476,12 +460,12 @@ export default Component.extend(ClusterDriver, {
|
|||
return merged;
|
||||
}),
|
||||
|
||||
secondaryIpRangeContent: computed('subNetworkContent.[]', 'config.network', function() {
|
||||
const { subNetworkContent = [], config: { network } } = this;
|
||||
const subNetwork = subNetworkContent.findBy('networkDisplayName', network);
|
||||
secondaryIpRangeContent: computed('subNetworkContent.[]', 'config.{network,subnetwork}', function() {
|
||||
const { subNetworkContent = [], config: { subnetwork } } = this;
|
||||
const subnetworkMatch = subNetworkContent.findBy('value', subnetwork);
|
||||
|
||||
if (subNetwork) {
|
||||
const { secondaryIpRanges = [] } = subNetwork;
|
||||
if (subnetworkMatch) {
|
||||
const { secondaryIpRanges = [] } = subnetworkMatch;
|
||||
|
||||
return secondaryIpRanges.map((s) => {
|
||||
return {
|
||||
|
|
@ -598,8 +582,26 @@ export default Component.extend(ClusterDriver, {
|
|||
return neu;
|
||||
},
|
||||
|
||||
validatePrivateConfig() {
|
||||
const config = get(this, 'config') || {}
|
||||
const { privateClusterConfig } = config;
|
||||
|
||||
if (isEmpty(privateClusterConfig)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (privateClusterConfig?.enablePrivateNodes && isEmpty(privateClusterConfig?.masterIpv4CidrBlock)) {
|
||||
this.send('errorHandler', this.intl.t('clusterNew.googlegke.masterIpv4CidrBlock.error'));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
willSave() {
|
||||
this.validateNodePools();
|
||||
this.validatePrivateConfig();
|
||||
|
||||
if (!isEmpty(this.errors)) {
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -456,12 +456,12 @@ export default Component.extend(ClusterDriver, {
|
|||
return [...defaultSubnetAry, ...mappedSubnets];
|
||||
}),
|
||||
|
||||
secondaryIpRangeContent: computed('subNetworkContent.[]', 'config.network', function() {
|
||||
const { subNetworkContent = [], config: { network } } = this;
|
||||
const subNetwork = subNetworkContent.findBy('networkDisplayName', network);
|
||||
secondaryIpRangeContent: computed('subNetworkContent.[]', 'config.{network,subNetwork}', function() {
|
||||
const { subNetworkContent = [], config: { subNetwork } } = this;
|
||||
const subNetworkMatch = subNetworkContent.findBy('value', subNetwork);
|
||||
|
||||
if (subNetwork) {
|
||||
const { secondaryIpRanges = [] } = subNetwork;
|
||||
if (subNetworkMatch) {
|
||||
const { secondaryIpRanges = [] } = subNetworkMatch;
|
||||
|
||||
return secondaryIpRanges.map((s) => {
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -158,7 +158,15 @@ export default Component.extend(ClusterDriver, {
|
|||
},
|
||||
},
|
||||
|
||||
locationOrZoneChanged: observer('locationType', 'config.{region,zone}', function() {
|
||||
regionOrZoneChanged: observer('config.{region,zone}', function() {
|
||||
next(this, () => {
|
||||
if (this.step > 2) {
|
||||
this.send('loadClusters');
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
||||
locationTypeChanged: observer('locationType', function() {
|
||||
const { config, locationType } = this;
|
||||
|
||||
if (locationType === 'zonal') {
|
||||
|
|
@ -167,20 +175,12 @@ export default Component.extend(ClusterDriver, {
|
|||
}
|
||||
|
||||
set(this, 'config.zone', 'us-west2-a');
|
||||
|
||||
if (!isEmpty(config?.zone)) {
|
||||
this.send('loadClusters');
|
||||
}
|
||||
} else {
|
||||
if (!isEmpty(get(config, 'zone'))) {
|
||||
delete this.config.zone;
|
||||
}
|
||||
|
||||
set(this, 'config.region', 'us-west2');
|
||||
|
||||
if (!isEmpty(config?.region)) {
|
||||
this.send('loadClusters');
|
||||
}
|
||||
}
|
||||
}),
|
||||
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@
|
|||
@optionLabelPath="name"
|
||||
@optionValuePath="name"
|
||||
@prompt="clusterNew.googlegke.zone.prompt"
|
||||
@value={{config.zone}}
|
||||
@value={{mut config.zone}}
|
||||
/>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,9 @@
|
|||
<div class="col span-6">
|
||||
<label class="acc-label">
|
||||
{{t "clusterNew.googlegke.masterIpv4CidrBlock.label"}}
|
||||
{{#if config.enablePrivateNodes}}
|
||||
<FieldRequired />
|
||||
{{/if}}
|
||||
</label>
|
||||
{{input
|
||||
value=config.masterIpv4CidrBlock
|
||||
|
|
|
|||
|
|
@ -3841,9 +3841,10 @@ clusterNew:
|
|||
label: Master Authorized Network CIDR Blocks
|
||||
placeholder: Your Master Authorized Network CIDR Blocks
|
||||
masterIpv4CidrBlock:
|
||||
label: Master IP CIDR Block
|
||||
label: Master IPV4 CIDR Block
|
||||
placeholder: e.g. 10.42.0.0/28
|
||||
help: Master CIDR block size must be /28
|
||||
error: A Master IPV4 CIDR block is required when creating a private cluster
|
||||
masterVersion:
|
||||
label: Kubernetes Version
|
||||
prompt: Choose a Version...
|
||||
|
|
|
|||
Loading…
Reference in New Issue