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);
|
this._includeChanged('loadBalancer', 'loadBalancerTargets', 'loadBalancerId', change.data.resource);
|
||||||
},
|
},
|
||||||
|
|
||||||
loadBalancerConfigChanged: function(change) {
|
|
||||||
this._includeChanged('loadBalancer', 'loadBalancerListeners', 'loadBalancerListeners', change.data.resource);
|
|
||||||
},
|
|
||||||
|
|
||||||
loadBalancerChanged: function(change) {
|
loadBalancerChanged: function(change) {
|
||||||
var balancer = change.data.resource;
|
var balancer = change.data.resource;
|
||||||
var config = balancer.get('loadBalancerConfig');
|
var config = balancer.get('loadBalancerConfig');
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ export default Ember.Component.extend(NewOrEdit, SelectTab, {
|
||||||
service: null,
|
service: null,
|
||||||
existing: null,
|
existing: null,
|
||||||
balancerConfig: null,
|
balancerConfig: null,
|
||||||
|
haproxyConfig: null,
|
||||||
allHosts: null,
|
allHosts: null,
|
||||||
allServices: null,
|
allServices: null,
|
||||||
allCertificates: null,
|
allCertificates: null,
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@
|
||||||
<ul class="nav nav-tabs nav-tabs-well shadowed" style="display: inline-block">
|
<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="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="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="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>
|
<li role="presentation" class="tab" data-section="scheduling" {{action "selectTab" "scheduling" target=view}}><a>Scheduling</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
@ -78,20 +79,38 @@
|
||||||
}}
|
}}
|
||||||
</div>
|
</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="row form-group">
|
||||||
<div class="col-sm-12 col-md-2 form-label">
|
<div class="col-md-6">
|
||||||
<label class="form-control-static">Labels</label>
|
<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>
|
||||||
<div class="col-sm-12 col-md-8">
|
<div class="col-md-6">
|
||||||
{{form-user-labels
|
<label class="r-pt5 r-pb5"><code>defaults</code> section</label>
|
||||||
initialLabels=launchConfig.labels
|
{{textarea
|
||||||
setLabels=(action 'setLabels' 'user')
|
value=haproxyConfig.defaults
|
||||||
|
prompt="Custom defaults section lines"
|
||||||
|
rows="8"
|
||||||
|
classNames="form-control"
|
||||||
}}
|
}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</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">
|
<div class="section" data-section="scheduling">
|
||||||
{{form-scheduling
|
{{form-scheduling
|
||||||
isService=true
|
isService=true
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default Ember.Component.extend(FilterState, {
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
classNames: ['stack-section'],
|
classNames: ['stack-section'],
|
||||||
|
|
||||||
filterableContent: Ember.computed.alias('model.services'),
|
filterableContent: Ember.computed.alias('model.unremovedServices'),
|
||||||
|
|
||||||
actions: {
|
actions: {
|
||||||
toggleCollapse() {
|
toggleCollapse() {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ export default Ember.Route.extend({
|
||||||
include: ['instances']
|
include: ['instances']
|
||||||
}).then((services) => {
|
}).then((services) => {
|
||||||
env.set('services', services||[]);
|
env.set('services', services||[]);
|
||||||
env.set('services.sortProperties', ['name','id']);
|
|
||||||
return Ember.Object.create({
|
return Ember.Object.create({
|
||||||
stack: env,
|
stack: env,
|
||||||
all: all,
|
all: all,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ export default Ember.Route.extend({
|
||||||
include: ['instances']
|
include: ['instances']
|
||||||
}).then((services) => {
|
}).then((services) => {
|
||||||
env.set('services', services||[]);
|
env.set('services', services||[]);
|
||||||
env.set('services.sortProperties', ['name','id']);
|
|
||||||
return env;
|
return env;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -193,7 +193,10 @@ var Environment = Resource.extend({
|
||||||
|
|
||||||
|
|
||||||
unremovedServices: function() {
|
unremovedServices: function() {
|
||||||
return UnremovedArrayProxy.create({sourceContent: this.get('services')});
|
return UnremovedArrayProxy.create({
|
||||||
|
sourceContent: this.get('services'),
|
||||||
|
sortProperties: ['displayName','id']
|
||||||
|
});
|
||||||
}.property('services'),
|
}.property('services'),
|
||||||
|
|
||||||
externalIdInfo: function() {
|
externalIdInfo: function() {
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,13 @@ import Resource from 'ember-api-store/models/resource';
|
||||||
|
|
||||||
var LoadBalancerConfig = Resource.extend({
|
var LoadBalancerConfig = Resource.extend({
|
||||||
type: 'loadBalancerConfig',
|
type: 'loadBalancerConfig',
|
||||||
listeners: Ember.computed.alias('loadBalancerListeners'),
|
|
||||||
config: function() {
|
config: function() {
|
||||||
return this;
|
return this;
|
||||||
}.property()
|
}.property()
|
||||||
});
|
});
|
||||||
|
|
||||||
LoadBalancerConfig.reopenClass({
|
LoadBalancerConfig.reopenClass({
|
||||||
alwaysInclude: ['loadBalancerListeners','loadBalancers'],
|
alwaysInclude: ['loadBalancers'],
|
||||||
});
|
});
|
||||||
|
|
||||||
export default LoadBalancerConfig;
|
export default LoadBalancerConfig;
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export default Ember.Route.extend({
|
||||||
|
|
||||||
if ( params.serviceId )
|
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) {
|
return Ember.RSVP.all(dependencies, 'Load dependencies').then(function(results) {
|
||||||
|
|
@ -23,10 +23,12 @@ export default Ember.Route.extend({
|
||||||
var allCertificates = results[2];
|
var allCertificates = results[2];
|
||||||
var existing = results[3];
|
var existing = results[3];
|
||||||
|
|
||||||
var launchConfig, lbConfig, balancer, appCookie, lbCookie;
|
var launchConfig, lbConfig, balancer, appCookie, lbCookie, haproxyConfig;
|
||||||
if ( existing )
|
if ( existing )
|
||||||
{
|
{
|
||||||
balancer = existing.cloneForNew();
|
balancer = existing.cloneForNew();
|
||||||
|
delete balancer.instances;
|
||||||
|
|
||||||
launchConfig = balancer.get('launchConfig');
|
launchConfig = balancer.get('launchConfig');
|
||||||
launchConfig.set('type','container');
|
launchConfig.set('type','container');
|
||||||
launchConfig.set('healthCheck',null);
|
launchConfig.set('healthCheck',null);
|
||||||
|
|
@ -39,7 +41,6 @@ export default Ember.Route.extend({
|
||||||
lbConfig.set('type','loadBalancerConfig');
|
lbConfig.set('type','loadBalancerConfig');
|
||||||
delete lbConfig.id;
|
delete lbConfig.id;
|
||||||
lbConfig = store.createRecord(lbConfig);
|
lbConfig = store.createRecord(lbConfig);
|
||||||
lbConfig.set('loadBalancerListeners', balancer.get('loadBalancerListeners'));
|
|
||||||
balancer.set('loadBalancerConfig', lbConfig);
|
balancer.set('loadBalancerConfig', lbConfig);
|
||||||
|
|
||||||
appCookie = lbConfig.get('appCookieStickinessPolicy');
|
appCookie = lbConfig.get('appCookieStickinessPolicy');
|
||||||
|
|
@ -57,6 +58,14 @@ export default Ember.Route.extend({
|
||||||
lbCookie = store.createRecord(lbCookie);
|
lbCookie = store.createRecord(lbCookie);
|
||||||
lbConfig.set('lbCookieStickinessPolicy', lbCookie);
|
lbConfig.set('lbCookieStickinessPolicy', lbCookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
haproxyConfig = lbConfig.get('haproxyConfig');
|
||||||
|
if ( haproxyConfig )
|
||||||
|
{
|
||||||
|
haproxyConfig.set('type','haproxyConfig');
|
||||||
|
haproxyConfig = store.createRecord(haproxyConfig);
|
||||||
|
lbConfig.set('haproxyConfig', haproxyConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
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);
|
balancer.set('loadBalancerConfig', lbConfig);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -99,6 +118,7 @@ export default Ember.Route.extend({
|
||||||
service: balancer,
|
service: balancer,
|
||||||
config: lbConfig,
|
config: lbConfig,
|
||||||
launchConfig: launchConfig,
|
launchConfig: launchConfig,
|
||||||
|
haproxyConfig: haproxyConfig
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
{{new-balancer
|
{{new-balancer
|
||||||
service=model.service
|
service=model.service
|
||||||
balancerConfig=model.config
|
balancerConfig=model.config
|
||||||
|
haproxyConfig=model.haproxyConfig
|
||||||
existing=model.existingBalancer
|
existing=model.existingBalancer
|
||||||
allHosts=model.allHosts
|
allHosts=model.allHosts
|
||||||
allServices=model.allServices
|
allServices=model.allServices
|
||||||
|
|
|
||||||
|
|
@ -49,9 +49,6 @@ module.exports = function(environment) {
|
||||||
'&include=hosts' +
|
'&include=hosts' +
|
||||||
'&include=instances' +
|
'&include=instances' +
|
||||||
'&include=instance' +
|
'&include=instance' +
|
||||||
'&include=loadBalancerConfig' +
|
|
||||||
'&include=loadBalancerTargets' +
|
|
||||||
'&include=loadBalancerListeners' +
|
|
||||||
'&include=instanceLinks' +
|
'&include=instanceLinks' +
|
||||||
'&include=ipAddresses',
|
'&include=ipAddresses',
|
||||||
baseAssets: '',
|
baseAssets: '',
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "ui",
|
"name": "ui",
|
||||||
"version": "0.70.0",
|
"version": "0.72.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"directories": {
|
"directories": {
|
||||||
"doc": "doc",
|
"doc": "doc",
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
"license": "Apache 2",
|
"license": "Apache 2",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"broccoli-asset-rev": "^2.1.2",
|
"broccoli-asset-rev": "^2.1.2",
|
||||||
"ember-api-store": "^1.2.3",
|
"ember-api-store": "^1.2.4",
|
||||||
"ember-browserify": "^1.0.1",
|
"ember-browserify": "^1.0.1",
|
||||||
"ember-cli": "1.13.8",
|
"ember-cli": "1.13.8",
|
||||||
"ember-cli-app-version": "0.5.0",
|
"ember-cli-app-version": "0.5.0",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue