Skip to content

Instantly share code, notes, and snippets.

@hub-cap
Created June 19, 2014 19:30
Show Gist options
  • Save hub-cap/13908a5903f6cfd40b0e to your computer and use it in GitHub Desktop.
Save hub-cap/13908a5903f6cfd40b0e to your computer and use it in GitHub Desktop.
LBClient.prototype._provisionChildLoadBalancer = function (state, callback) {
console.log("_provisionChildLoadBalancer");
var client = createPkgCloudClient();
var remoteLoadBalancer = {
name: 'dbaas-proxy-child',
protocol: {name:"TCP", port: state.childLoadBalancer.port},
virtualIps: [{
id: state.parentLoadBalancer.virtualIP
}],
nodes: [{
address: state.childLoadBalancer.privateIP,
port: state.childLoadBalancer.privatePort,
condition: 'ENABLED',
}]
};
// util.retryCall(10, client, client.createLoadBalancer,
client.createLoadBalancer(
remoteLoadBalancer,
function(err, pkgCloudLB) {
state.remoteLoadBalancer = pkgCloudLB;
callback(err);
});
};
@hub-cap
Copy link
Author

hub-cap commented Jun 19, 2014

function createPkgCloudClient() {
return pkgcloud.loadbalancer.createClient({
provider: 'rackspace',
username: AUTH_CRED.LBaaSUser,
apiKey: AUTH_CRED.LBaaSPassword,
authUrl: AUTH_CRED.endpoint,
region: AUTH_CRED.region
});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment