Skip to content

Commit

Permalink
Merge pull request #128 from billett83/devel
Browse files Browse the repository at this point in the history
fixes #127 Provided service type LoadBalancer
  • Loading branch information
shanemcd authored Mar 23, 2021
2 parents b00de51 + 76acd33 commit 3df272d
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 3 deletions.
22 changes: 21 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ stringData:

By default, the AWX operator is not opinionated and won't force a specific ingress type on you. So, if `tower_ingress_type` is not specified as part of the Custom Resource specification, it will default to `none` and nothing ingress-wise will be created.

The AWX operator provides support for two kind of `Ingress` to access AWX: `Ingress` and `Route`, To toggle between these two options, you can add the following to your AWX CR:
The AWX operator provides support for three kinds of `Ingress` to access AWX: `Ingress`, `Route` and `LoadBalancer`, To toggle between these options, you can add the following to your AWX CR:

* Route

Expand All @@ -132,6 +132,16 @@ spec:
tower_hostname: awx.mycompany.com
```

* LoadBalancer

```yaml
---
spec:
...
tower_ingress_type: LoadBalancer
tower_ingress_protocol: http
```

#### TLS Termination

* Route
Expand All @@ -153,6 +163,16 @@ The following variables are customizable to specify the TLS termination procedur
| tower_ingress_annotations | Ingress annotations | Empty string |
| tower_ingress_tls_secret | Secret that contains the TLS information | Empty string |

* LoadBalancer

The following variables are customizable to specify the TLS termination procedure when `LoadBalancer` is picked as an Ingress

| Name | Description | Default |
| ------------------------------ | ---------------------------------------- | ------------- |
| tower_loadbalancer_annotations | LoadBalancer annotations | Empty string |
| tower_loadbalancer_protocol | Protocol to use for Loadbalancer ingress | http |
| tower_loadbalancer_port | Port used for Loadbalancer ingress | 80 |


### Database Configuration

Expand Down
2 changes: 1 addition & 1 deletion ansible/instantiate-awx-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
spec:
tower_admin_user: test
tower_admin_email: [email protected]
tower_ingress_type: "{{ tower_ingress_type | default(omit) }}" # Either Route or Ingress
tower_ingress_type: "{{ tower_ingress_type | default(omit) }}" # Either Route, Ingress or LoadBalancer
tower_image: "{{ tower_image | default(omit) }}"
development_mode: "{{ development_mode | default(omit) }}"
tower_image_pull_policy: "{{ tower_image_pull_policy | default(omit) }}"
16 changes: 16 additions & 0 deletions ansible/templates/crd.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,28 @@ spec:
- ingress
- Route
- route
- LoadBalancer
- loadbalancer
tower_ingress_annotations:
description: Annotations to add to the ingress
type: string
tower_ingress_tls_secret:
description: Secret where the ingress TLS secret can be found
type: string
tower_loadbalancer_annotations:
description: Annotations to add to the loadbalancer
type: string
tower_loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
default: http
enum:
- http
- https
tower_loadbalancer_port:
description: Port to use for the loadbalancer
type: int32
default: 80
tower_route_host:
description: The DNS to use to points to the instance
type: string
Expand Down
16 changes: 16 additions & 0 deletions deploy/awx-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -216,12 +216,28 @@ spec:
- ingress
- Route
- route
- LoadBalancer
- loadbalancer
tower_ingress_annotations:
description: Annotations to add to the ingress
type: string
tower_ingress_tls_secret:
description: Secret where the ingress TLS secret can be found
type: string
tower_loadbalancer_annotations:
description: Annotations to add to the loadbalancer
type: string
tower_loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
default: http
enum:
- http
- https
tower_loadbalancer_port:
description: Port to use for the loadbalancer
type: number
default: 80
tower_route_host:
description: The DNS to use to points to the instance
type: string
Expand Down
16 changes: 16 additions & 0 deletions deploy/crds/awx_v1beta1_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,28 @@ spec:
- ingress
- Route
- route
- LoadBalancer
- loadbalancer
tower_ingress_annotations:
description: Annotations to add to the ingress
type: string
tower_ingress_tls_secret:
description: Secret where the ingress TLS secret can be found
type: string
tower_loadbalancer_annotations:
description: Annotations to add to the loadbalancer
type: string
tower_loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
default: http
enum:
- http
- https
tower_loadbalancer_port:
description: Port to use for the loadbalancer
type: number
default: 80
tower_route_host:
description: The DNS to use to points to the instance
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ spec:
- urn:alm:descriptor:com.tectonic.ui:select:none
- urn:alm:descriptor:com.tectonic.ui:select:Ingress
- urn:alm:descriptor:com.tectonic.ui:select:Route
- urn:alm:descriptor:com.tectonic.ui:select:LoadBalancer
- displayName: Tower Ingress Annotations
path: tower_ingress_annotations
x-descriptors:
Expand All @@ -132,6 +133,25 @@ spec:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:io.kubernetes:Secret
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:tower_ingress_type:Ingress
- displayName: Tower LoadBalancer Annotations
path: tower_loadbalancer_annotations
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:text
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:tower_ingress_type:LoadBalancer
- displayName: Tower LoadBalancer Protocol
path: tower_loadbalancer_protocol
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:select:http
- urn:alm:descriptor:com.tectonic.ui:select:https
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:tower_ingress_type:LoadBalancer
- displayName: Tower LoadBalancer Port
path: tower_loadbalancer_port
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:number
- urn:alm:descriptor:com.tectonic.ui:fieldDependency:tower_ingress_type:LoadBalancer
- displayName: Route DNS host
path: tower_route_host
x-descriptors:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,23 @@ spec:
- ingress
- Route
- route
- LoadBalancer
- loadbalancer
type: string
tower_loadbalancer_annotations:
description: Annotations to add to the loadbalancer
type: string
tower_loadbalancer_protocol:
description: Protocol to use for the loadbalancer
type: string
default: http
enum:
- http
- https
tower_loadbalancer_port:
description: Port to use for the loadbalancer
type: number
default: 80
tower_postgres_configuration_secret:
description: Secret where the database configuration can be found
type: string
Expand Down
3 changes: 3 additions & 0 deletions roles/installer/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ tower_ingress_annotations: ''
# certificate and key.
tower_ingress_tls_secret: ''

tower_loadbalancer_protocol: 'http'
tower_loadbalancer_port: '80'

# The TLS termination mechanism to use to access
# the services. Supported mechanism are: edge, passthrough
#
Expand Down
16 changes: 15 additions & 1 deletion roles/installer/templates/tower_service.yaml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,34 @@ metadata:
namespace: '{{ meta.namespace }}'
labels:
app: '{{ deployment_type }}'
{% if tower_ingress_type | lower == 'loadbalancer' %}
annotations:
{{ tower_loadbalancer_annotations | indent(width=4) }}
{% endif %}
spec:
ports:
{% if tower_ingress_type | lower != 'loadbalancer' and tower_loadbalancer_protocol | lower != 'https' %}
- port: 80
protocol: TCP
targetPort: 8052
name: http
{% endif %}
{% if tower_ingress_type | lower == 'route' and tower_route_tls_termination_mechanism | lower == 'passthrough' %}
- port: 443
protocol: TCP
targetPort: 8053
name: https
{% endif %}
{% if tower_ingress_type | lower == 'loadbalancer' and tower_loadbalancer_protocol | lower == 'https' %}
- port: 443
protocol: TCP
targetPort: 8052
name: https
{% endif %}
selector:
app: '{{ deployment_type }}'
{% if tower_ingress_type != "none" %}
{% if tower_ingress_type | lower == "loadbalancer" %}
type: LoadBalancer
{% elif tower_ingress_type != "none" %}
type: NodePort
{% endif %}

0 comments on commit 3df272d

Please sign in to comment.