providers/proxy: fix creation of ingress
This commit is contained in:
parent
6596bc6034
commit
05866d3544
|
@ -179,13 +179,13 @@ stages:
|
|||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
export PB_TEST_K8S=true
|
||||
sudo pip install -U wheel pipenv
|
||||
pipenv install --dev
|
||||
- task: CmdLine@2
|
||||
displayName: Run full test suite
|
||||
inputs:
|
||||
script: |
|
||||
export PB_TEST_K8S=true
|
||||
pipenv run coverage run ./manage.py test passbook -v 3
|
||||
- task: CmdLine@2
|
||||
inputs:
|
||||
|
@ -221,7 +221,6 @@ stages:
|
|||
- task: CmdLine@2
|
||||
inputs:
|
||||
script: |
|
||||
export PB_TEST_K8S=true
|
||||
sudo pip install -U wheel pipenv
|
||||
pipenv install --dev
|
||||
- task: DockerCompose@0
|
||||
|
@ -241,6 +240,7 @@ stages:
|
|||
displayName: Run full test suite
|
||||
inputs:
|
||||
script: |
|
||||
export PB_TEST_K8S=true
|
||||
pipenv run coverage run ./manage.py test e2e -v 3 --failfast
|
||||
- task: CmdLine@2
|
||||
condition: always()
|
||||
|
|
|
@ -69,7 +69,7 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
|
|||
spec=V1PodSpec(
|
||||
containers=[
|
||||
V1Container(
|
||||
name=self.outpost.type,
|
||||
name=str(self.outpost.type),
|
||||
image=f"{self.image_base}-{self.outpost.type}:{__version__}",
|
||||
ports=container_ports,
|
||||
env=[
|
||||
|
|
|
@ -56,7 +56,6 @@ class KubernetesController(BaseController):
|
|||
documents = []
|
||||
for reconcile_key in self.reconcile_order:
|
||||
reconciler = self.reconcilers[reconcile_key](self)
|
||||
reconciler.up()
|
||||
documents.append(reconciler.get_reference_object().to_dict())
|
||||
|
||||
with StringIO() as _str:
|
||||
|
|
|
@ -56,7 +56,10 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]):
|
|||
have_hosts = [rule.host for rule in reference.spec.rules]
|
||||
have_hosts.sort()
|
||||
|
||||
have_hosts_tls = reference.spec.tls.hosts
|
||||
have_hosts_tls = []
|
||||
for tls_config in reference.spec.tls:
|
||||
if tls_config:
|
||||
have_hosts_tls += tls_config.hosts
|
||||
have_hosts_tls.sort()
|
||||
|
||||
if have_hosts != expected_hosts:
|
||||
|
@ -102,7 +105,7 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]):
|
|||
)
|
||||
return NetworkingV1beta1Ingress(
|
||||
metadata=meta,
|
||||
spec=NetworkingV1beta1IngressSpec(rules=rules, tls=tls_config),
|
||||
spec=NetworkingV1beta1IngressSpec(rules=rules, tls=[tls_config]),
|
||||
)
|
||||
|
||||
def create(self, reference: NetworkingV1beta1Ingress):
|
||||
|
|
|
@ -31,9 +31,9 @@ class TestControllers(TestCase):
|
|||
outpost.providers.add(provider)
|
||||
outpost.save()
|
||||
|
||||
controller = ProxyKubernetesController(outpost.pk)
|
||||
controller = ProxyKubernetesController(outpost)
|
||||
manifest = controller.get_static_deployment()
|
||||
self.assertEqual(len(list(yaml.load_all(manifest, Loader=yaml.SafeLoader))), 3)
|
||||
self.assertEqual(len(list(yaml.load_all(manifest, Loader=yaml.SafeLoader))), 4)
|
||||
|
||||
def test_kubernetes_controller_deploy(self):
|
||||
"""Test Kubernetes Controller"""
|
||||
|
@ -51,5 +51,6 @@ class TestControllers(TestCase):
|
|||
outpost.providers.add(provider)
|
||||
outpost.save()
|
||||
|
||||
controller = ProxyKubernetesController(outpost.pk)
|
||||
controller = ProxyKubernetesController(outpost)
|
||||
controller.up()
|
||||
controller.down()
|
||||
|
|
Reference in a new issue