Skip to content

Commit

Permalink
Add secondary ingress (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
halkeye authored Sep 22, 2020
1 parent ba723ae commit 783d670
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 1 deletion.
7 changes: 7 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@ Use the following links to reference issues, PRs, and commits prior to v2.6.0.

The change log until v1.5.7 was auto-generated based on git commits. Those entries include a reference to the git commit to be able to get more details.

## 2.7.0

Add a secondary ingress template for those who want a second ingress with different labels or annotations or whatever else.

Example: You want /github-webhook to be on a public ingress, while the main Jenkins intance to be on a private locked down ingress.

## 2.6.5

Update configScripts example

## 2.6.4
Expand Down
2 changes: 1 addition & 1 deletion charts/jenkins/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
name: jenkins
home: https://jenkins.io/
version: 2.6.5
version: 2.7.0
appVersion: lts
description: Open source continuous integration server. It supports multiple SCM tools
including CVS, Subversion and Git. It can execute Apache Ant and Apache Maven-based
Expand Down
40 changes: 40 additions & 0 deletions charts/jenkins/templates/jenkins-master-secondary-ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{- if .Values.master.secondaryingress.enabled }}
{{- $serviceName := include "jenkins.fullname" . -}}
{{- $servicePort := .Values.master.servicePort -}}
{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: {{ .Values.master.secondaryingress.apiVersion }}
{{- end }}
kind: Ingress
metadata:
namespace: {{ template "jenkins.namespace" . }}
labels:
"app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
"helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}"
"app.kubernetes.io/managed-by": "{{ .Release.Service }}"
"app.kubernetes.io/instance": "{{ .Release.Name }}"
"app.kubernetes.io/component": "{{ .Values.master.componentName }}"
{{- if .Values.master.secondaryingress.labels -}}
{{ toYaml .Values.master.secondaryingress.labels | nindent 4 }}
{{- end }}
{{- if .Values.master.secondaryingress.annotations }}
annotations: {{ toYaml .Values.master.secondaryingress.annotations | nindent 4 }}
{{- end }}
name: {{ template "jenkins.fullname" . }}-secondary
spec:
rules:
- host: {{ .Values.master.secondaryingress.hostName }}
http:
paths:
{{- range .Values.master.secondaryingress.paths }}
- path: {{ . | quote }}
backend:
serviceName: {{ $serviceName }}
servicePort: {{ $servicePort }}
{{- end}}
{{- if .Values.master.secondaryingress.tls }}
tls:
{{ toYaml .Values.master.secondaryingress.tls | indent 4 }}
{{- end -}}
{{- end }}
22 changes: 22 additions & 0 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,28 @@ master:
# hosts:
# - jenkins.cluster.local

# often you want to have your controller all locked down and private
# but you still want to get webhooks from your SCM
# A secondary ingress will let you expose different urls
# with a differnt configuration
secondaryingress:
enabled: false
# paths you want forwarded to the backend
# ex /github-webhook
paths: []
# For Kubernetes v1.14+, use 'networking.k8s.io/v1beta1'
apiVersion: "extensions/v1beta1"
labels: {}
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
# configures the hostname e.g. jenkins-external.example.com
hostName:
tls:
# - secretName: jenkins-external.example.com
# hosts:
# - jenkins-external.example.com

# If you're running on GKE and need to configure a backendconfig
# to finish ingress setup, use the following values.
# Docs: https://cloud.google.com/kubernetes-engine/docs/concepts/backendconfig
Expand Down

0 comments on commit 783d670

Please sign in to comment.