Skip to content

Commit

Permalink
Added automatic PORT environment variable
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed Dec 15, 2020
1 parent e3a1f4b commit 5a8b9f1
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
16 changes: 9 additions & 7 deletions charts/generic-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ app:

In addition to the environment variables specified via the `env` value, the following dynamic environment variables are automatically set:

| Value | Description |
| --------------- | -------------------------------------------------------- |
| `POD_NAME` | The name of the Kubernetes pod |
| `POD_NAMESPACE` | The namespace of the Kubernetes pod |
| `POD_IP` | The cluster-internal IP of the Kubernetes pod |
| `NODE_NAME` | The name of the Kubernetes node the pod is running on |
| `CONFIG_FILE` | `:`-separated list of paths of mounted YAML config files |
| Value | Description |
| --------------- | --------------------------------------------------------- |
| `POD_NAME` | The name of the Kubernetes pod |
| `POD_NAMESPACE` | The namespace of the Kubernetes pod |
| `POD_IP` | The cluster-internal IP of the Kubernetes pod |
| `NODE_NAME` | The name of the Kubernetes node the pod is running on |
| `CONFIG_FILE` | `:`-separated list of paths of mounted YAML config files |
| `PORT` | The `ingress.port` (if `ingress.enabled` is `true`) |
| `METRICS_PORT` | The `monitoring.port` (if `monitoring.enabled` is `true`) |

## Resources

Expand Down
4 changes: 4 additions & 0 deletions charts/generic-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ spec:
valueFrom:
fieldRef:
fieldPath: spec.nodeName
{{- if .Values.ingress.enabled }}
- name: PORT
value: {{ .Values.ingress.port | quote }}
{{- end }}
{{- if .Values.monitoring.enabled }}
- name: METRICS_PORT
value: {{ .Values.monitoring.port | quote }}
Expand Down

0 comments on commit 5a8b9f1

Please sign in to comment.