ansible/awx-operator

ingress_path needs a * for GKE ingress

Open

#948 opened on Jun 13, 2022

View on GitHub
 (5 comments) (0 reactions) (0 assignees)Jinja (712 forks)auto 404
help wanted

Repository metrics

Stars
 (1,488 stars)
PR merge metrics
 (PR metrics pending)

Description

Please confirm the following

  • I agree to follow this project's code of conduct.
  • I have checked the current issues for duplicates.
  • I understand that the AWX Operator is open source software provided for free and that I might not receive a timely response.

Bug Summary

On GKE, I use an HTTP(s) load balancer. In order for it to work, I needed to modify the ingress spec the operator creates to append a /* to it. See Additional information for the details.

I'm happy to work on putting this into a proper PR, my question is how to do it - I understand that Google-specific settings are probably not desirable, does anyone have a suggestion?

AWX Operator version

0.22.0

AWX version

21.0.0

Kubernetes platform

other (please specify in additional information)

Kubernetes/Platform version

v1.21.11-gke.900

Modifications

yes

Steps to reproduce

Deploy AWX in GKE with an HTTP load balancer in front of it Deployment will succeed, but AWX will never become usable as it won't be routing the correct path prefix.

Expected results

AWX to come up and work

Actual results

I needed to modify the operator to append a /*

Additional information

Spec snippet:

spec:
  ingress_type: ingress
  ingress_path: /
  ingress_path_type: ImplementationSpecific
  ingress_tls_secret: awx-domain-com-tls
  ingress_annotations: |
    kubernetes.io/ingress.global-static-ip-name: awx-lb
    networking.gke.io/v1beta1.FrontendConfig: "tls-modern"
    cloud.google.com/backend-config: '{"ports": {"80":"awx-backendconfig"}}'
  service_annotations: |
    cloud.google.com/backend-config: '{"ports": {"80":"awx-backendconfig"}}'
    cloud.google.com/neg: '{"ingress": true}'

The patch I created:

diff --git a/roles/installer/templates/ingress.yaml.j2 b/roles/installer/templates/ingress.yaml.j2
index 57cf42e..715ffb2 100644
--- a/roles/installer/templates/ingress.yaml.j2
+++ b/roles/installer/templates/ingress.yaml.j2
@@ -19,7 +19,7 @@ spec:
   rules:
     - http:
         paths:
-          - path: '{{ ingress_path }}'
+          - path: '{{ (ingress_path + '/*').replace("//","/") }}'
             pathType: '{{ ingress_path_type }}'
             backend:
               service:

The final ingress looks like this:

spec:
  rules:
  - host: awx.domain.com
    http:
      paths:
      - backend:
          service:
            name: awx-service
            port:
              number: 80
        path: /*
        pathType: ImplementationSpecific
  tls:
  - hosts:
    - awx.domain.com
    secretName: awx-domain-com-tls
status:
  loadBalancer:
    ingress:
    - ip: 1.2.3.4

Operator Logs

No response

Contributor guide