diff --git a/lib/shared/addon/components/cluster-driver/driver-azureaks/component.js b/lib/shared/addon/components/cluster-driver/driver-azureaks/component.js index 932694612..d5872c222 100644 --- a/lib/shared/addon/components/cluster-driver/driver-azureaks/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-azureaks/component.js @@ -16,6 +16,8 @@ import { } from 'ui/utils/azure-choices'; const NETWORK_POLICY = ['Calico'] +const CHINA_REGION_API_URL = 'https://management.chinacloudapi.cn/'; +const CHINA_REGION_AUTH_URL = 'https://login.chinacloudapi.cn/'; export default Component.extend(ClusterDriver, { globalStore: service(), @@ -80,6 +82,14 @@ export default Component.extend(ClusterDriver, { tenantId: get(this, 'config.tenantId'), region: get(this, 'config.location') }; + + if ( get(this, 'isChinaRegion') ) { + setProperties(data, { + baseUrl: CHINA_REGION_API_URL, + authBaseUrl: CHINA_REGION_AUTH_URL + }) + } + const aksRequest = { versions: store.rawRequest({ url: '/meta/aksVersions', @@ -183,6 +193,10 @@ export default Component.extend(ClusterDriver, { return ( get(this, 'mode') === 'edit' || get(this, 'mode') === 'new' ) ? true : false; }), + isChinaRegion: computed('config.location', function() { + return get(this, 'config.location').startsWith('china'); + }), + saveDisabled: computed('config.subscriptionId', 'config.tenantId', 'config.clientId', 'config.clientSecret', 'config.location', function() { return get(this, 'config.tenantId') && get(this, 'config.clientId') && get(this, 'config.clientSecret') && get(this, 'config.subscriptionId') && get(this, 'config.location') ? false : true; }), @@ -295,6 +309,16 @@ export default Component.extend(ClusterDriver, { }) } + if ( get(this, 'isChinaRegion') ) { + setProperties(config, { + baseUrl: CHINA_REGION_API_URL, + authBaseUrl: CHINA_REGION_AUTH_URL + }) + } else { + delete config['baseUrl']; + delete config['authBaseUrl']; + } + return this._super(...arguments); }, }); diff --git a/lib/shared/addon/components/cluster-driver/driver-azureaks/template.hbs b/lib/shared/addon/components/cluster-driver/driver-azureaks/template.hbs index 95c4f292f..b0a05d836 100644 --- a/lib/shared/addon/components/cluster-driver/driver-azureaks/template.hbs +++ b/lib/shared/addon/components/cluster-driver/driver-azureaks/template.hbs @@ -163,27 +163,29 @@
-
- -
- -
+ {{/unless}}