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

feat(atlantis): add containerPort custom #444

Merged
merged 11 commits into from
Jan 2, 2025
Merged
2 changes: 1 addition & 1 deletion charts/atlantis/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
appVersion: v0.32.0
description: A Helm chart for Atlantis https://www.runatlantis.io
name: atlantis
version: 5.12.0
version: 5.13.0
keywords:
- terraform
home: https://www.runatlantis.io
Expand Down
3 changes: 2 additions & 1 deletion charts/atlantis/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ extraManifests:
| command | list | `[]` | Override the command field of the Atlantis container. |
| commonLabels | object | `{}` | Common Labels for all resources created by this chart. |
| config | string | `""` | Override atlantis main configuration by config map, ref: https://www.runatlantis.io/docs/using-slack-hooks.html#configuring-atlantis. Check values.yaml for examples. |
| containerPort | int | `0` | [optional] Define the port you would like atlantis to run on. When 0, the value of service.targetPort is used. |
| containerSecurityContext | object | `{}` | Check values.yaml for examples. |
| customPem | string | `""` | Allows to override the /etc/ssl/certs/ca-certificates.cer with your custom one. You have to create a secret with the specified name. |
| dataStorage | string | `""` | DEPRECATED - Disk space available to check out repositories. Example: 5Gi. |
Expand All @@ -100,7 +101,7 @@ extraManifests:
| dnsPolicy | string | `"ClusterFirst"` | Optionally specify dnsPolicy parameter to specify a DNS policy for a pod Check https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy |
| enableDiffMarkdownFormat | bool | `false` | Use Diff Markdown Format for color coding diffs. |
| enableKubernetesBackend | bool | `false` | Optionally deploy rbac to allow for the serviceAccount to manage terraform state via the kubernetes backend. |
| environment | object | `{}` | Environtment values to add to the Atlantis pod. Check values.yaml for examples. |
| environment | object | `{}` | Environment values to add to the Atlantis pod. Check values.yaml for examples. |
| environmentRaw | list | `[]` | Optionally specify additional environment variables in raw yaml format. Useful to specify variables refering to k8s objects. Check values.yaml for examples. |
| environmentSecrets | list | `[]` | Optionally specify additional environment variables to be populated from Kubernetes secrets. Useful for passing in TF_VAR_foo or other secret environment variables from Kubernetes secrets. Check values.yaml for examples. |
| extraAnnotations | object | `{}` | |
Expand Down
7 changes: 7 additions & 0 deletions charts/atlantis/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,10 @@ Define PATH environment variable that will be used system-wide.
{{- end -}}
{{- printf "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" }}
{{- end -}}

{{/*
Sets the container port based on the defined values.
*/}}
{{- define "atlantis.containerPort" -}}
{{- default .Values.service.targetPort .Values.containerPort }}
{{- end -}}
8 changes: 4 additions & 4 deletions charts/atlantis/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ spec:
{{- end }}
ports:
- name: atlantis
containerPort: {{ .Values.service.targetPort }}
containerPort: {{ include "atlantis.containerPort" . }}
{{- with .Values.lifecycle }}
lifecycle: {{ toYaml . | nindent 12 }}
{{- end }}
Expand Down Expand Up @@ -331,7 +331,7 @@ spec:
value: {{ .Values.orgWhitelist | quote }}
{{- end }}
- name: ATLANTIS_PORT
value: {{ .Values.service.targetPort | quote }}
value: {{ include "atlantis.containerPort" . | quote }}
{{- if .Values.repoConfig }}
- name: ATLANTIS_REPO_CONFIG
value: /etc/atlantis/repos.yaml
Expand Down Expand Up @@ -528,7 +528,7 @@ spec:
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.service.targetPort }}
port: {{ include "atlantis.containerPort" . }}
scheme: {{ .Values.livenessProbe.scheme }}
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
Expand All @@ -540,7 +540,7 @@ spec:
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.service.targetPort }}
port: {{ include "atlantis.containerPort" . }}
scheme: {{ .Values.readinessProbe.scheme }}
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
Expand Down
15 changes: 11 additions & 4 deletions charts/atlantis/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@
}
}
},
"containerPort": {
jullianow marked this conversation as resolved.
Show resolved Hide resolved
"description": "Port for the Atlantis container, when necessary specify a value different from the Service's targetPort",
"type": [
"integer"
],
"default": 0
},
"image": {
"type": "object",
"description": "Atlantis image configuration.",
Expand Down Expand Up @@ -336,10 +343,10 @@
"type": "string",
"description": "Default Atlantis distribution to be used by atlantis server. Either opentofu or terraform",
"default": "terraform",
"enum": [
"terraform",
"opentofu"
]
"enum": [
"terraform",
"opentofu"
]
},
"defaultTFVersion": {
"type": "string",
Expand Down
7 changes: 5 additions & 2 deletions charts/atlantis/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,16 @@ serviceAccountSecrets: {}
# Default values for atlantis (override as needed).
## -------------------------- ##

# -- (int) [optional] Define the port you would like atlantis to run on. When 0, the value of service.targetPort is used.
containerPort: 0

image:
repository: ghcr.io/runatlantis/atlantis
# -- If not set appVersion field from Chart.yaml is used
tag: ""
pullPolicy: Always

# -- Optionally specify an array of imagePullSecrets.
# -- Optionally specify an array of imagePullSecrets.
# Secrets must be manually created in the namespace.
# ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/.
# Check values.yaml for examples.
Expand Down Expand Up @@ -497,7 +500,7 @@ tlsSecretName: ""
# -- Additional path (`:` separated) that will be appended to the system `PATH` environment variable.
extraPath: ""

# -- Environtment values to add to the Atlantis pod.
# -- Environment values to add to the Atlantis pod.
# Check values.yaml for examples.
environment: {}
# environment:
Expand Down
Loading