mirror of https://github.com/rancher/ui.git
Merge pull request #2163 from loganhz/port
Support service node port range in cluster options
This commit is contained in:
commit
fa036dfbdd
|
|
@ -18,19 +18,24 @@ const protocolOptions = [
|
||||||
];
|
];
|
||||||
|
|
||||||
export default Component.extend({
|
export default Component.extend({
|
||||||
intl: service(),
|
intl: service(),
|
||||||
|
scope: service(),
|
||||||
|
|
||||||
layout,
|
layout,
|
||||||
initialPorts: null,
|
initialPorts: null,
|
||||||
editing: false,
|
editing: false,
|
||||||
kindChoices: null,
|
kindChoices: null,
|
||||||
|
|
||||||
ports: null,
|
ports: null,
|
||||||
|
nodePortFrom: null,
|
||||||
|
nodePortTo: null,
|
||||||
|
nodePortPlaceholder: null,
|
||||||
protocolOptions,
|
protocolOptions,
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
this._super(...arguments);
|
this._super(...arguments);
|
||||||
this.initPorts();
|
this.initPorts();
|
||||||
|
this.nodePortRangeDidChange();
|
||||||
this.initKindChoices();
|
this.initKindChoices();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -113,6 +118,38 @@ export default Component.extend({
|
||||||
this.set('errors', errors.uniq());
|
this.set('errors', errors.uniq());
|
||||||
this.sendAction('changed', ports.slice());
|
this.sendAction('changed', ports.slice());
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
nodePortRangeDidChange: observer('intl.locale', 'scope.currentCluster.rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange', function() {
|
||||||
|
const intl = get(this, 'intl');
|
||||||
|
const nodePortRange = get(this, 'scope.currentCluster.rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange')
|
||||||
|
|
||||||
|
if ( nodePortRange ) {
|
||||||
|
const ports = nodePortRange.split('-');
|
||||||
|
|
||||||
|
if ( ports.length === 2 ) {
|
||||||
|
const from = parseInt(ports[0], 10);
|
||||||
|
const to = parseInt(ports[1], 10);
|
||||||
|
|
||||||
|
setProperties(this, {
|
||||||
|
nodePortFrom: from,
|
||||||
|
nodePortTo: to,
|
||||||
|
nodePortPlaceholder: intl.t('formPorts.nodePort.customPortRangePlaceholder', {
|
||||||
|
range: nodePortRange,
|
||||||
|
port: from
|
||||||
|
})
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setProperties(this, {
|
||||||
|
nodePortFrom: 1,
|
||||||
|
nodePortTo: 65535,
|
||||||
|
nodePortPlaceholder: intl.t('formPorts.nodePort.placeholder')
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
|
||||||
initPorts() {
|
initPorts() {
|
||||||
let ports = get(this, 'initialPorts') || [];
|
let ports = get(this, 'initialPorts') || [];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
<td data-title="{{t 'formPorts.sourcePort.label'}}">
|
<td data-title="{{t 'formPorts.sourcePort.label'}}">
|
||||||
{{#if (or (eq port.kind "ClusterIP") (eq port.kind "NodePort"))}}
|
{{#if (or (eq port.kind "ClusterIP") (eq port.kind "NodePort"))}}
|
||||||
{{#if editing}}
|
{{#if editing}}
|
||||||
{{input-random-port min="1" max="65535" value=port.sourcePort placeholder="formPorts.nodePort.placeholder" standardKey=(if (eq port.kind "ClusterIP") "formPorts.sourcePort.clusterIpDefault" "generic.random")}}
|
{{input-random-port min=nodePortFrom max=nodePortTo value=port.sourcePort placeholder=nodePortPlaceholder standardKey=(if (eq port.kind "ClusterIP") "formPorts.sourcePort.clusterIpDefault" "generic.random")}}
|
||||||
{{else if port.sourcePort}}
|
{{else if port.sourcePort}}
|
||||||
{{port.sourcePort}}
|
{{port.sourcePort}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
{{#if showEdit}}
|
{{#if showEdit}}
|
||||||
{{input-integer class="form-control input-sm" min=min max=max value=value placeholder=(t placeholder)}}
|
{{input-integer class="form-control input-sm" min=min max=max value=value placeholder=placeholder}}
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="edit btn bg-transparent pl-0" {{action "showEdit"}}>{{t standardKey}} <i class="icon icon-edit"></i></div>
|
<div class="edit btn bg-transparent pl-0" {{action "showEdit"}}>{{t standardKey}} <i class="icon icon-edit"></i></div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
|
||||||
|
|
@ -200,8 +200,9 @@ export default InputTextFile.extend(ClusterDriver, {
|
||||||
services: globalStore.createRecord({
|
services: globalStore.createRecord({
|
||||||
type: 'rkeConfigServices',
|
type: 'rkeConfigServices',
|
||||||
kubeApi: globalStore.createRecord({
|
kubeApi: globalStore.createRecord({
|
||||||
type: 'kubeAPIService',
|
type: 'kubeAPIService',
|
||||||
podSecurityPolicy: false,
|
podSecurityPolicy: false,
|
||||||
|
serviceNodePortRange: '30000-32767',
|
||||||
}),
|
}),
|
||||||
etcd: globalStore.createRecord({
|
etcd: globalStore.createRecord({
|
||||||
type: 'etcdService',
|
type: 'etcdService',
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,17 @@
|
||||||
{{/if}}
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<div class="col span-4">
|
||||||
|
<label class="acc-label">{{t 'clusterNew.rke.serviceNodePortRange.label'}}</label>
|
||||||
|
{{input
|
||||||
|
type="text"
|
||||||
|
value=cluster.rancherKubernetesEngineConfig.services.kubeApi.serviceNodePortRange
|
||||||
|
className="form-control"
|
||||||
|
placeholder=(t 'clusterNew.rke.serviceNodePortRange.placeholder')
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col span-12">
|
<div class="col span-12">
|
||||||
{{cru-cloud-provider
|
{{cru-cloud-provider
|
||||||
|
|
|
||||||
|
|
@ -2070,6 +2070,9 @@ clusterNew:
|
||||||
auth:
|
auth:
|
||||||
label: Auth Provider
|
label: Auth Provider
|
||||||
x509: x509
|
x509: x509
|
||||||
|
serviceNodePortRange:
|
||||||
|
label: Node Port Range
|
||||||
|
placeholder: e.g. 30000-32767
|
||||||
network:
|
network:
|
||||||
label: Network Provider
|
label: Network Provider
|
||||||
flannel: Flannel
|
flannel: Flannel
|
||||||
|
|
@ -3609,7 +3612,8 @@ formPorts:
|
||||||
ipPlaceholder: "e.g. 80 or 19.82.2.24:80"
|
ipPlaceholder: "e.g. 80 or 19.82.2.24:80"
|
||||||
clusterIpDefault: "Same as container port"
|
clusterIpDefault: "Same as container port"
|
||||||
nodePort:
|
nodePort:
|
||||||
placeholder: "e.g. 30000"
|
placeholder: "Default node port range is 30000-32767, e.g. 30000"
|
||||||
|
customPortRangePlaceholder: "Node port range is {range}, e.g. {port}"
|
||||||
containerPort:
|
containerPort:
|
||||||
label: Publish the container port
|
label: Publish the container port
|
||||||
placeholder: "e.g. 8080"
|
placeholder: "e.g. 8080"
|
||||||
|
|
|
||||||
|
|
@ -2061,6 +2061,9 @@ clusterNew:
|
||||||
auth:
|
auth:
|
||||||
label: 认证提供者
|
label: 认证提供者
|
||||||
x509: x509
|
x509: x509
|
||||||
|
serviceNodePortRange:
|
||||||
|
label: Node Port范围
|
||||||
|
placeholder: '例如: 30000-32767'
|
||||||
network:
|
network:
|
||||||
label: 网络组件
|
label: 网络组件
|
||||||
flannel: Flannel
|
flannel: Flannel
|
||||||
|
|
@ -3600,7 +3603,8 @@ formPorts:
|
||||||
ipPlaceholder: '例如: 80或19.82.2.24:80'
|
ipPlaceholder: '例如: 80或19.82.2.24:80'
|
||||||
clusterIpDefault: '与容器端口相同'
|
clusterIpDefault: '与容器端口相同'
|
||||||
nodePort:
|
nodePort:
|
||||||
placeholder: '端口范围30000-32768,例如: 30000'
|
placeholder: '默认端口范围30000-32768,例如: 30000'
|
||||||
|
customPortRangePlaceholder: "端口范围{range},例如: {port}"
|
||||||
containerPort:
|
containerPort:
|
||||||
label: 容器端口
|
label: 容器端口
|
||||||
placeholder: "例如: 8080"
|
placeholder: "例如: 8080"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue