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

Add secondary ingress #63

Merged
merged 7 commits into from
Sep 22, 2020
Merged
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
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 -}}
timja marked this conversation as resolved.
Show resolved Hide resolved
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: []
timja marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about putting the github webhook in here by default commented out?

I suspect that would be what it's used for the majority of the time

Suggested change
paths: []
paths: []
#paths:
# - /github-webhook

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does helm merge or overwrite arrays?
if its merge, that would mean there's no way to disable it

What about the straight up non github webhook? I think its /notifyCommit
What about prefixes? by making it need to be configured, its able to be prefixed, the default wouldn't be.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, it overwrites a list, so it would be doable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had it commented out to avoid those issues 👅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooh i get what your saying, i can change it if desired when i'm on a computer again

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is fine 🚢

# 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