diff --git a/lib/shared/addon/components/cluster-driver/driver-rke/component.js b/lib/shared/addon/components/cluster-driver/driver-rke/component.js index ff9e0bca8..301da2fe1 100644 --- a/lib/shared/addon/components/cluster-driver/driver-rke/component.js +++ b/lib/shared/addon/components/cluster-driver/driver-rke/component.js @@ -587,36 +587,23 @@ export default InputTextFile.extend(ClusterDriver, { experimentalVersion: C.EXPERIMENTAL_VERSIONS.RKE_K8S, - willSave() { - if ( get(this, 'registry') === 'custom' ) { - const registry = { - url: get(this, 'registryUrl'), - user: get(this, 'registryUser'), - password: get(this, 'registryPass'), - } - - set(this, 'config.privateRegistries', [registry]); - } - - return this._super(...arguments); - }, - validate() { this._super(...arguments); let errors = get(this, 'errors') || []; + let config = get(this, `primaryResource.${ this.configField }`); if ( !get(this, 'isCustom') ) { errors.pushObjects(get(this, 'nodePoolErrors')); } - if ( get(this, 'config.services.kubeApi.podSecurityPolicy') && + if ( get(config, 'services.kubeApi.podSecurityPolicy') && !get(this, 'cluster.defaultPodSecurityPolicyTemplateId') ) { errors.push(get(this, 'intl').t('clusterNew.psp.required')); } - if (get(this, 'config.privateRegistries.length') >= 1) { - let hasDefault = get(this, 'config.privateRegistries').findBy('isDefault') || false; + if (get(config, 'privateRegistries.length') >= 1) { + let hasDefault = get(config, 'privateRegistries').findBy('isDefault') || false; if (!hasDefault) { errors.push(get(this, 'intl').t('cruPrivateRegistry.defaultError')); @@ -629,11 +616,11 @@ export default InputTextFile.extend(ClusterDriver, { const clusterOptErrors = get(this, 'clusterOptErrors') || []; - if ( get(this, 'config.cloudProvider.name') === 'azure' ) { + if ( get(config, 'cloudProvider.name') === 'azure' ) { const intl = get(this, 'intl'); Object.keys(AzureInfo).forEach((key) => { - if ( get(AzureInfo, `${ key }.required`) && !get(this, `config.cloudProvider.azureCloudProvider.${ key }`) ) { + if ( get(AzureInfo, `${ key }.required`) && !get(config, `cloudProvider.azureCloudProvider.${ key }`) ) { errors.push(intl.t('validation.required', { key })); } }); diff --git a/lib/shared/addon/components/cru-private-registry/component.js b/lib/shared/addon/components/cru-private-registry/component.js index 19c384603..e0ffa5ae2 100644 --- a/lib/shared/addon/components/cru-private-registry/component.js +++ b/lib/shared/addon/components/cru-private-registry/component.js @@ -69,7 +69,9 @@ export default Component.extend({ } }, removeRegistry(registry) { - get(this, 'privateRegistries').removeObject(registry); + let { privateRegistries } = this; + + set(this, 'config.privateRegistries', privateRegistries.removeObject(registry)); }, },