Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for HTTPs when using NodePort. #1688

Open
wants to merge 2 commits into
base: devel
Choose a base branch
from

Conversation

OndrejHome
Copy link

SUMMARY

Add support for HTTPs when using NodePort.

Introduces two new options:

  • nodeport_protocol - selectable http(default)/https
  • nodeport_tls_secret - name of secret containing TLS certificate and key

When nodeport_protocol is set to https the nodeport_tls_secret must contain name of secret containing TLS key and certificate that will be used by nginx in AWX web container exposing HTTPS traffic through NodePort.

Github issues asking for https on nodeport support: #1559, #1563

ISSUE TYPE
  • New or Enhanced Feature
ADDITIONAL INFORMATION

Tested on kubernetes 1.28.5, deploying AWX 23.5.1.
Unless the nodeport_protocol: https is specified in spec there should be no change in behaviour (NodePort will be HTTP without encryption).
When nodeport_protocol: https is specified in spec then code will add secret specified in nodeport_tls_secret to web container so that nginx running inside can read both TLS key and certificate from it. Additionally nginx configuration in such case will include SSL configuration on port 8053 and the service pointing to web container will point to port 8053 where HTTPS is exposed instead of the port 8052 with HTTP traffic.

A lot of changes are re-using logic from Route TLS configuration. Documentation was updated as well to contain both original example with NodePort operating in HTTP mode and new changed configuration showing the use of HTTPS.

Why is this change useful? To allow kubernetes without ingress to expose AWX web interface via HTTPS - this allows the awx.awx ansible modules to be used as they require the encrypted connection (plain HTTP will not work with them).

Comment and suggestions are welcomed. My responses may be delayed during weekdays.

Introduces two new options:
- 'nodeport_protocol' - selectable 'http'(default)/'https'
- 'nodeport_tls_secret' - name of secret containing TLS certificate and key

When 'nodeport_protocol' is set to 'https' the 'nodeport_tls_secret'
must contain name of secret containing TLS key and certifacate that
will be used by nginx in AWX web container exposing HTTPS traffic
through NodePort.

Github issues asking for https on nodeport support: ansible#1559, ansible#1563
- port: 80
protocol: TCP
targetPort: 8052
name: http
{% if nodeport_port is defined %}
nodePort: {{ nodeport_port }}
{% endif %}
{% elif service_type | lower == "nodeport" and nodeport_protocol | lower == "https" %}
- port: 80
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be 443?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, that is nice catch! yes it should be 443 for consistency. Now addressed in commit 778b32d

@rooftopcellist
Copy link
Member

I haven't looked closely yet, but we should double-check and make sure that there are not any changes needed in the nginx.conf:

@OndrejHome
Copy link
Author

I haven't looked closely yet, but we should double-check and make sure that there are not any changes needed in the nginx.conf:

* https://github.com/ansible/awx-operator/blob/devel/roles/installer/templates/configmaps/config.yaml.j2#L130

Yes, this PR is adjusting the nginx.conf - more specifically the "https nodeport" is using same config as the "route passthrough". Or you mean if there are any changes needed inside (lines 131-139) ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants