tmforum-oda / oda-ca

Apache License 2.0
6 stars 8 forks source link

apiOperatorIstio failing when ingressTarget is IP instead hostname #77

Closed virangpaneri closed 1 year ago

virangpaneri commented 1 year ago

Facing issue while implementing canvas on On-Premise environment where Load Balancers return IP addresses unlike hostname returned by Public Cloud Load Balancers.

In this case API endpoint will have IP instead of hostname, so buildAPIStatus function in apiOperatorIstio is failing with below error because ingressTarget key hostname has no value.

[2022-12-07 08:42:01,538] kopf.objects [ERROR ] [components/r1-productcatalog-partyrole] Handler 'apiStatus' failed with an exception. Will retry. Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/kopf/_core/actions/execution.py", line 292, in execute_handler_once subrefs=subrefs, File "/usr/local/lib/python3.7/site-packages/kopf/_core/actions/execution.py", line 386, in invoke_handler runtime=runtime, File "/usr/local/lib/python3.7/site-packages/kopf/_core/actions/invocation.py", line 140, in invoke await asyncio.shield(future) # slightly expensive: creates tasks File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run result = self.fn(*self.args, **self.kwargs) File "apiOperatorIstio/apiOperatorIstio.py", line 62, in apiStatus return actualToDesiredState(spec, status, namespace, name) File "apiOperatorIstio/apiOperatorIstio.py", line 93, in actualToDesiredState return createOrPatchVirtualService(False, spec, namespace, name) File "apiOperatorIstio/apiOperatorIstio.py", line 191, in createOrPatchVirtualService apistatus = buildAPIStatus(spec, apistatus, ingressTarget) File "apiOperatorIstio/apiOperatorIstio.py", line 265, in buildAPIStatus parent_api_status['apiStatus']['url'] = HTTP_SCHEME + ingressTarget['hostname'] + parent_api_spec['path'] TypeError: can only concatenate str (not "NoneType") to str