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;
}
const address = get(this, 'address');
const nodeName = get(this, 'nodeName');
const internalAddress = get(this, 'internalAddress');
const roles = ['etcd', 'controlplane', 'worker'];
const labels = get(this, 'labels') || {};
const taints = get(this, 'taints') || [];
const address = get(this, 'address');
const nodeName = get(this, 'nodeName');
const internalAddress = get(this, 'internalAddress');
const roles = ['etcd', 'controlplane', 'worker'];
const labels = get(this, 'labels') || {};
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 ) {
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') }`;
});
const windowsSelected = !get(this, 'isLinux')
if (windowsSelected) {
out = get(this, 'token.windowsNodeCommand') || ''
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($?)`)
}
out += windowsCmdPostfix
}
return out;

View File

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