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({
|
||||
intl: service(),
|
||||
intl: service(),
|
||||
scope: service(),
|
||||
|
||||
layout,
|
||||
initialPorts: null,
|
||||
editing: false,
|
||||
kindChoices: null,
|
||||
|
||||
ports: null,
|
||||
ports: null,
|
||||
nodePortFrom: null,
|
||||
nodePortTo: null,
|
||||
nodePortPlaceholder: null,
|
||||
protocolOptions,
|
||||
|
||||
init() {
|
||||
this._super(...arguments);
|
||||
this.initPorts();
|
||||
this.nodePortRangeDidChange();
|
||||
this.initKindChoices();
|
||||
},
|
||||
|
||||
|
|
@ -113,6 +118,38 @@ export default Component.extend({
|
|||
this.set('errors', errors.uniq());
|
||||
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() {
|
||||
let ports = get(this, 'initialPorts') || [];
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@
|
|||
<td data-title="{{t 'formPorts.sourcePort.label'}}">
|
||||
{{#if (or (eq port.kind "ClusterIP") (eq port.kind "NodePort"))}}
|
||||
{{#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}}
|
||||
{{port.sourcePort}}
|
||||
{{else}}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
{{#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}}
|
||||
<div class="edit btn bg-transparent pl-0" {{action "showEdit"}}>{{t standardKey}} <i class="icon icon-edit"></i></div>
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -200,8 +200,9 @@ export default InputTextFile.extend(ClusterDriver, {
|
|||
services: globalStore.createRecord({
|
||||
type: 'rkeConfigServices',
|
||||
kubeApi: globalStore.createRecord({
|
||||
type: 'kubeAPIService',
|
||||
podSecurityPolicy: false,
|
||||
type: 'kubeAPIService',
|
||||
podSecurityPolicy: false,
|
||||
serviceNodePortRange: '30000-32767',
|
||||
}),
|
||||
etcd: globalStore.createRecord({
|
||||
type: 'etcdService',
|
||||
|
|
|
|||
|
|
@ -165,6 +165,17 @@
|
|||
{{/if}}
|
||||
</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="col span-12">
|
||||
{{cru-cloud-provider
|
||||
|
|
|
|||
|
|
@ -2070,6 +2070,9 @@ clusterNew:
|
|||
auth:
|
||||
label: Auth Provider
|
||||
x509: x509
|
||||
serviceNodePortRange:
|
||||
label: Node Port Range
|
||||
placeholder: e.g. 30000-32767
|
||||
network:
|
||||
label: Network Provider
|
||||
flannel: Flannel
|
||||
|
|
@ -3609,7 +3612,8 @@ formPorts:
|
|||
ipPlaceholder: "e.g. 80 or 19.82.2.24:80"
|
||||
clusterIpDefault: "Same as container port"
|
||||
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:
|
||||
label: Publish the container port
|
||||
placeholder: "e.g. 8080"
|
||||
|
|
|
|||
|
|
@ -2061,6 +2061,9 @@ clusterNew:
|
|||
auth:
|
||||
label: 认证提供者
|
||||
x509: x509
|
||||
serviceNodePortRange:
|
||||
label: Node Port范围
|
||||
placeholder: '例如: 30000-32767'
|
||||
network:
|
||||
label: 网络组件
|
||||
flannel: Flannel
|
||||
|
|
@ -3600,7 +3603,8 @@ formPorts:
|
|||
ipPlaceholder: '例如: 80或19.82.2.24:80'
|
||||
clusterIpDefault: '与容器端口相同'
|
||||
nodePort:
|
||||
placeholder: '端口范围30000-32768,例如: 30000'
|
||||
placeholder: '默认端口范围30000-32768,例如: 30000'
|
||||
customPortRangePlaceholder: "端口范围{range},例如: {port}"
|
||||
containerPort:
|
||||
label: 容器端口
|
||||
placeholder: "例如: 8080"
|
||||
|
|
|
|||
Loading…
Reference in New Issue