Skip to content

Commit 91fa969

Browse files
authored
Merge pull request juju#9608 from ycliuhw/fix/allow-ingress-controller-publish-address
juju#9608 ## Description of change fix `ingress` issues on `microk8s/kubernetes core` by patching ingress controller container exec args to allow ingress publish address; before ``` root@juju-bf04a4-1:~# kubectl -n testcaas get ing -o wide NAME HOSTS ADDRESS PORTS AGE juju-gitlab-k8s 10.98.42.46.xip.io 80 4m25s ``` after ``` root@juju-bf04a4-1:~# kubectl -n testcaas get ing -o wide NAME HOSTS ADDRESS PORTS AGE juju-gitlab-k8s 10.98.42.46.xip.io 10.98.42.46 80 4m25s ``` ## QA steps N/A ## Documentation changes N/A ## Bug reference N/A
2 parents 80f9a82 + a7fa48f commit 91fa969

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

acceptancetests/assess_caas_deploy_charms.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import sys
1515
import os
1616
import subprocess
17+
from time import sleep
1718

1819
import requests
1920

@@ -162,11 +163,12 @@ def check_app_healthy(url, timeout=300):
162163
for _ in until_timeout(timeout):
163164
try:
164165
r = requests.get(url)
165-
if r.ok and r.status_code < 300:
166+
if r.ok and r.status_code < 400:
166167
return
167168
status_code = r.status_code
168169
except IOError as e:
169170
log.error(e)
171+
sleep(3)
170172
log.error('HTTP health check failed -> %s, status_code -> %s !', url, status_code)
171173
raise JujuAssertionError('gitlab is not healthy')
172174

@@ -185,6 +187,14 @@ def assess_caas_charm_deployment(client):
185187
if not caas_client.is_cluster_healthy:
186188
raise JujuAssertionError('k8s cluster is not healthy because kubectl is not accessible')
187189

190+
# tmp fix kubernetes core ingress issue
191+
caas_client.kubectl(
192+
'patch', 'daemonset.apps/nginx-ingress-kubernetes-worker-controller', '--patch',
193+
'''
194+
{"spec": {"template": {"spec": {"containers": [{"name": "nginx-ingress-kubernetes-worker","args": ["/nginx-ingress-controller", "--default-backend-service=$(POD_NAMESPACE)/default-http-backend", "--configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf", "---enable-ssl-chain-completion=False", "--publish-status-address=%s"]}]}}}}
195+
''' % caas_client.get_first_worker_ip()
196+
)
197+
188198
# add caas model for deploying caas charms on top of it
189199
model_name = 'testcaas'
190200
k8s_model = caas_client.add_model(model_name)
@@ -214,12 +224,10 @@ def assess_caas_charm_deployment(client):
214224
k8s_model.deploy(
215225
charm="cs:~juju/gitlab-k8s-0",
216226
config='juju-external-hostname={}'.format(external_hostname),
217-
resource="gitlab_image=gitlab/gitlab-ee:11.5.4-ee.0",
218227
)
219228

220229
k8s_model.deploy(
221230
charm="cs:~juju/mariadb-k8s-0",
222-
resource="mysql_image=mysql/mysql-server:5.7",
223231
storage='database=10M,{pool_name}'.format(pool_name=mariadb_storage_pool_name),
224232
)
225233

acceptancetests/jujupy/client.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,11 +2182,13 @@ def kubectl_apply(self, stdin):
21822182
log.debug(o)
21832183

21842184
def get_external_hostname(self):
2185-
status = self.client.get_status()
21862185
# assume here always use single node cdk core or microk8s
2186+
return '{}.xip.io'.format(self.get_first_worker_ip())
2187+
2188+
def get_first_worker_ip(self):
2189+
status = self.client.get_status()
21872190
unit = status.get_unit('kubernetes-worker/{}'.format(0))
2188-
ip = status.get_machine_dns_name(unit['machine'])
2189-
return '{}.xip.io'.format(ip)
2191+
return status.get_machine_dns_name(unit['machine'])
21902192

21912193

21922194
def register_user_interactively(client, token, controller_name):

0 commit comments

Comments
 (0)