From 52712a0d9a4ce00604b2434ec0bcdc9f0c0551d8 Mon Sep 17 00:00:00 2001 From: Marcelo Mello Date: Thu, 20 Jun 2019 16:40:08 -0400 Subject: [PATCH] Introduces the ability to pass annotations to the Kubernetes Ingress Controllers --- installer/inventory | 6 ++++++ .../kubernetes/templates/deployment.yml.j2 | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/installer/inventory b/installer/inventory index b0959f35b5..96c5cef8a8 100644 --- a/installer/inventory +++ b/installer/inventory @@ -26,6 +26,12 @@ dockerhub_base=ansible # pg_cpu_limit=1000 # pg_mem_limit=2 +# Kubernetes Ingress Annotations +# You can use the variables below to pass annotations to Kubernetes Ingress +# The example below shows an annotation to be used with Traefik but other Ingress controllers are also supported. +#kubernetes_ingress_hostname=awx.example.org +#kubernetes_ingress_annotations={'kubernetes.io/ingress.class': 'traefik', 'traefik.ingress.kubernetes.io/redirect-entry-point': 'https'} + # Kubernetes and Openshift Install Resource Requests # These are the request and limit values for a pod's container for task/web/rabbitmq/memcached/management. # The total amount of requested resources for a pod is the sum of all diff --git a/installer/roles/kubernetes/templates/deployment.yml.j2 b/installer/roles/kubernetes/templates/deployment.yml.j2 index fe9a52817a..1fe50ca0ec 100644 --- a/installer/roles/kubernetes/templates/deployment.yml.j2 +++ b/installer/roles/kubernetes/templates/deployment.yml.j2 @@ -373,11 +373,28 @@ kind: Ingress metadata: name: {{ kubernetes_deployment_name }}-web-svc namespace: {{ kubernetes_namespace }} +{% if kubernetes_ingress_annotations is defined %} + annotations: +{% for key, value in kubernetes_ingress_annotations.items() %} + {{ key }}: {{ value }} +{% endfor %} + +spec: + rules: + - host: {{ kubernetes_ingress_hostname }} + http: + paths: + - path: / + backend: + serviceName: {{ kubernetes_deployment_name }}-web-svc + servicePort: 80 +{% else %} spec: backend: serviceName: {{ kubernetes_deployment_name }}-web-svc servicePort: 80 {% endif %} +{% endif %} {% if openshift_host is defined %} --- apiVersion: v1