Patch MAAS to render correct proxy url

MAAS hard codes the proxy URL passed to
bootstrapping nodes w/ port 8000. The proxy
URL needs to support the nodeport standard
currently used.

- Patch MAAS to render the apt proxy url using
  maas_url from regiond.conf
- Use hardcoded port 31800 instead of 8000

Change-Id: I9d2ed35fb3947be51bc9c9e2b5f13f1144b4e927
This commit is contained in:
Scott Hussey 2018-01-16 09:06:48 -06:00
parent 8b29fb6bdf
commit ec58f85762
3 changed files with 41 additions and 5 deletions

View File

@ -69,11 +69,11 @@ manifests:
images: images:
tags: tags:
db_init: docker.io/postgres:9.5 db_init: docker.io/postgres:9.5
db_sync: sthussey/maas-region-controller:2.3 db_sync: sthussey/maas-region-controller:2.3_patchv4
maas_rack: sthussey/maas-rack-controller:2.3 maas_rack: sthussey/maas-rack-controller:2.3
maas_region: sthussey/maas-region:2.3_patch maas_region: sthussey/maas-region-controller:2.3_patchv4
bootstrap: sthussey/maas-region-controller:2.3 bootstrap: sthussey/maas-region-controller:2.3_patchv4
export_api_key: sthussey/maas-region-controller:2.3 export_api_key: sthussey/maas-region-controller:2.3_patchv4
maas_cache: quay.io/attcomdev/maas-cache:master maas_cache: quay.io/attcomdev/maas-cache:master
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1 dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.2.1
pull_policy: IfNotPresent pull_policy: IfNotPresent

View File

@ -0,0 +1,34 @@
diff --git a/src/maasserver/compose_preseed.py b/src/maasserver/compose_preseed.py
index e15b3b2..b7c7edc 100644
--- a/src/maasserver/compose_preseed.py
+++ b/src/maasserver/compose_preseed.py
@@ -8,7 +8,7 @@ __all__ = [
]
from datetime import timedelta
-from urllib.parse import urlencode
+from urllib.parse import urlencode, urlparse
from maasserver.clusterrpc.osystems import get_preseed_data
from maasserver.enum import (
@@ -17,6 +17,7 @@ from maasserver.enum import (
PRESEED_TYPE,
)
from maasserver.models import PackageRepository
+from maasserver.config import RegionConfiguration
from maasserver.models.config import Config
from maasserver.server_address import get_maas_facing_server_host
from maasserver.utils import absolute_reverse
@@ -41,9 +42,9 @@ def get_apt_proxy(rack_controller=None, default_region_ip=None):
if http_proxy and not use_peer_proxy:
return http_proxy
else:
- return compose_URL(
- "http://:8000/", get_maas_facing_server_host(
- rack_controller, default_region_ip=default_region_ip))
+ with RegionConfiguration.open() as config:
+ maas_url = config.maas_url
+ return compose_URL("http://:31800/", urlparse(maas_url).hostname)
else:
return None

View File

@ -50,9 +50,11 @@ RUN apt-get download maas-region-controller=$MAAS_VERSION && \
dpkg -i maas-region-controller.deb && \ dpkg -i maas-region-controller.deb && \
pg_dropcluster --stop 9.5 main pg_dropcluster --stop 9.5 main
# 2.3 workaround # 2.3 workarounds
COPY 2.3_nat_fix.patch /tmp/2.3_nat_fix.patch COPY 2.3_nat_fix.patch /tmp/2.3_nat_fix.patch
COPY 2.3_proxy_port.patch /tmp/2.3_proxy_port.patch
RUN cd /usr/lib/python3/dist-packages/maasserver/utils && patch __init__.py < /tmp/2.3_nat_fix.patch RUN cd /usr/lib/python3/dist-packages/maasserver/utils && patch __init__.py < /tmp/2.3_nat_fix.patch
RUN cd /usr/lib/python3/dist-packages/maasserver && patch compose_preseed.py < /tmp/2.3_proxy_port.patch
# initalize systemd # initalize systemd
CMD ["/sbin/init"] CMD ["/sbin/init"]