diff --git a/bitnami/jenkins/Chart.yaml b/bitnami/jenkins/Chart.yaml index 83719028e..ac4e33de9 100644 --- a/bitnami/jenkins/Chart.yaml +++ b/bitnami/jenkins/Chart.yaml @@ -1,20 +1,20 @@ apiVersion: v1 name: jenkins -version: 4.0.2 +version: 4.0.3 appVersion: 2.190.2 description: The leading open source automation server keywords: -- jenkins -- ci -- cd -- http -- web -- application + - jenkins + - ci + - cd + - http + - web + - application home: https://jenkins.io/ sources: -- https://github.com/bitnami/bitnami-docker-jenkins + - https://github.com/bitnami/bitnami-docker-jenkins maintainers: -- name: Bitnami - email: containers@bitnami.com + - name: Bitnami + email: containers@bitnami.com engine: gotpl icon: https://bitnami.com/assets/stacks/jenkins/img/jenkins-stack-110x117.png diff --git a/bitnami/jenkins/README.md b/bitnami/jenkins/README.md index f38d1df22..f6a6a1213 100644 --- a/bitnami/jenkins/README.md +++ b/bitnami/jenkins/README.md @@ -53,7 +53,7 @@ The following tables lists the configurable parameters of the Jenkins chart and | ------------------------------------ | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | | `global.imageRegistry` | Global Docker image registry | `nil` | | `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | -| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | +| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | | `image.registry` | Jenkins image registry | `docker.io` | | `image.repository` | Jenkins Image name | `bitnami/jenkins` | | `image.tag` | Jenkins Image tag | `{TAG_NAME}` | @@ -66,15 +66,13 @@ The following tables lists the configurable parameters of the Jenkins chart and | `jenkinsHome` | Jenkins home directory | `/opt/bitnami/jenkins/jenkins_home` | | `disableInitialization` | Allows to disable the initial Bitnami configuration for Jenkins | `no` | | `javaOpts` | Customize JVM parameters | `nil` | -| `service.type` | Kubernetes Service type | `LoadBalancer` | -| `service.port` | Service HTTP port | `80` | -| `service.httpsPort` | Service HTTPS port | `443` | -| `service.nodePorts.http` | Kubernetes http node port | `""` | -| `service.nodePorts.https` | Kubernetes https node port | `""` | -| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | -| `service.loadBalancerIP` | LoadBalancer service IP address | `""` | +| `persistence.enabled` | Enable persistence using PVC | `true` | +| `persistence.storageClass` | PVC Storage Class for Jenkins volume | `nil` (uses alpha storage class annotation) | +| `persistence.accessMode` | PVC Access Mode for Jenkins volume | `ReadWriteOnce` | +| `persistence.size` | PVC Storage Request for Jenkins volume | `8Gi` | +| `resources` | CPU/Memory resource requests/limits | `{}` | | `livenessProbe.enabled` | Turn on and off liveness probe | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `180` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `180` | | `livenessProbe.periodSeconds` | How often to perform the probe | `10` | | `livenessProbe.timeoutSeconds` | When the probe times out | `5` | | `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | @@ -85,6 +83,17 @@ The following tables lists the configurable parameters of the Jenkins chart and | `readinessProbe.timeoutSeconds` | When the probe times out | `3` | | `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | | `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `3` | +| `podAnnotations` | Pod annotations | `{}` | +| `affinity` | Map of node/pod affinities | `{}` (The value is evaluated as a template) | +| `nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) | +| `tolerations` | Tolerations for pod assignment | `[]` (The value is evaluated as a template) | +| `service.type` | Kubernetes Service type | `LoadBalancer` | +| `service.port` | Service HTTP port | `80` | +| `service.httpsPort` | Service HTTPS port | `443` | +| `service.nodePorts.http` | Kubernetes http node port | `""` | +| `service.nodePorts.https` | Kubernetes https node port | `""` | +| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | +| `service.loadBalancerIP` | LoadBalancer service IP address | `""` | | `ingress.enabled` | Enable ingress controller resource | `false` | | `ingress.annotations` | Ingress annotations | `[]` | | `ingress.certManager` | Add annotations for cert-manager | `false` | @@ -96,13 +105,6 @@ The following tables lists the configurable parameters of the Jenkins chart and | `ingress.secrets[0].name` | TLS Secret Name | `nil` | | `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | | `ingress.secrets[0].key` | TLS Secret Key | `nil` | -| `persistence.enabled` | Enable persistence using PVC | `true` | -| `persistence.storageClass` | PVC Storage Class for Jenkins volume | `nil` (uses alpha storage class annotation) | -| `persistence.accessMode` | PVC Access Mode for Jenkins volume | `ReadWriteOnce` | -| `persistence.size` | PVC Storage Request for Jenkins volume | `8Gi` | -| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | -| `podAnnotations` | Pod annotations | `{}` | -| `affinity` | Map of node/pod affinities | `{}` | | `metrics.enabled` | Start a side-car Jenkins prometheus exporter | `false` | | `metrics.image.registry` | Jenkins exporter image registry | `docker.io` | | `metrics.image.repository` | Jenkins exporter image name | `bitnami/jenkins-exporter` | @@ -112,7 +114,6 @@ The following tables lists the configurable parameters of the Jenkins chart and | `metrics.podAnnotations` | Additional annotations for Metrics exporter pod | `{prometheus.io/scrape: "true", prometheus.io/port: "9118"}` | | `metrics.resources` | Exporter resource requests/limit | Memory: `256Mi`, CPU: `100m` | - The above parameters map to the env variables defined in [bitnami/jenkins](http://github.com/bitnami/bitnami-docker-jenkins). For more information please refer to the [bitnami/jenkins](http://github.com/bitnami/bitnami-docker-jenkins) image documentation. Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/bitnami/jenkins/ci/values-with-metrics-and-ingress.yaml b/bitnami/jenkins/ci/values-with-metrics-and-ingress.yaml new file mode 100644 index 000000000..7dca44f12 --- /dev/null +++ b/bitnami/jenkins/ci/values-with-metrics-and-ingress.yaml @@ -0,0 +1,12 @@ +# Test values file for generating all of the yaml and check that +# the rendering is correct + +ingress: + enabled: true + tls: [] + +service: + type: ClusterIP + +metrics: + enabled: true diff --git a/bitnami/jenkins/templates/NOTES.txt b/bitnami/jenkins/templates/NOTES.txt index 0764510c5..82590ebd7 100644 --- a/bitnami/jenkins/templates/NOTES.txt +++ b/bitnami/jenkins/templates/NOTES.txt @@ -3,7 +3,19 @@ 1. Get the Jenkins URL by running: -{{- if contains "NodePort" .Values.service.type }} +{{- if .Values.ingress.enabled }} + + Jenkins URL(s): +{{- if .Values.ingress.hostname }} + - http://{{ .Values.ingress.hostname }} +{{- end }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + - http://{{ $host.name }}{{ . }} + {{- end }} +{{- end }} + +{{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "jenkins.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") diff --git a/bitnami/jenkins/templates/_helpers.tpl b/bitnami/jenkins/templates/_helpers.tpl index 65311841c..4e2df613c 100644 --- a/bitnami/jenkins/templates/_helpers.tpl +++ b/bitnami/jenkins/templates/_helpers.tpl @@ -6,13 +6,6 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create chart name and version as used by the chart label. -*/}} -{{- define "jenkins.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -30,6 +23,31 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- end -}} {{- end -}} +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "jenkins.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "jenkins.labels" -}} +app: {{ include "jenkins.name" . }} +chart: {{ include "jenkins.chart" . }} +release: {{ .Release.Name }} +heritage: {{ .Release.Service }} +{{- end -}} + +{{/* +Labels to use on deploy.spec.selector.matchLabels and svc.spec.selector +*/}} +{{- define "jenkins.matchLabels" -}} +app: {{ include "jenkins.name" . }} +release: {{ .Release.Name }} +{{- end -}} + {{/* Return the proper Jenkins image name */}} @@ -156,3 +174,16 @@ Return the appropriate apiVersion for deployment. {{- print "apps/v1" -}} {{- end -}} {{- end -}} + +{{/* +Renders a value that contains template. +Usage: +{{ include "jenkins.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "jenkins.tplValue" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} diff --git a/bitnami/jenkins/templates/deployment.yaml b/bitnami/jenkins/templates/deployment.yaml index 5f3a84fdf..b5a6f0878 100644 --- a/bitnami/jenkins/templates/deployment.yaml +++ b/bitnami/jenkins/templates/deployment.yaml @@ -2,125 +2,127 @@ apiVersion: {{ template "jenkins.deployment.apiVersion" . }} kind: Deployment metadata: name: {{ template "jenkins.fullname" . }} - labels: - app: {{ template "jenkins.fullname" . }} - chart: {{ include "jenkins.chart" . }} - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + labels: {{- include "jenkins.labels" . | nindent 4 }} spec: selector: - matchLabels: - app: {{ template "jenkins.fullname" . }} - release: "{{ .Release.Name }}" + matchLabels: {{- include "jenkins.matchLabels" . | nindent 6 }} template: metadata: - labels: - app: {{ template "jenkins.fullname" . }} - chart: {{ include "jenkins.chart" . }} - release: "{{ .Release.Name }}" -{{- if or .Values.podAnnotations .Values.metrics.enabled }} + labels: {{- include "jenkins.labels" . | nindent 8 }} + {{- if or .Values.podAnnotations .Values.metrics.enabled }} annotations: - {{- if .Values.podAnnotations }} -{{ toYaml .Values.podAnnotations | indent 8 }} - {{- end }} - {{- if .Values.metrics.podAnnotations }} -{{ toYaml .Values.metrics.podAnnotations | indent 8 }} - {{- end }} -{{- end }} + {{- if .Values.podAnnotations }} + {{- include "jenkins.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.metrics.podAnnotations }} + {{- include "jenkins.tplValue" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }} + {{- end }} + {{- end }} spec: {{- include "jenkins.imagePullSecrets" . | indent 6 }} + {{- if .Values.affinity }} + affinity: {{- include "jenkins.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "jenkins.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "jenkins.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} containers: - - name: jenkins - image: "{{ template "jenkins.image" . }}" - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - env: - - name: JENKINS_USERNAME - value: {{ .Values.jenkinsUser | quote }} - - name: JENKINS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "jenkins.fullname" . }} - key: jenkins-password - - name: JENKINS_HOME - value: {{ .Values.jenkinsHome | quote }} - - name: DISABLE_JENKINS_INITIALIZATION - value: {{ .Values.disableInitialization | quote }} - {{- if .Values.javaOpts }} - - name: JAVA_OPTS - value: {{ .Values.javaOpts | quote }} - {{- end }} - ports: - - name: http - containerPort: 8080 - - name: https - containerPort: 8443 - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - httpGet: - path: /login - port: http - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - {{- end }} - {{- if .Values.readinessProbe.enabled }} - readinessProbe: - httpGet: - path: /login - port: http - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - {{- end }} - resources: -{{ toYaml .Values.resources | indent 10 }} - volumeMounts: - - name: jenkins-data - mountPath: /bitnami/jenkins -{{- if .Values.metrics.enabled }} - - name: metrics - image: {{ template "jenkins.metrics.image" . }} - imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} - command: ['sh', '-c', 'python -u ./jenkins_exporter.py -j http://127.0.0.1:8080 --user $JENKINS_USERNAME --password $JENKINS_PASSWORD'] - env: - - name: JENKINS_USERNAME - value: {{ .Values.jenkinsUser | quote }} - - name: JENKINS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "jenkins.fullname" . }} - key: jenkins-password - ports: + - name: jenkins + image: {{ template "jenkins.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + env: + - name: JENKINS_USERNAME + value: {{ .Values.jenkinsUser | quote }} + - name: JENKINS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "jenkins.fullname" . }} + key: jenkins-password + - name: JENKINS_HOME + value: {{ .Values.jenkinsHome | quote }} + - name: DISABLE_JENKINS_INITIALIZATION + value: {{ .Values.disableInitialization | quote }} + {{- if .Values.javaOpts }} + - name: JAVA_OPTS + value: {{ .Values.javaOpts | quote }} + {{- end }} + ports: + - name: http + containerPort: 8080 + - name: https + containerPort: 8443 + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: /login + port: http + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + httpGet: + path: /login + port: http + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + {{- end }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + volumeMounts: + - name: jenkins-data + mountPath: /bitnami/jenkins + {{- if .Values.metrics.enabled }} - name: metrics - containerPort: 9118 - livenessProbe: - httpGet: - path: /metrics - port: metrics - initialDelaySeconds: 15 - timeoutSeconds: 5 - readinessProbe: - httpGet: - path: /metrics - port: metrics - initialDelaySeconds: 5 - timeoutSeconds: 1 - resources: - {{ toYaml .Values.metrics.resources | indent 10 }} -{{- end }} + image: {{ template "jenkins.metrics.image" . }} + imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} + command: + - sh + - -c + - | + python -u ./jenkins_exporter.py -j http://127.0.0.1:8080 --user $JENKINS_USERNAME --password $JENKINS_PASSWORD + env: + - name: JENKINS_USERNAME + value: {{ .Values.jenkinsUser | quote }} + - name: JENKINS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "jenkins.fullname" . }} + key: jenkins-password + ports: + - name: metrics + containerPort: 9118 + livenessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 15 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 5 + timeoutSeconds: 1 + {{- if .Values.metrics.resources }} + resources: {{- toYaml .Values.metrics.resources | nindent 12 }} + {{- end }} + {{- end }} volumes: - - name: jenkins-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ template "jenkins.fullname" . }} - {{- else }} - emptyDir: {} - {{- end }} - {{- with .Values.affinity }} - affinity: -{{ toYaml . | indent 8 }} - {{- end }} + - name: jenkins-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "jenkins.fullname" . }} + {{- else }} + emptyDir: {} + {{- end }} diff --git a/bitnami/jenkins/templates/ingress.yaml b/bitnami/jenkins/templates/ingress.yaml index 62fac631a..8c66ecf9f 100644 --- a/bitnami/jenkins/templates/ingress.yaml +++ b/bitnami/jenkins/templates/ingress.yaml @@ -3,11 +3,7 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ template "jenkins.fullname" . }} - labels: - app: "{{ template "jenkins.fullname" . }}" - chart: {{ include "jenkins.chart" . }} - release: {{ .Release.Name | quote }} - heritage: {{ .Release.Service | quote }} + labels: {{- include "jenkins.labels" . | nindent 4 }} annotations: {{- if .Values.ingress.certManager }} kubernetes.io/tls-acme: "true" @@ -17,27 +13,25 @@ metadata: {{- end }} spec: rules: - {{- range .Values.ingress.hosts }} - - host: {{ .name }} - http: - paths: - - path: {{ default "/" .path }} - backend: - serviceName: {{ template "jenkins.fullname" $ }} - servicePort: http - {{- end }} - tls: - {{- range .Values.ingress.hosts }} - {{- if .tls }} - - hosts: - {{- if .tlsHosts }} - {{- range $host := .tlsHosts }} - - {{ $host }} - {{- end }} - {{- else }} - - {{ .name }} - {{- end }} - secretName: {{ .tlsSecret }} - {{- end }} + {{- if .Values.ingress.hostname }} + - host: {{ .Values.ingress.hostname }} + http: + paths: + - path: / + backend: + serviceName: {{ template "jenkins.fullname" $ }} + servicePort: http + {{- end }} + {{- range .Values.ingress.hosts }} + - host: {{ .name }} + http: + paths: + - path: {{ default "/" .path }} + backend: + serviceName: {{ template "jenkins.fullname" $ }} + servicePort: http + {{- end }} + {{- if .Values.ingress.tls }} + tls: {{- toYaml .Values.ingress.tls | nindent 4 }} {{- end }} {{- end }} diff --git a/bitnami/jenkins/templates/pvc.yaml b/bitnami/jenkins/templates/pvc.yaml index 43d9c5019..8157f5491 100644 --- a/bitnami/jenkins/templates/pvc.yaml +++ b/bitnami/jenkins/templates/pvc.yaml @@ -3,16 +3,14 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: name: {{ template "jenkins.fullname" . }} - labels: - app: {{ template "jenkins.fullname" . }} - chart: {{ include "jenkins.chart" . }} - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + labels: {{- include "jenkins.labels" . | nindent 4 }} annotations: volume.alpha.kubernetes.io/storage-class: {{ ternary "default" (trimPrefix "storageClassName: " (include "jenkins.storageClass" .)) (empty (include "jenkins.storageClass" .)) }} spec: accessModes: - - {{ .Values.persistence.accessMode | quote }} + {{- range .Values.persistence.accessModes }} + - {{ . | quote }} + {{- end }} resources: requests: storage: {{ .Values.persistence.size | quote }} diff --git a/bitnami/jenkins/templates/secrets.yaml b/bitnami/jenkins/templates/secrets.yaml index 00fa991e2..840051529 100644 --- a/bitnami/jenkins/templates/secrets.yaml +++ b/bitnami/jenkins/templates/secrets.yaml @@ -2,15 +2,11 @@ apiVersion: v1 kind: Secret metadata: name: {{ template "jenkins.fullname" . }} - labels: - app: {{ template "jenkins.fullname" . }} - chart: {{ include "jenkins.chart" . }} - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + labels: {{- include "jenkins.labels" . | nindent 4 }} type: Opaque data: - {{ if .Values.jenkinsPassword }} + {{- if .Values.jenkinsPassword }} jenkins-password: {{ default "" .Values.jenkinsPassword | b64enc | quote }} - {{ else }} + {{- else }} jenkins-password: {{ randAlphaNum 10 | b64enc | quote }} - {{ end }} + {{- end }} diff --git a/bitnami/jenkins/templates/svc.yaml b/bitnami/jenkins/templates/svc.yaml index b0d3ad153..a74c74d81 100644 --- a/bitnami/jenkins/templates/svc.yaml +++ b/bitnami/jenkins/templates/svc.yaml @@ -2,31 +2,29 @@ apiVersion: v1 kind: Service metadata: name: {{ template "jenkins.fullname" . }} - labels: - app: {{ template "jenkins.fullname" . }} - chart: {{ include "jenkins.chart" . }} - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" + labels: {{- include "jenkins.labels" . | nindent 4 }} + {{- if .Values.service.annotations }} + annotations: {{ include "jenkins.tplValue" ( dict "value" .Values.service.annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} - {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + {{- if or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort") }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} - {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + {{- if and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP)) }} loadBalancerIP: {{ .Values.service.loadBalancerIP }} {{- end }} ports: - name: http port: {{ .Values.service.port }} targetPort: http - {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePorts.http)))}} + {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http)) }} nodePort: {{ .Values.service.nodePorts.http }} {{- end }} - name: https port: {{ .Values.service.httpsPort }} targetPort: https - {{- if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePorts.https)))}} + {{- if and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.https)) }} nodePort: {{ .Values.service.nodePorts.https }} {{- end }} - selector: - app: {{ template "jenkins.fullname" . }} + selector: {{- include "jenkins.matchLabels" . | nindent 4 }} diff --git a/bitnami/jenkins/values.yaml b/bitnami/jenkins/values.yaml index 893f67b0f..37ebfb60e 100644 --- a/bitnami/jenkins/values.yaml +++ b/bitnami/jenkins/values.yaml @@ -52,36 +52,14 @@ jenkinsHome: /opt/bitnami/jenkins/jenkins_home ## Allows to disable the initial Bitnami configuration for Jenkins ## -disableInitialization: no +disableInitialization: "no" ## Customize JVM parameters ## # javaOpts: -## Kubernetes configuration -## For minikube, set this to NodePort, elsewhere use LoadBalancer -## -service: - type: LoadBalancer - # HTTP Port - port: 80 - # HTTPS Port - httpsPort: 443 - ## loadBalancerIP: - ## - ## nodePorts: - ## http: - ## https: - nodePorts: - http: "" - https: "" - ## Enable client source IP preservation - ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip - ## - externalTrafficPolicy: Cluster - -## Configure liveness and readiness probes -## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes) +## Jenkins containers' liveness and readiness probes +## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes ## livenessProbe: enabled: true @@ -98,69 +76,136 @@ readinessProbe: successThreshold: 1 failureThreshold: 3 -## Enable persistence using Persistent Volume Claims -## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ -## -persistence: - enabled: true - ## If defined, volume.beta.kubernetes.io/storage-class: - ## Default: volume.alpha.kubernetes.io/storage-class: default - ## - # storageClass: - accessMode: ReadWriteOnce - size: 8Gi - -## Configure resource requests and limits +## Jenkins containers' resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: - requests: - memory: 512Mi - cpu: 300m + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: {} + # cpu: 500m + # memory: 1Gi + requests: {} + # cpu: 300m + # memory: 512Mi ## Pod annotations ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ ## podAnnotations: {} -## Configure the ingress resource that allows you to access the -## Jenkins installation. Set up the URL -## ref: http://kubernetes.io/docs/user-guide/ingress/ +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## Node labels for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## Tolerations for pod assignment. Evaluated as a template. +## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: {} + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + ## If true, use a Persistent Volume Claim, If false, use emptyDir + ## + enabled: true + ## Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## Persistent Volume Claim annotations + ## + annotations: + ## Persistent Volume Access Mode + ## + accessModes: + - ReadWriteOnce + ## Persistent Volume size + ## + size: 8Gi + +## Service paramaters +## +service: + ## Service type + ## + type: LoadBalancer + ## HTTP port + ## + port: 80 + ## HTTPS port + ## + httpsPort: 443 + ## Specify the nodePort(s) value(s) for the LoadBalancer and NodePort service types. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport + ## + nodePorts: + http: "" + https: "" + ## Set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + # loadBalancerIP: + ## Provide any additional annotations which may be required. This can be used to + ## set the LoadBalancer service type to internal only. + ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer + ## + annotations: {} + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster + +## Ingress paramaters ## ingress: ## Set to true to enable ingress record generation + ## enabled: false ## Set this to true in order to add the corresponding annotations for cert-manager + ## certManager: false + ## When the ingress is enabled, a host pointing to this will be created + ## + hostname: jenkins.local + ## Ingress annotations done as key:value pairs ## For a full list of possible ingress annotations, please see ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md ## ## If tls is set to true, annotation ingress.kubernetes.io/secure-backends: "true" will automatically be set ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set - annotations: + annotations: {} # kubernetes.io/ingress.class: nginx - ## The list of hostnames to be covered with this ingress record. - ## Most likely this will be just one host, but in the event more hosts are needed, this is an array - hosts: - - name: jenkins.local - path: / + ## The list of additional hostnames to be covered with this ingress record. + ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array + ## hosts: + ## - name: jenkins.local + ## path: / - ## Set this to true in order to enable TLS on the ingress record - tls: false - - ## Optionally specify the TLS hosts for the ingress record - ## Useful when the Ingress controller supports www-redirection - ## If not specified, the above host name will be used - # tlsHosts: - # - www.jenkins.local - # - jenkins.local - - ## If TLS is set to true, you must declare what secret will store the key/certificate for TLS - tlsSecret: jenkins.local-tls + ## The tls configuration for the ingress + ## ref: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls + ## + tls: + - hosts: + - example.local + secretName: example.local-tls secrets: ## If you're providing your own certificates, please use this to add the certificates as secrets @@ -172,19 +217,17 @@ ingress: ## ## It is also possible to create and manage the certificates outside of this helm chart ## Please see README.md for more information - # - name: jenkins.local-tls + # - name: apache.local-tls # key: # certificate: -## Affinity for pod assignment -## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity -## -affinity: {} - ## Prometheus Exporter / Metrics ## metrics: enabled: false + ## Bitnami Jenkins Prometheus Exporter image + ## ref: https://hub.docker.com/r/bitnami/jenkins-exporter/tags/ + ## image: registry: docker.io repository: bitnami/jenkins-exporter @@ -197,10 +240,25 @@ metrics: # pullSecrets: # - myRegistryKeySecretName ## Metrics exporter pod Annotation and Labels + ## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ + ## podAnnotations: prometheus.io/scrape: "true" prometheus.io/port: "9118" ## Metrics exporter resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## - # resources: {} + ## Jenkins Prometheus exporter resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + limits: {} + # cpu: 100m + # memory: 128Mi + requests: {} + # cpu: 100m + # memory: 128Mi