mirror of https://github.com/rancher/ui.git
Fix service port ingress issue
https://github.com/rancher/rancher/issues/15809
This commit is contained in:
parent
e50cb88fad
commit
c8ed933365
|
|
@ -63,12 +63,10 @@ export default Resource.extend({
|
|||
const list = [];
|
||||
const ports = get(this, 'ports');
|
||||
|
||||
if (get(this, 'recordType') === WORKLOAD) {
|
||||
ports.forEach((p) => {
|
||||
list.push(p.targetPort.toString());
|
||||
list.push(p.port.toString());
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
return list.uniq().map((p) => ({ port: p }));
|
||||
}),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { get, set, observer } from '@ember/object'
|
||||
import { get, set, observer, computed } from '@ember/object'
|
||||
import Component from '@ember/component';
|
||||
import layout from './template';
|
||||
import { inject as service } from '@ember/service';
|
||||
|
|
@ -63,6 +63,10 @@ export default Component.extend({
|
|||
});
|
||||
}),
|
||||
|
||||
hasServiceTargets: computed('pathArray.@each.backendType}', function() {
|
||||
return !!get(this, 'pathArray').findBy('backendType', 'service');
|
||||
}),
|
||||
|
||||
initPathArray() {
|
||||
const pathArray = [];
|
||||
const paths = get(this, 'rule.paths');
|
||||
|
|
|
|||
|
|
@ -1,3 +1,6 @@
|
|||
{{#if hasServiceTargets}}
|
||||
{{banner-message color="bg-info" icon="icon-info" message=(t 'formIngressBackends.warning' htmlSafe=true)}}
|
||||
{{/if}}
|
||||
<div class="clearfix">
|
||||
{{#if editing}}
|
||||
<label class="acc-label">{{t 'formIngressBackends.label'}}</label>
|
||||
|
|
@ -65,7 +68,7 @@
|
|||
|
||||
<td class="p-5" data-title="{{t 'formIngressBackends.targetPort.label'}}">
|
||||
{{#input-or-display editable=editing value=path.targetPort classesForDisplay="clip"}}
|
||||
{{#if (and (eq path.backendType 'service') (eq path.service.recordType 'workload'))}}
|
||||
{{#if (and path.service (eq path.backendType 'service'))}}
|
||||
{{new-select
|
||||
classNames="form-control input-sm"
|
||||
optionValuePath="port"
|
||||
|
|
@ -73,6 +76,11 @@
|
|||
content=path.service.availablePorts
|
||||
value=path.targetPort
|
||||
}}
|
||||
{{else if (eq path.backendType 'service')}}
|
||||
{{new-select
|
||||
classNames="form-control input-sm"
|
||||
content=[]
|
||||
}}
|
||||
{{else}}
|
||||
{{input-integer class="input-sm" min="1" max="65535" value=path.targetPort placeholder=(t 'formIngressBackends.targetPort.placeholder')}}
|
||||
{{/if}}
|
||||
|
|
|
|||
|
|
@ -3266,6 +3266,7 @@ formIngress:
|
|||
formIngressBackends:
|
||||
label: Target Backend
|
||||
noRules: No Backends
|
||||
warning: If the target is a service, only the port exposed by the service can be selected. You can go to Service Discovery tab and edit the service to add ports by editing the YAML.
|
||||
addServiceLabel: Service
|
||||
addWorkloadLabel: Workload
|
||||
service:
|
||||
|
|
|
|||
|
|
@ -3263,6 +3263,7 @@ formIngress:
|
|||
formIngressBackends:
|
||||
label: 目标后端
|
||||
noRules: 没有后端
|
||||
warning: 如果目标后端是一个服务,您只可以使用该服务所暴露的端口。您可以在服务发现页找到该服务,然后通过编辑YAML的方式添加所需要的端口。
|
||||
addServiceLabel: 服务
|
||||
addWorkloadLabel: 工作负载
|
||||
service:
|
||||
|
|
|
|||
Loading…
Reference in New Issue