Fix [Windows] Unable to set windows node advanced options

https://github.com/rancher/rancher/issues/22059
This commit is contained in:
n313893254 2019-08-22 13:45:31 +08:00
parent a353a21a58
commit ef6ac0189a
2 changed files with 22 additions and 48 deletions

View File

@ -677,12 +677,18 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
return; return;
} }
const address = get(this, 'address'); const address = get(this, 'address');
const nodeName = get(this, 'nodeName'); const nodeName = get(this, 'nodeName');
const internalAddress = get(this, 'internalAddress'); const internalAddress = get(this, 'internalAddress');
const roles = ['etcd', 'controlplane', 'worker']; const roles = ['etcd', 'controlplane', 'worker'];
const labels = get(this, 'labels') || {}; const labels = get(this, 'labels') || {};
const taints = get(this, 'taints') || []; const taints = get(this, 'taints') || [];
const windowsSelected = !get(this, 'isLinux')
const windowsCmdPostfix = ' | iex}"';
if (windowsSelected) {
out = (get(this, 'token.windowsNodeCommand') || '').replace('--isolation hyperv ', '').replace(windowsCmdPostfix, '')
}
if ( nodeName ) { if ( nodeName ) {
out += ` --node-name ${ nodeName.toLowerCase() }`; out += ` --node-name ${ nodeName.toLowerCase() }`;
@ -712,40 +718,8 @@ export default InputTextFile.extend(ManageLabels, ClusterDriver, {
out += ` --taints ${ get(taint, 'key') }=${ get(taint, 'value') }:${ get(taint, 'effect') }`; out += ` --taints ${ get(taint, 'key') }=${ get(taint, 'value') }:${ get(taint, 'effect') }`;
}); });
const windowsSelected = !get(this, 'isLinux')
if (windowsSelected) { if (windowsSelected) {
out = get(this, 'token.windowsNodeCommand') || '' out += windowsCmdPostfix
out = out.replace('--isolation hyperv ', '')
let addressCmd = ''
if ( nodeName ) {
addressCmd += ` -nodeName ${ nodeName.toLowerCase() }`;
}
if (address) {
addressCmd += ` -address ${ address }`
}
if (internalAddress) {
addressCmd += ` -internalAddress ${ internalAddress }`
}
const labelKeys = Object.keys(labels);
if ( get(labelKeys, 'length') > 0 ) {
addressCmd += ` -label `;
const labelArray = [];
labelKeys.forEach((key) => {
labelArray.push(`${ key }=${ labels[key] }`);
});
addressCmd += `${ labelArray.join(',') }`;
}
if (addressCmd) {
out = out.replace(`; if($?)`, `${ addressCmd }; if($?)`)
}
} }
return out; return out;

View File

@ -1171,15 +1171,15 @@
</button> </button>
{{/form-user-labels}} {{/form-user-labels}}
{{#unless cluster.windowsPreferedCluster}} <div class="row mt-20 mb-20">
<div class="row mt-20 mb-20"> {{t "clusterNew.rke.taints.title"}}
{{t "clusterNew.rke.taints.title"}} <p class="help-block">
<p class="help-block"> {{t "clusterNew.rke.taints.detail"}}
{{t "clusterNew.rke.taints.detail"}} </p>
</p> {{node-taints
{{node-taints setTaints=(action "setTaints")}} setTaints=(action "setTaints")
</div> }}
{{/unless}} </div>
</li> </li>
</ul> </ul>
</div> </div>