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

Be a TLS enabled LoadBalancer #41

Open
wants to merge 2 commits into
base: master
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
9 changes: 9 additions & 0 deletions charts/drone/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,12 @@ Create the name of the service account to use
{{ default "default" .Values.serviceAccount.name }}
{{- end -}}
{{- end -}}

{{/*
TLS enabled via extraVolumes
*/}}
{{- define "drone.tlsEnabled" -}}
{{- if or (hasKey .Values.env "DRONE_TLS_AUTOCERT") (hasKey .Values.env "DRONE_TLS_CERT") -}}
true
{{- end -}}
{{- end -}}
5 changes: 5 additions & 0 deletions charts/drone/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,12 @@ spec:
livenessProbe:
httpGet:
path: /
{{- if (include "drone.tlsEnabled" .) }}
port: 443
scheme: HTTPS
{{- else }}
port: http
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
envFrom:
Expand Down
11 changes: 11 additions & 0 deletions charts/drone/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@ metadata:
{{- include "drone.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
{{- if eq "LoadBalancer" .Values.service.type }}
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
ports:
{{- range $key, $val := .Values.servicePorts }}
- port: {{ $val.port }}
targetPort: {{ $val.targetPort }}
protocol: {{ $val.protocol }}
name: {{ $key }}
{{- end }}
{{- else }}
ports:
- port: {{ .Values.service.port }}
targetPort: http
protocol: TCP
name: http
{{- end }}
selector:
{{- include "drone.selectorLabels" . | nindent 4 }}
13 changes: 12 additions & 1 deletion charts/drone/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ service:
type: ClusterIP
port: 80

## For a LoadBalancer service define the ports to use
servicePorts: {}
# http:
# port: 80
# targetPort: 80
# protocol: TCP
# https:
# port: 443
# targetPort: 443
# protocol: TCP

ingress:
enabled: false
annotations: {}
Expand Down Expand Up @@ -159,7 +170,7 @@ env:
## REQUIRED: Set the user-visible Drone hostname, sans protocol.
## Ref: https://docs.drone.io/installation/reference/drone-server-host/
##
DRONE_SERVER_HOST: ""
DRONE_SERVER_HOST: "chart-example.local"
## The protocol to pair with the value in DRONE_SERVER_HOST (http or https).
## Ref: https://docs.drone.io/installation/reference/drone-server-proto/
##
Expand Down