Skip to content

Commit

Permalink
Auto-assign NodePort port by default rather than hardcoding a default…
Browse files Browse the repository at this point in the history
… value

 - previously, there was no way to auto-assign a port by default
   which led to conflicts with other deployments at times
 - nodeport_port param can still be used to specify a port if desired
  • Loading branch information
rooftopcellist committed Feb 10, 2023
1 parent 234a10d commit 1ef1f00
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
2 changes: 0 additions & 2 deletions README.md
Expand Up @@ -199,8 +199,6 @@ metadata:
name: awx-demo
spec:
service_type: nodeport
# default nodeport_port is 30080
nodeport_port: <nodeport_port>
```

> It may make sense to create and specify your own secret key for your deployment so that if the k8s secret gets deleted, it can be re-created if needed. If it is not provided, one will be auto-generated, but cannot be recovered if lost. Read more [here](#secret-key-configuration).
Expand Down
1 change: 0 additions & 1 deletion config/crd/bases/awx.ansible.com_awxs.yaml
Expand Up @@ -153,7 +153,6 @@ spec:
nodeport_port:
description: Port to use for the nodeport
type: integer
default: 30080
node_selector:
description: nodeSelector for the pods
type: string
Expand Down
4 changes: 3 additions & 1 deletion roles/installer/defaults/main.yml
Expand Up @@ -40,7 +40,9 @@ loadbalancer_protocol: 'http'
loadbalancer_port: '80'
service_annotations: ''

nodeport_port: '30080'
# Port to be used for NodePort configuration, default is to auto-assign a port between 30000-32768
#nodeport_port: '30080'

# The TLS termination mechanism to use to access
# the services. Supported mechanism are: edge, passthrough
#
Expand Down
2 changes: 2 additions & 0 deletions roles/installer/templates/networking/service.yaml.j2
Expand Up @@ -19,7 +19,9 @@ spec:
protocol: TCP
targetPort: 8052
name: http
{% if nodeport_port is defined %}
nodePort: {{ nodeport_port }}
{% endif %}
{% elif service_type | lower != 'loadbalancer' and loadbalancer_protocol | lower != 'https' %}
- port: 80
protocol: TCP
Expand Down

0 comments on commit 1ef1f00

Please sign in to comment.