| Giorgi Lekveishvili | 3598266 | 2024-04-05 13:05:40 +0400 | [diff] [blame] | 1 | {{- $prefix := .Values.controller.jenkinsUriPrefix | default "" -}} |
| 2 | {{- $url := "" -}} |
| 3 | 1. Get your '{{ .Values.controller.admin.username }}' user password by running: |
| 4 | kubectl exec --namespace {{ template "jenkins.namespace" . }} -it svc/{{ template "jenkins.fullname" . }} -c jenkins -- /bin/cat /run/secrets/additional/chart-admin-password && echo |
| 5 | {{- if .Values.controller.ingress.hostName -}} |
| 6 | {{- if .Values.controller.ingress.tls -}} |
| 7 | {{- $url = print "https://" .Values.controller.ingress.hostName $prefix -}} |
| 8 | {{- else -}} |
| 9 | {{- $url = print "http://" .Values.controller.ingress.hostName $prefix -}} |
| 10 | {{- end }} |
| 11 | 2. Visit {{ $url }} |
| 12 | {{- else }} |
| 13 | 2. Get the Jenkins URL to visit by running these commands in the same shell: |
| 14 | {{- if contains "NodePort" .Values.controller.serviceType }} |
| 15 | export NODE_PORT=$(kubectl get --namespace {{ template "jenkins.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "jenkins.fullname" . }}) |
| 16 | export NODE_IP=$(kubectl get nodes --namespace {{ template "jenkins.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}") |
| 17 | {{- if .Values.controller.httpsKeyStore.enable -}} |
| 18 | {{- $url = print "https://$NODE_IP:$NODE_PORT" $prefix -}} |
| 19 | {{- else -}} |
| 20 | {{- $url = print "http://$NODE_IP:$NODE_PORT" $prefix -}} |
| 21 | {{- end }} |
| 22 | echo {{ $url }} |
| 23 | |
| 24 | {{- else if contains "LoadBalancer" .Values.controller.serviceType }} |
| 25 | NOTE: It may take a few minutes for the LoadBalancer IP to be available. |
| 26 | You can watch the status of by running 'kubectl get svc --namespace {{ template "jenkins.namespace" . }} -w {{ template "jenkins.fullname" . }}' |
| 27 | export SERVICE_IP=$(kubectl get svc --namespace {{ template "jenkins.namespace" . }} {{ template "jenkins.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") |
| 28 | {{- if .Values.controller.httpsKeyStore.enable -}} |
| 29 | {{- $url = print "https://$SERVICE_IP:" .Values.controller.servicePort $prefix -}} |
| 30 | {{- else -}} |
| 31 | {{- $url = print "http://$SERVICE_IP:" .Values.controller.servicePort $prefix -}} |
| 32 | {{- end }} |
| 33 | echo {{ $url }} |
| 34 | |
| 35 | {{- else if contains "ClusterIP" .Values.controller.serviceType -}} |
| 36 | {{- if .Values.controller.httpsKeyStore.enable -}} |
| 37 | {{- $url = print "https://127.0.0.1:" .Values.controller.servicePort $prefix -}} |
| 38 | {{- else -}} |
| 39 | {{- $url = print "http://127.0.0.1:" .Values.controller.servicePort $prefix -}} |
| 40 | {{- end }} |
| 41 | echo {{ $url }} |
| 42 | kubectl --namespace {{ template "jenkins.namespace" . }} port-forward svc/{{template "jenkins.fullname" . }} {{ .Values.controller.servicePort }}:{{ .Values.controller.servicePort }} |
| 43 | {{- end }} |
| 44 | {{- end }} |
| 45 | |
| 46 | 3. Login with the password from step 1 and the username: {{ .Values.controller.admin.username }} |
| 47 | 4. Configure security realm and authorization strategy |
| 48 | 5. Use Jenkins Configuration as Code by specifying configScripts in your values.yaml file, see documentation: {{ $url }}/configuration-as-code and examples: https://github.com/jenkinsci/configuration-as-code-plugin/tree/master/demos |
| 49 | |
| 50 | For more information on running Jenkins on Kubernetes, visit: |
| 51 | https://cloud.google.com/solutions/jenkins-on-container-engine |
| 52 | |
| 53 | For more information about Jenkins Configuration as Code, visit: |
| 54 | https://jenkins.io/projects/jcasc/ |
| 55 | |
| 56 | {{ if and (eq .Values.controller.image.repository "jenkins/jenkins") (eq .Values.controller.image.registry "docker.io") }} |
| 57 | NOTE: Consider using a custom image with pre-installed plugins |
| 58 | {{- else if .Values.controller.installPlugins }} |
| 59 | NOTE: Consider disabling `installPlugins` if your image already contains plugins. |
| 60 | {{- end }} |
| 61 | |
| 62 | {{- if .Values.persistence.enabled }} |
| 63 | {{- else }} |
| 64 | ################################################################################# |
| 65 | ###### WARNING: Persistence is disabled!!! You will lose your data when ##### |
| 66 | ###### the Jenkins pod is terminated. ##### |
| 67 | ################################################################################# |
| 68 | {{- end }} |