mirror of https://github.com/rancher/ui.git
Merge pull request #2145 from loganhz/node-name
Add node name in advacned options when adding custom cluster
This commit is contained in:
commit
caf931e0ec
|
|
@ -7,6 +7,8 @@ import { satisfies } from 'shared/utils/parse-version';
|
|||
import { sortVersions } from 'shared/utils/sort';
|
||||
import { inject as service } from '@ember/service';
|
||||
import { underlineToCamel, removeEmpty, keysToCamel, validateEndpoint } from 'shared/utils/util';
|
||||
import { validateHostname } from 'ember-api-store/utils/validate';
|
||||
|
||||
import C from 'shared/utils/constants';
|
||||
import YAML from 'npm:yamljs';
|
||||
import json2yaml from 'npm:json2yaml';
|
||||
|
|
@ -84,6 +86,7 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
registryUser: null,
|
||||
registryPass: null,
|
||||
clusterOptErrors: null,
|
||||
nodeNameErrors: null,
|
||||
|
||||
existingNodes: null,
|
||||
initialNodeCounts: null,
|
||||
|
|
@ -259,6 +262,18 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
});
|
||||
}),
|
||||
|
||||
isNodeNameValid: computed('nodeName', function() {
|
||||
if ( get(this, 'nodeName') === undefined || get(this, 'nodeName.length') === 0 ) {
|
||||
return true;
|
||||
} else {
|
||||
const errors = validateHostname(get(this, 'nodeName'), 'Node Name', get(this, 'intl'));
|
||||
|
||||
set(this, 'nodeNameErrors', errors);
|
||||
|
||||
return errors.length === 0;
|
||||
}
|
||||
}),
|
||||
|
||||
isAddressValid: computed('address', function() {
|
||||
return get(this, 'address') === undefined || get(this, 'address.length') === 0 || validateEndpoint(get(this, 'address'));
|
||||
}),
|
||||
|
|
@ -280,7 +295,7 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
return cur - orig;
|
||||
}),
|
||||
|
||||
command: computed('labels', 'token.nodeCommand', 'etcd', 'controlplane', 'worker', 'address', 'internalAddress', function() {
|
||||
command: computed('labels', 'token.nodeCommand', 'etcd', 'controlplane', 'worker', 'address', 'internalAddress', 'nodeName', function() {
|
||||
let out = get(this, 'token.nodeCommand');
|
||||
|
||||
if ( !out ) {
|
||||
|
|
@ -288,10 +303,15 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
}
|
||||
|
||||
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') || {};
|
||||
|
||||
if ( nodeName ) {
|
||||
out += ` --node-name ${ nodeName }`;
|
||||
}
|
||||
|
||||
if (address) {
|
||||
out += ` --address ${ address }`;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,6 +258,22 @@
|
|||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row mt-20">
|
||||
{{t 'clusterNew.rke.nodeName.title'}}
|
||||
<p class="help-block">{{t 'clusterNew.rke.nodeName.detail'}}</p>
|
||||
<ul class="list-unstyled">
|
||||
<li>
|
||||
<div class="row">
|
||||
<div class="col span-6">
|
||||
{{input type="text" value=nodeName placeholder=(t 'clusterNew.rke.nodeName.placeholder')}}
|
||||
{{#unless isNodeNameValid}}
|
||||
{{top-errors errors=nodeNameErrors}}
|
||||
{{/unless}}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="row mt-20">
|
||||
{{t 'clusterNew.rke.labels.title'}}
|
||||
<p class="help-block">{{t 'clusterNew.rke.labels.detail'}}</p>
|
||||
|
|
|
|||
|
|
@ -2021,6 +2021,10 @@ clusterNew:
|
|||
election:
|
||||
label: etcd Election Timeout
|
||||
placeholder: Time for an election to timeout
|
||||
nodeName:
|
||||
title: Node Name
|
||||
detail: Optionally configure the node name as identification instead of the actual hostname
|
||||
placeholder: e.g. my-worker-node
|
||||
address:
|
||||
title: Node Address
|
||||
detail: Optionally configure the public address and internal address for machines
|
||||
|
|
|
|||
Loading…
Reference in New Issue