mirror of https://github.com/rancher/ui.git
Custom HAProxy config support
This commit is contained in:
parent
1db808c0a0
commit
9e102710fd
|
|
@ -270,10 +270,6 @@ export default Ember.Route.extend({
|
|||
this._includeChanged('loadBalancer', 'loadBalancerTargets', 'loadBalancerId', change.data.resource);
|
||||
},
|
||||
|
||||
loadBalancerConfigChanged: function(change) {
|
||||
this._includeChanged('loadBalancer', 'loadBalancerListeners', 'loadBalancerListeners', change.data.resource);
|
||||
},
|
||||
|
||||
loadBalancerChanged: function(change) {
|
||||
var balancer = change.data.resource;
|
||||
var config = balancer.get('loadBalancerConfig');
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ export default Ember.Component.extend(NewOrEdit, SelectTab, {
|
|||
service: null,
|
||||
existing: null,
|
||||
balancerConfig: null,
|
||||
haproxyConfig: null,
|
||||
allHosts: null,
|
||||
allServices: null,
|
||||
allCertificates: null,
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@
|
|||
<ul class="nav nav-tabs nav-tabs-well shadowed" style="display: inline-block">
|
||||
<li role="presentation" class="tab" data-section="ssl" {{action "selectTab" "ssl" target=view}}><a>SSL Termination</a></li>
|
||||
<li role="presentation" class="tab" data-section="stickiness" {{action "selectTab" "stickiness" target=view}}><a>Stickiness</a></li>
|
||||
<li role="presentation" class="tab" data-section="custom" {{action "selectTab" "custom" target=view}}><a>Custom haproxy.cfg</a></li>
|
||||
<li role="presentation" class="tab" data-section="labels" {{action "selectTab" "labels" target=view}}><a>Labels</a></li>
|
||||
<li role="presentation" class="tab" data-section="scheduling" {{action "selectTab" "scheduling" target=view}}><a>Scheduling</a></li>
|
||||
</ul>
|
||||
|
|
@ -78,20 +79,38 @@
|
|||
}}
|
||||
</div>
|
||||
|
||||
<div class="section" data-section="labels">
|
||||
<div class="section container-fluid tab-section" data-section="custom">
|
||||
<p class="help-block">Additional <a href="http://cbonte.github.io/haproxy-dconv/configuration-1.5.html" target="_blank">haproxy.cfg</a> configuration can be put here and will be appended to the configuration generated by Rancher.</p>
|
||||
|
||||
<div class="row form-group">
|
||||
<div class="col-sm-12 col-md-2 form-label">
|
||||
<label class="form-control-static">Labels</label>
|
||||
<div class="col-md-6">
|
||||
<label class="r-pt5 r-pb5"><code>global</code> section</label>
|
||||
{{textarea
|
||||
value=haproxyConfig.global
|
||||
prompt="Custom global section lines"
|
||||
rows="8"
|
||||
classNames="form-control"
|
||||
}}
|
||||
</div>
|
||||
<div class="col-sm-12 col-md-8">
|
||||
{{form-user-labels
|
||||
initialLabels=launchConfig.labels
|
||||
setLabels=(action 'setLabels' 'user')
|
||||
<div class="col-md-6">
|
||||
<label class="r-pt5 r-pb5"><code>defaults</code> section</label>
|
||||
{{textarea
|
||||
value=haproxyConfig.defaults
|
||||
prompt="Custom defaults section lines"
|
||||
rows="8"
|
||||
classNames="form-control"
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section" data-section="labels">
|
||||
{{form-user-labels
|
||||
initialLabels=launchConfig.labels
|
||||
setLabels=(action 'setLabels' 'user')
|
||||
}}
|
||||
</div>
|
||||
|
||||
<div class="section" data-section="scheduling">
|
||||
{{form-scheduling
|
||||
isService=true
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default Ember.Component.extend(FilterState, {
|
|||
collapsed: true,
|
||||
classNames: ['stack-section'],
|
||||
|
||||
filterableContent: Ember.computed.alias('model.services'),
|
||||
filterableContent: Ember.computed.alias('model.unremovedServices'),
|
||||
|
||||
actions: {
|
||||
toggleCollapse() {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@ export default Ember.Route.extend({
|
|||
include: ['instances']
|
||||
}).then((services) => {
|
||||
env.set('services', services||[]);
|
||||
env.set('services.sortProperties', ['name','id']);
|
||||
return Ember.Object.create({
|
||||
stack: env,
|
||||
all: all,
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ export default Ember.Route.extend({
|
|||
include: ['instances']
|
||||
}).then((services) => {
|
||||
env.set('services', services||[]);
|
||||
env.set('services.sortProperties', ['name','id']);
|
||||
return env;
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -193,7 +193,10 @@ var Environment = Resource.extend({
|
|||
|
||||
|
||||
unremovedServices: function() {
|
||||
return UnremovedArrayProxy.create({sourceContent: this.get('services')});
|
||||
return UnremovedArrayProxy.create({
|
||||
sourceContent: this.get('services'),
|
||||
sortProperties: ['displayName','id']
|
||||
});
|
||||
}.property('services'),
|
||||
|
||||
externalIdInfo: function() {
|
||||
|
|
|
|||
|
|
@ -3,14 +3,13 @@ import Resource from 'ember-api-store/models/resource';
|
|||
|
||||
var LoadBalancerConfig = Resource.extend({
|
||||
type: 'loadBalancerConfig',
|
||||
listeners: Ember.computed.alias('loadBalancerListeners'),
|
||||
config: function() {
|
||||
return this;
|
||||
}.property()
|
||||
});
|
||||
|
||||
LoadBalancerConfig.reopenClass({
|
||||
alwaysInclude: ['loadBalancerListeners','loadBalancers'],
|
||||
alwaysInclude: ['loadBalancers'],
|
||||
});
|
||||
|
||||
export default LoadBalancerConfig;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ export default Ember.Route.extend({
|
|||
|
||||
if ( params.serviceId )
|
||||
{
|
||||
dependencies.pushObject(store.find('service', params.serviceId, {include: ['loadbalancerlisteners']}));
|
||||
dependencies.pushObject(store.find('service', params.serviceId));
|
||||
}
|
||||
|
||||
return Ember.RSVP.all(dependencies, 'Load dependencies').then(function(results) {
|
||||
|
|
@ -23,10 +23,12 @@ export default Ember.Route.extend({
|
|||
var allCertificates = results[2];
|
||||
var existing = results[3];
|
||||
|
||||
var launchConfig, lbConfig, balancer, appCookie, lbCookie;
|
||||
var launchConfig, lbConfig, balancer, appCookie, lbCookie, haproxyConfig;
|
||||
if ( existing )
|
||||
{
|
||||
balancer = existing.cloneForNew();
|
||||
delete balancer.instances;
|
||||
|
||||
launchConfig = balancer.get('launchConfig');
|
||||
launchConfig.set('type','container');
|
||||
launchConfig.set('healthCheck',null);
|
||||
|
|
@ -39,7 +41,6 @@ export default Ember.Route.extend({
|
|||
lbConfig.set('type','loadBalancerConfig');
|
||||
delete lbConfig.id;
|
||||
lbConfig = store.createRecord(lbConfig);
|
||||
lbConfig.set('loadBalancerListeners', balancer.get('loadBalancerListeners'));
|
||||
balancer.set('loadBalancerConfig', lbConfig);
|
||||
|
||||
appCookie = lbConfig.get('appCookieStickinessPolicy');
|
||||
|
|
@ -57,6 +58,14 @@ export default Ember.Route.extend({
|
|||
lbCookie = store.createRecord(lbCookie);
|
||||
lbConfig.set('lbCookieStickinessPolicy', lbCookie);
|
||||
}
|
||||
|
||||
haproxyConfig = lbConfig.get('haproxyConfig');
|
||||
if ( haproxyConfig )
|
||||
{
|
||||
haproxyConfig.set('type','haproxyConfig');
|
||||
haproxyConfig = store.createRecord(haproxyConfig);
|
||||
lbConfig.set('haproxyConfig', haproxyConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
@ -89,6 +98,16 @@ export default Ember.Route.extend({
|
|||
});
|
||||
}
|
||||
|
||||
if ( !haproxyConfig )
|
||||
{
|
||||
haproxyConfig = store.createRecord({
|
||||
type: 'haproxyConfig',
|
||||
'global': '',
|
||||
'defaults': ''
|
||||
});
|
||||
}
|
||||
|
||||
lbConfig.set('haproxyConfig', haproxyConfig);
|
||||
balancer.set('loadBalancerConfig', lbConfig);
|
||||
|
||||
return {
|
||||
|
|
@ -99,6 +118,7 @@ export default Ember.Route.extend({
|
|||
service: balancer,
|
||||
config: lbConfig,
|
||||
launchConfig: launchConfig,
|
||||
haproxyConfig: haproxyConfig
|
||||
};
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
{{new-balancer
|
||||
service=model.service
|
||||
balancerConfig=model.config
|
||||
haproxyConfig=model.haproxyConfig
|
||||
existing=model.existingBalancer
|
||||
allHosts=model.allHosts
|
||||
allServices=model.allServices
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ module.exports = function(environment) {
|
|||
'&include=hosts' +
|
||||
'&include=instances' +
|
||||
'&include=instance' +
|
||||
'&include=loadBalancerConfig' +
|
||||
'&include=loadBalancerTargets' +
|
||||
'&include=loadBalancerListeners' +
|
||||
'&include=instanceLinks' +
|
||||
'&include=ipAddresses',
|
||||
baseAssets: '',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "ui",
|
||||
"version": "0.70.0",
|
||||
"version": "0.72.0",
|
||||
"private": true,
|
||||
"directories": {
|
||||
"doc": "doc",
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
"license": "Apache 2",
|
||||
"devDependencies": {
|
||||
"broccoli-asset-rev": "^2.1.2",
|
||||
"ember-api-store": "^1.2.3",
|
||||
"ember-api-store": "^1.2.4",
|
||||
"ember-browserify": "^1.0.1",
|
||||
"ember-cli": "1.13.8",
|
||||
"ember-cli-app-version": "0.5.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue