Being able to change insert headers of listener
Change-Id: I8de70e4f3edf22b316e691388413116b14697081 Story: 1713861 Task: 5368
This commit is contained in:
parent
f9fcb3d9e6
commit
05170ec174
@ -169,7 +169,8 @@ def create_listener(request, **kwargs):
|
|||||||
connection_limit=data['listener'].get('connection_limit'),
|
connection_limit=data['listener'].get('connection_limit'),
|
||||||
default_tls_container_ref=default_tls_ref,
|
default_tls_container_ref=default_tls_ref,
|
||||||
sni_container_refs=None,
|
sni_container_refs=None,
|
||||||
admin_state_up=data['listener'].get('admin_state_up')
|
admin_state_up=data['listener'].get('admin_state_up'),
|
||||||
|
insert_headers=data['listener'].get('insert_headers'),
|
||||||
)
|
)
|
||||||
|
|
||||||
if data.get('pool'):
|
if data.get('pool'):
|
||||||
@ -394,6 +395,7 @@ def update_listener(request, **kwargs):
|
|||||||
connection_limit=data['listener'].get('connection_limit'),
|
connection_limit=data['listener'].get('connection_limit'),
|
||||||
admin_state_up=data['listener'].get('admin_state_up'),
|
admin_state_up=data['listener'].get('admin_state_up'),
|
||||||
default_pool_id=default_pool_id,
|
default_pool_id=default_pool_id,
|
||||||
|
insert_headers=data['listener'].get('insert_headers'),
|
||||||
)
|
)
|
||||||
|
|
||||||
if data.get('pool'):
|
if data.get('pool'):
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
item="ctrl.listener"
|
item="ctrl.listener"
|
||||||
property-groups="[[
|
property-groups="[[
|
||||||
'id', 'name', 'description', 'project_id', 'created_at', 'updated_at',
|
'id', 'name', 'description', 'project_id', 'created_at', 'updated_at',
|
||||||
'connection_limit', 'default_pool_id']]">
|
'connection_limit', 'insert_headers', 'default_pool_id']]">
|
||||||
</hz-resource-property-list>
|
</hz-resource-property-list>
|
||||||
</div>
|
</div>
|
||||||
</uib-tab>
|
</uib-tab>
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
['name', 'id', 'project_id'],
|
['name', 'id', 'project_id'],
|
||||||
['created_at', 'updated_at', 'description'],
|
['created_at', 'updated_at', 'description'],
|
||||||
['protocol', 'protocol_port', 'connection_limit'],
|
['protocol', 'protocol_port', 'connection_limit'],
|
||||||
['default_pool_id']]">
|
['insert_headers', 'default_pool_id']]">
|
||||||
</hz-resource-property-list>
|
</hz-resource-property-list>
|
||||||
|
@ -170,7 +170,13 @@
|
|||||||
filters: ['noName']
|
filters: ['noName']
|
||||||
},
|
},
|
||||||
l7_policies: gettext('L7 Policies'),
|
l7_policies: gettext('L7 Policies'),
|
||||||
insert_headers: gettext('Insert Headers'),
|
insert_headers: {
|
||||||
|
label: gettext('Insert Headers'),
|
||||||
|
filters: [
|
||||||
|
'json',
|
||||||
|
loadBalancerService.nullFilter
|
||||||
|
]
|
||||||
|
},
|
||||||
load_balancers: gettext('Load Balancers')
|
load_balancers: gettext('Load Balancers')
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -30,3 +30,10 @@
|
|||||||
The ID of the pool used by the listener if no L7 policies match.
|
The ID of the pool used by the listener if no L7 policies match.
|
||||||
</translate>
|
</translate>
|
||||||
</p>
|
</p>
|
||||||
|
<p>
|
||||||
|
<strong translate>Insert Headers:</strong>
|
||||||
|
<translate>
|
||||||
|
Additional headers insertion into HTTP header,
|
||||||
|
only "X-Forwarded-For" and "X-Forwarded-Port" are supported.
|
||||||
|
</translate>
|
||||||
|
</p>
|
||||||
|
@ -96,6 +96,42 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<h4 translate>Insert Headers</h4>
|
||||||
|
|
||||||
|
<div class="row form-group">
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="themable-checkbox">
|
||||||
|
<input type="checkbox"
|
||||||
|
ng-true-value="'True'"
|
||||||
|
ng-false-value="''"
|
||||||
|
id="x_forwarded_for"
|
||||||
|
ng-model="model.spec.listener.insert_headers['X-Forwarded-For']">
|
||||||
|
<label for="x_forwarded_for">
|
||||||
|
<span translate>X-Forwarded-For</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="themable-checkbox">
|
||||||
|
<input type="checkbox"
|
||||||
|
ng-true-value="'True'"
|
||||||
|
ng-false-value="''"
|
||||||
|
id="x_forwarded_port"
|
||||||
|
ng-model="model.spec.listener.insert_headers['X-Forwarded-Port']">
|
||||||
|
<label for="x_forwarded_port">
|
||||||
|
<span translate>X-Forwarded-port</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
|
||||||
<div class="col-xs-12 col-sm-8 col-md-6">
|
<div class="col-xs-12 col-sm-8 col-md-6">
|
||||||
|
@ -152,7 +152,8 @@
|
|||||||
connection_limit: -1,
|
connection_limit: -1,
|
||||||
admin_state_up: true,
|
admin_state_up: true,
|
||||||
default_pool: null,
|
default_pool: null,
|
||||||
default_pool_id: null
|
default_pool_id: null,
|
||||||
|
insert_headers: {}
|
||||||
},
|
},
|
||||||
l7policy: {
|
l7policy: {
|
||||||
id: null,
|
id: null,
|
||||||
@ -455,7 +456,13 @@
|
|||||||
// Listener requires protocol and port
|
// Listener requires protocol and port
|
||||||
delete finalSpec.listener;
|
delete finalSpec.listener;
|
||||||
delete finalSpec.certificates;
|
delete finalSpec.certificates;
|
||||||
} else if (finalSpec.listener.protocol !== 'TERMINATED_HTTPS') {
|
} else {
|
||||||
|
for (var header in finalSpec.listener.insert_headers) {
|
||||||
|
if (!finalSpec.listener.insert_headers[header]) {
|
||||||
|
delete finalSpec.listener.insert_headers[header];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (finalSpec.listener.protocol !== 'TERMINATED_HTTPS') {
|
||||||
// Remove certificate containers if not using TERMINATED_HTTPS
|
// Remove certificate containers if not using TERMINATED_HTTPS
|
||||||
delete finalSpec.certificates;
|
delete finalSpec.certificates;
|
||||||
} else {
|
} else {
|
||||||
@ -466,6 +473,7 @@
|
|||||||
finalSpec.certificates = containers;
|
finalSpec.certificates = containers;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function cleanFinalSpecPool(finalSpec) {
|
function cleanFinalSpecPool(finalSpec) {
|
||||||
|
|
||||||
@ -735,6 +743,7 @@
|
|||||||
spec.connection_limit = listener.connection_limit;
|
spec.connection_limit = listener.connection_limit;
|
||||||
spec.admin_state_up = listener.admin_state_up;
|
spec.admin_state_up = listener.admin_state_up;
|
||||||
spec.default_pool_id = listener.default_pool_id;
|
spec.default_pool_id = listener.default_pool_id;
|
||||||
|
spec.insert_headers = listener.insert_headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setL7PolicySpec(l7policy) {
|
function setL7PolicySpec(l7policy) {
|
||||||
|
@ -34,7 +34,11 @@
|
|||||||
protocol_port: 80,
|
protocol_port: 80,
|
||||||
connection_limit: 999,
|
connection_limit: 999,
|
||||||
load_balancers: [ { id: '1234' } ],
|
load_balancers: [ { id: '1234' } ],
|
||||||
sni_container_refs: ['container2']
|
sni_container_refs: ['container2'],
|
||||||
|
insert_headers: {
|
||||||
|
'X-Forwarded-For': 'True',
|
||||||
|
'X-Forwarded-Port': 'True'
|
||||||
|
}
|
||||||
},
|
},
|
||||||
pool: {
|
pool: {
|
||||||
admin_state_up: true,
|
admin_state_up: true,
|
||||||
@ -1173,7 +1177,7 @@
|
|||||||
it('has the right number of properties', function() {
|
it('has the right number of properties', function() {
|
||||||
expect(Object.keys(model.spec).length).toBe(11);
|
expect(Object.keys(model.spec).length).toBe(11);
|
||||||
expect(Object.keys(model.spec.loadbalancer).length).toBe(5);
|
expect(Object.keys(model.spec.loadbalancer).length).toBe(5);
|
||||||
expect(Object.keys(model.spec.listener).length).toBe(9);
|
expect(Object.keys(model.spec.listener).length).toBe(10);
|
||||||
expect(Object.keys(model.spec.l7policy).length).toBe(8);
|
expect(Object.keys(model.spec.l7policy).length).toBe(8);
|
||||||
expect(Object.keys(model.spec.l7rule).length).toBe(7);
|
expect(Object.keys(model.spec.l7rule).length).toBe(7);
|
||||||
expect(Object.keys(model.spec.pool).length).toBe(7);
|
expect(Object.keys(model.spec.pool).length).toBe(7);
|
||||||
@ -2442,6 +2446,49 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('Model visible resources (edit listener, no insert headers)', function() {
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
delete listenerResources.listener.insert_headers;
|
||||||
|
delete listenerResources.pool;
|
||||||
|
model.initialize('listener', '1234');
|
||||||
|
scope.$apply();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should only show listener details', function() {
|
||||||
|
expect(model.context.resource).toEqual('listener');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Model visible resources (edit listener, no x forwared for)', function() {
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
listenerResources.listener.insert_headers['X-Forwarded-For'] = '';
|
||||||
|
delete listenerResources.pool;
|
||||||
|
model.initialize('listener', '1234');
|
||||||
|
scope.$apply();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should only show listener details', function() {
|
||||||
|
model.submit();
|
||||||
|
expect(model.context.resource).toEqual('listener');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Model visible resources (edit listener, no x forwared port)', function() {
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
delete listenerResources.listener.insert_headers['X-Forwarded-Port'];
|
||||||
|
delete listenerResources.pool;
|
||||||
|
model.initialize('listener', '1234');
|
||||||
|
scope.$apply();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should only show listener details', function() {
|
||||||
|
expect(model.context.resource).toEqual('listener');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe('Model visible resources (edit listener, no pool)', function() {
|
describe('Model visible resources (edit listener, no pool)', function() {
|
||||||
|
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
@ -8,10 +8,12 @@
|
|||||||
"OpenStack",
|
"OpenStack",
|
||||||
"octavia",
|
"octavia",
|
||||||
"octavia-dashboard",
|
"octavia-dashboard",
|
||||||
"load-balancer"],
|
"load-balancer"
|
||||||
|
],
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.openstack.org/openstack/octavia-dashboard"},
|
"url": "https://git.openstack.org/openstack/octavia-dashboard"
|
||||||
|
},
|
||||||
"bugs": "https://storyboard.openstack.org/#!/project/909",
|
"bugs": "https://storyboard.openstack.org/#!/project/909",
|
||||||
"license": "Apache 2.0",
|
"license": "Apache 2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds the ability to set the insertion headers on listeners.
|
Loading…
Reference in New Issue
Block a user