Exemplo n.º 1
0
    def reconcile(self, current: NetworkingV1beta1Ingress,
                  reference: NetworkingV1beta1Ingress):
        super().reconcile(current, reference)
        self._check_annotations(reference)
        # Create a list of all expected host and tls hosts
        expected_hosts = []
        expected_hosts_tls = []
        for proxy_provider in ProxyProvider.objects.filter(
                outpost__in=[self.controller.outpost],
                forward_auth_mode=False,
        ):
            proxy_provider: ProxyProvider
            external_host_name = urlparse(proxy_provider.external_host)
            expected_hosts.append(external_host_name.hostname)
            if external_host_name.scheme == "https":
                expected_hosts_tls.append(external_host_name.hostname)
        expected_hosts.sort()
        expected_hosts_tls.sort()

        have_hosts = [rule.host for rule in reference.spec.rules]
        have_hosts.sort()

        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:
            raise NeedsUpdate()
        if have_hosts_tls != expected_hosts_tls:
            raise NeedsUpdate()
Exemplo n.º 2
0
 def _check_annotations(self, reference: NetworkingV1beta1Ingress):
     """Check that all annotations *we* set are correct"""
     for key, value in self.get_ingress_annotations().items():
         if key not in reference.metadata.annotations:
             raise NeedsUpdate()
         if reference.metadata.annotations[key] != value:
             raise NeedsUpdate()
Exemplo n.º 3
0
 def reconcile(self, current: V1Deployment, reference: V1Deployment):
     super().reconcile(current, reference)
     if current.spec.replicas != reference.spec.replicas:
         raise NeedsUpdate()
     if (current.spec.template.spec.containers[0].image !=
             reference.spec.template.spec.containers[0].image):
         raise NeedsUpdate()
Exemplo n.º 4
0
 def reconcile(self, current: V1Service, reference: V1Service):
     super().reconcile(current, reference)
     if len(current.spec.ports) != len(reference.spec.ports):
         raise NeedsUpdate()
     for port in reference.spec.ports:
         if port not in current.spec.ports:
             raise NeedsUpdate()
Exemplo n.º 5
0
 def reconcile(self, current: TraefikMiddleware,
               reference: TraefikMiddleware):
     super().reconcile(current, reference)
     if current.spec.forwardAuth.address != reference.spec.forwardAuth.address:
         raise NeedsUpdate()
Exemplo n.º 6
0
 def reconcile(self, current: V1Secret, reference: V1Secret):
     super().reconcile(current, reference)
     for key in reference.data.keys():
         if current.data[key] != reference.data[key]:
             raise NeedsUpdate()