Skip to content

Allow for the use of service serving certificates with OpenShift #94

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions templates/config-map.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,14 @@ data:
{{- if .Values.env.configFilePath }}
{{ .Files.Get .Values.env.configFilePath | indent 2 }}
{{- end }}

{{- if and .Values.openshift.enabled .Values.openshift.serviceServingCertificates }}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: terraform-enterprise-ca-certificates
namespace: {{ .Release.Namespace }}
annotations:
service.beta.openshift.io/inject-cabundle: "true"
{{- end}}
9 changes: 9 additions & 0 deletions templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,11 @@ spec:
secret:
secretName: terraform-enterprise-ca-certificates
{{- end }}
{{- if and .Values.openshift.enabled .Values.openshift.serviceServingCertificates }}
- name: ca-certificates
configMap:
name: terraform-enterprise-ca-certificates
{{- end}}
{{- if .Values.csi.enabled }}
- name: secrets-store
csi:
Expand Down Expand Up @@ -139,6 +144,10 @@ spec:
mountPath: {{ include "cacert.path" . }}
subPath: {{ .Values.tls.caCertFileName }}
{{- end }}
{{- if and .Values.openshift.enabled .Values.openshift.serviceServingCertificates }}
- name: ca-certificates
mountPath: {{ .Values.tls.caCertBaseDir }}/service-ca.crt
subPath: service-ca.crt
{{- if .Values.csi.enabled }}
- name: secrets-store
mountPath: "{{ .Values.csi.mountPath }}"
Expand Down
20 changes: 20 additions & 0 deletions templates/route.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if and .Values.openshift.enabled .Values.openshift.serviceServingCertificates }}
---
kind: Route
apiVersion: route.openshift.io/v1
metadata:
name: terraform-enterprise
namespace: {{ .Release.Namespace }}
spec:
host: {{ .Values.env.variables.TFE_HOSTNAME }}
to:
kind: Service
name: terraform-enterprise
weight: 100
port:
targetPort: https-port
tls:
termination: reencrypt
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
{{- end }}
7 changes: 6 additions & 1 deletion templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,14 @@ kind: Service
metadata:
name: terraform-enterprise
namespace: {{ .Release.Namespace }}
{{- with .Values.service.annotations }}
{{- if or .Values.service.annotations (and .Values.openshift.enabled .Values.openshift.serviceServingCertificates) }}
annotations:
{{- with .Values.service.annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- if and .Values.openshift.enabled .Values.openshift.serviceServingCertificates }}
service.beta.openshift.io/serving-cert-secret-name: terraform-enterprise-certificates
{{- end }}
{{- end }}
{{- with .Values.service.labels }}
labels:
Expand Down
3 changes: 3 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,9 @@ agentWorkerPodTemplate: {}
openshift:
# If true, the Helm chart will create necessary configuration for running its components on OpenShift.
enabled: false
# If true, the Helm chart will create necessary configuration for using service serving certificates from the OpenShift service.
# openshift.enabled must be true for this to take effect.
serviceServingCertificates: false

env:
# configFilePath: env-config.yaml
Expand Down