Skip to content

Commit

Permalink
#75 Add support for enabling websockets via values (#79)
Browse files Browse the repository at this point in the history
Signed-off-by: Torsten Walter <[email protected]>
  • Loading branch information
11000100111000 authored Oct 15, 2020
1 parent acb51f5 commit 48659a0
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
4 changes: 4 additions & 0 deletions charts/jenkins/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ 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.13.0
Added Support for websockets in the default Jcasc config
Added trailing slash to JENKINS_URL env var

## 2.12.2

Added unit tests for most resources in the Helm chart.
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.12.2
version: 2.13.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
1 change: 1 addition & 0 deletions charts/jenkins/VALUES_SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ The following tables list the configurable parameters of the Jenkins chart and t
#### Pod Configuration
| Parameter | Description | Default |
| -------------------------- | ----------------------------------------------- | ---------------------- |
| `agent.websocket` | Enables agent communication via websockets | false |
| `agent.podName` | Agent Pod base name | Not set |
| `agent.customJenkinsLabels`| Append Jenkins labels to the agent | `{}` |
| `agent.envVars` | Environment variables for the agent Pod | `[]` |
Expand Down
10 changes: 8 additions & 2 deletions charts/jenkins/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,27 @@ jenkins:
defaultsProviderTemplate: "{{ .Values.master.slaveDefaultsProviderTemplate }}"
connectTimeout: "{{ .Values.master.slaveConnectTimeout }}"
readTimeout: "{{ .Values.master.slaveReadTimeout }}"
{{- if .Values.master.slaveJenkinsUrl }}
{{- if .Values.agent.websocket }}
jenkinsUrl: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.master.servicePort}}{{ default "" .Values.master.jenkinsUriPrefix }}"
{{- else if .Values.master.slaveJenkinsUrl }}
jenkinsUrl: "{{ tpl .Values.master.slaveJenkinsUrl . }}"
{{- else if .Values.master.slaveKubernetesNamespace }}
jenkinsUrl: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}:{{.Values.master.servicePort}}{{ default "" .Values.master.jenkinsUriPrefix }}"
{{- else }}
jenkinsUrl: "http://{{ template "jenkins.fullname" . }}:{{.Values.master.servicePort}}{{ default "" .Values.master.jenkinsUriPrefix }}"
{{- end }}

{{- if not .Values.agent.websocket }}
{{- if .Values.master.slaveJenkinsTunnel }}
jenkinsTunnel: "{{ tpl .Values.master.slaveJenkinsTunnel . }}"
{{- else if .Values.master.slaveKubernetesNamespace }}
jenkinsTunnel: "{{ template "jenkins.fullname" . }}-agent.{{ template "jenkins.namespace" . }}:{{ .Values.master.slaveListenerPort }}"
{{- else }}
jenkinsTunnel: "{{ template "jenkins.fullname" . }}-agent:{{ .Values.master.slaveListenerPort }}"
{{- end }}
{{- else }}
webSocket: true
{{- end }}
maxRequestsPerHostStr: "32"
name: "kubernetes"
namespace: "{{ template "jenkins.master.slaveKubernetesNamespace" . }}"
Expand Down Expand Up @@ -180,7 +186,7 @@ Returns kubernetes pod template configuration as code
{{- if .Values.master.slaveJenkinsUrl }}
value: {{ tpl .Values.master.slaveJenkinsUrl . }}
{{- else }}
value: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.master.servicePort}}{{ default "" .Values.master.jenkinsUriPrefix }}"
value: "http://{{ template "jenkins.fullname" . }}.{{ template "jenkins.namespace" . }}.svc.{{.Values.clusterZone}}:{{.Values.master.servicePort}}{{ default "/" .Values.master.jenkinsUriPrefix }}"
{{- end }}
{{- if .Values.agent.imageTag }}
image: "{{ .Values.agent.image }}:{{ .Values.agent.imageTag }}"
Expand Down
10 changes: 5 additions & 5 deletions charts/jenkins/tests/jcasc-config-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ tests:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://RELEASE-NAME-jenkins.default.svc.cluster.local:8080"
value: "http://RELEASE-NAME-jenkins.default.svc.cluster.local:8080/"
image: "jenkins/inbound-agent:4.3-4"
privileged: "false"
resourceLimitCpu: 512m
Expand Down Expand Up @@ -167,7 +167,7 @@ tests:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080/"
image: "jenkins/inbound-agent:4.3-4"
privileged: "false"
resourceLimitCpu: 512m
Expand Down Expand Up @@ -195,7 +195,7 @@ tests:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080/"
image: "jenkins/jnlp-agent-maven:latest"
privileged: "false"
resourceLimitCpu: 512m
Expand Down Expand Up @@ -224,7 +224,7 @@ tests:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080"
value: "http://RELEASE-NAME-jenkins.controller-namespace.svc.cluster.local:8080/"
image: "python:3"
privileged: "false"
resourceLimitCpu: 512m
Expand Down Expand Up @@ -450,7 +450,7 @@ tests:
envVars:
- envVar:
key: "JENKINS_URL"
value: "http://my-release-jenkins.other.svc.cluster.local:8080"
value: "http://my-release-jenkins.other.svc.cluster.local:8080/"
image: "my-image/jnlp:v1.2.3"
privileged: "true"
resourceLimitCpu: 1024m
Expand Down
1 change: 1 addition & 0 deletions charts/jenkins/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ agent:
# name of the secret to be used for image pulling
imagePullSecretName:
componentName: "jenkins-slave"
websocket: false
privileged: false
runAsUser:
runAsGroup:
Expand Down

0 comments on commit 48659a0

Please sign in to comment.