Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Commit

Permalink
node: fix secondary haproxy app fqdn
Browse files Browse the repository at this point in the history
The secondary HAproxy gear in a HA application should be accessible at
the node httpd proxy via the app fqdn. Previously this extra route was
added as a sort of additional unofficial fqdn for the gear frontend that
resulted in some inconsistencies. This change updates the method used
such that the app fqdn is added as an alias on the gear frontend instead.

Bug 1155677 - HA apps add fqdn entries in frontend http configuration
causing oo-accept-node to FAIL
https://bugzilla.redhat.com/show_bug.cgi?id=1155677
  • Loading branch information
sosiouxme committed Dec 18, 2014
1 parent 8fd2f54 commit 4e6cb00
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions node/lib/openshift-origin-node/model/v2_cart_model.rb
Expand Up @@ -1061,7 +1061,6 @@ def disconnect_frontend_for_endpoint(cartridge, endpoint)
# This is only called when a cartridge is removed from a cartridge not a gear delete
def disconnect_frontend(cartridge)
gear_env = ::OpenShift::Runtime::Utils::Environ.for_gear(@container.container_dir)
app_dns = gear_env["OPENSHIFT_APP_DNS"].to_s.downcase

mappings = []
cartridge.endpoints.each do |endpoint|
Expand All @@ -1074,15 +1073,6 @@ def disconnect_frontend(cartridge)
unless mappings.empty?
fe_server = FrontendHttpServer.new(@container)
fe_server.disconnect(*mappings)
if cartridge.web_proxy?
gear_fqdn = fe_server.fqdn
if gear_fqdn != app_dns
# secondary web-proxy gear
fe_server.set_fqdn(app_dns)
fe_server.disconnect(*mappings)
fe_server.set_fqdn(gear_fqdn)
end
end
end
end

Expand Down Expand Up @@ -1127,17 +1117,9 @@ def connect_frontend(cartridge, rebuild=false)
logger.info("Connecting frontend mapping for #{@container.uuid}/#{cartridge.name}: "\
"[#{mapping.frontend}] => [#{backend_uri}] with options: #{mapping.options}")
reported_urls = frontend.connect(mapping.frontend, backend_uri, options)
if cartridge.web_proxy?
gear_fqdn = frontend.fqdn
if gear_fqdn != app_dns
# secondary web-proxy gear
frontend.set_fqdn(app_dns)
new_options = options.dup
# target_update will misfire because fqdn has changed
new_options.delete("target_update")
reported_urls += frontend.connect(mapping.frontend, backend_uri, new_options)
frontend.set_fqdn(gear_fqdn)
end
if cartridge.web_proxy? && frontend.fqdn != app_dns
# secondary web-proxy gear should have app DNS routed too
frontend.add_alias(app_dns)
end
if reported_urls
reported_urls.each do |url|
Expand Down

0 comments on commit 4e6cb00

Please sign in to comment.