Update website - 0.6.0 release
This commit is contained in:
parent
fbea1ed790
commit
cd3dbeb0a5
6
Makefile
6
Makefile
|
|
@ -284,10 +284,10 @@ HAS_GEN_CRD_API_REFERENCE_DOCS := $(shell ls gen-crd-api-reference-docs 2> /dev/
|
||||||
scheme-doc-gen: ## Generate Jenkins CRD scheme doc
|
scheme-doc-gen: ## Generate Jenkins CRD scheme doc
|
||||||
@echo "+ $@"
|
@echo "+ $@"
|
||||||
ifndef HAS_GEN_CRD_API_REFERENCE_DOCS
|
ifndef HAS_GEN_CRD_API_REFERENCE_DOCS
|
||||||
@wget https://github.com/ahmetb/$(GEN_CRD_API)/releases/download/v0.1.2/$(GEN_CRD_API)_linux_amd64.tar.gz
|
@wget https://github.com/ahmetb/$(GEN_CRD_API)/releases/download/v0.1.2/$(GEN_CRD_API)_$(PLATFORM)_amd64.tar.gz
|
||||||
@mkdir -p $(GEN_CRD_API)
|
@mkdir -p $(GEN_CRD_API)
|
||||||
@tar -C $(GEN_CRD_API) -zxf $(GEN_CRD_API)_linux_amd64.tar.gz
|
@tar -C $(GEN_CRD_API) -zxf $(GEN_CRD_API)_$(PLATFORM)_amd64.tar.gz
|
||||||
@rm $(GEN_CRD_API)_linux_amd64.tar.gz
|
@rm $(GEN_CRD_API)_$(PLATFORM)_amd64.tar.gz
|
||||||
endif
|
endif
|
||||||
$(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir $(PKG)/api/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md
|
$(GEN_CRD_API)/$(GEN_CRD_API) -config gen-crd-api-config.json -api-dir $(PKG)/api/$(API_VERSION) -template-dir $(GEN_CRD_API)/template -out-file documentation/$(VERSION)/jenkins-$(API_VERSION)-scheme.md
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,301 +0,0 @@
|
||||||
---
|
|
||||||
title: "Developer Guide"
|
|
||||||
linkTitle: "Developer Guide - Preview"
|
|
||||||
weight: 60
|
|
||||||
date: 2020-02-09
|
|
||||||
description: >
|
|
||||||
Jenkins Operator for developers
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% pageinfo %}}
|
|
||||||
This document explains how to setup your development environment.
|
|
||||||
{{% /pageinfo %}}
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- [operator_sdk][operator_sdk] version 1.3.0
|
|
||||||
- [git][git_tool]
|
|
||||||
- [go][go_tool] version 1.15.6
|
|
||||||
- [goimports, golint, checkmake and staticcheck][install_dev_tools]
|
|
||||||
- [minikube][minikube] version 1.17.1 (preferred Hypervisor - [virtualbox][virtualbox]) (automatically downloaded)
|
|
||||||
- [docker][docker_tool] version 17.03+
|
|
||||||
|
|
||||||
## Clone repository and download dependencies
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone git@github.com:jenkinsci/kubernetes-operator.git
|
|
||||||
cd kubernetes-operator
|
|
||||||
make go-dependencies
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build and run with a minikube
|
|
||||||
|
|
||||||
Start minikube instance configured for **Jenkins Operator**. Appropriate minikube version will be downloaded to bin folder.
|
|
||||||
```bash
|
|
||||||
make minikube-start
|
|
||||||
```
|
|
||||||
Next run **Jenkins Operator** locally.
|
|
||||||
```bash
|
|
||||||
make run
|
|
||||||
```
|
|
||||||
Console output indicating readiness of this phase:
|
|
||||||
```bash
|
|
||||||
+ build
|
|
||||||
+ run
|
|
||||||
kubectl config use-context minikube
|
|
||||||
Switched to context "minikube".
|
|
||||||
Watching 'default' namespace
|
|
||||||
bin/manager --jenkins-api-hostname=192.168.99.252 --jenkins-api-port=0 --jenkins-api-use-nodeport=true --cluster-domain=cluster.local
|
|
||||||
2021-02-08T14:14:45.263+0100 INFO cmd Version: v0.5.0
|
|
||||||
2021-02-08T14:14:45.263+0100 INFO cmd Git commit: 305dbeda-dirty-dirty
|
|
||||||
2021-02-08T14:14:45.264+0100 INFO cmd Go Version: go1.15.6
|
|
||||||
2021-02-08T14:14:45.264+0100 INFO cmd Go OS/Arch: darwin/amd64
|
|
||||||
2021-02-08T14:14:45.264+0100 INFO cmd Watch namespace: default
|
|
||||||
2021-02-08T14:14:45.592+0100 INFO controller-runtime.metrics metrics server is starting to listen {"addr": "0.0.0.0:8383"}
|
|
||||||
2021-02-08T14:14:45.599+0100 INFO cmd starting manager
|
|
||||||
2021-02-08T14:14:45.599+0100 INFO controller-runtime.manager starting metrics server {"path": "/metrics"}
|
|
||||||
2021-02-08T14:14:45.599+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: jenkins.io/v1alpha2, Kind=Jenkins"}
|
|
||||||
2021-02-08T14:14:45.700+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
|
||||||
2021-02-08T14:14:45.800+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
|
||||||
2021-02-08T14:14:45.901+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
|
||||||
2021-02-08T14:14:46.003+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: core/v1, Kind=Secret"}
|
|
||||||
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: core/v1, Kind=ConfigMap"}
|
|
||||||
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: jenkins.io/v1alpha2, Kind=Jenkins"}
|
|
||||||
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting Controller {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins"}
|
|
||||||
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting workers {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "worker count": 1}
|
|
||||||
|
|
||||||
```
|
|
||||||
Lastly apply Jenkins Custom Resource to minikube cluster:
|
|
||||||
```bash
|
|
||||||
kubectl apply -f config/samples/jenkins.io_v1alpha2_jenkins.yaml
|
|
||||||
|
|
||||||
{"level":"info","ts":1612790690.875426,"logger":"controller-jenkins","msg":"Setting default Jenkins container command","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790690.8754492,"logger":"controller-jenkins","msg":"Setting default Jenkins container JAVA_OPTS environment variable","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790690.875456,"logger":"controller-jenkins","msg":"Setting default operator plugins","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790690.875463,"logger":"controller-jenkins","msg":"Setting default Jenkins master service","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790690.875467,"logger":"controller-jenkins","msg":"Setting default Jenkins slave service","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790690.881811,"logger":"controller-jenkins","msg":"*v1alpha2.Jenkins/jenkins-example has been updated","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790691.252834,"logger":"controller-jenkins","msg":"Creating a new Jenkins Master Pod default/jenkins-jenkins-example","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790691.322793,"logger":"controller-jenkins","msg":"Jenkins master pod restarted by operator:","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790691.322817,"logger":"controller-jenkins","msg":"Jenkins Operator version has changed, actual '' new 'v0.5.0'","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790691.3228202,"logger":"controller-jenkins","msg":"Jenkins CR has been replaced","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790695.8789551,"logger":"controller-jenkins","msg":"Creating a new Jenkins Master Pod default/jenkins-jenkins-example","cr":"jenkins-example"}
|
|
||||||
{"level":"warn","ts":1612790817.9423082,"logger":"controller-jenkins","msg":"Reconcile loop failed: couldn't init Jenkins API client: Get \"http://192.168.99.254:31998/api/json\": dial tcp 192.168.99.254:31998: connect: connection refused","cr":"jenkins-example"}
|
|
||||||
{"level":"warn","ts":1612790817.9998221,"logger":"controller-jenkins","msg":"Reconcile loop failed: couldn't init Jenkins API client: Get \"http://192.168.99.254:31998/api/json\": dial tcp 192.168.99.254:31998: connect: connection refused","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790818.581316,"logger":"controller-jenkins","msg":"base-groovy ConfigMap 'jenkins-operator-base-configuration-jenkins-example' name '1-basic-settings.groovy' running groovy script","cr":"jenkins-example"}
|
|
||||||
...
|
|
||||||
{"level":"info","ts":1612790820.9473379,"logger":"controller-jenkins","msg":"base-groovy ConfigMap 'jenkins-operator-base-configuration-jenkins-example' name '8-disable-job-dsl-script-approval.groovy' running groovy script","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790821.244055,"logger":"controller-jenkins","msg":"Base configuration phase is complete, took 2m6s","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790821.7953842,"logger":"controller-jenkins","msg":"Waiting for Seed Job Agent `seed-job-agent`...","cr":"jenkins-example"}
|
|
||||||
...
|
|
||||||
|
|
||||||
{"level":"info","ts":1612790851.843638,"logger":"controller-jenkins","msg":"Waiting for Seed Job Agent `seed-job-agent`...","cr":"jenkins-example"}
|
|
||||||
{"level":"info","ts":1612790853.489524,"logger":"controller-jenkins","msg":"User configuration phase is complete, took 2m38s","cr":"jenkins-example"}
|
|
||||||
|
|
||||||
Two log lines says that Jenkins Operator works correctly:
|
|
||||||
|
|
||||||
* `Base configuration phase is complete` - ensures manifests, Jenkins pod, Jenkins configuration and Jenkins API token
|
|
||||||
* `User configuration phase is complete` - ensures Jenkins restore, backup and seed jobs along with user configuration
|
|
||||||
|
|
||||||
> Details about base and user phase can be found [here](https://jenkinsci.github.io/kubernetes-operator/docs/how-it-works/architecture-and-design/).
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get jenkins -o yaml
|
|
||||||
|
|
||||||
apiVersion: v1
|
|
||||||
items:
|
|
||||||
- apiVersion: jenkins.io/v1alpha2
|
|
||||||
kind: Jenkins
|
|
||||||
metadata:
|
|
||||||
...
|
|
||||||
spec:
|
|
||||||
backup:
|
|
||||||
action: {}
|
|
||||||
containerName: ""
|
|
||||||
interval: 0
|
|
||||||
makeBackupBeforePodDeletion: false
|
|
||||||
configurationAsCode:
|
|
||||||
configurations: []
|
|
||||||
secret:
|
|
||||||
name: ""
|
|
||||||
groovyScripts:
|
|
||||||
configurations: []
|
|
||||||
secret:
|
|
||||||
name: ""
|
|
||||||
jenkinsAPISettings:
|
|
||||||
authorizationStrategy: createUser
|
|
||||||
master:
|
|
||||||
basePlugins:
|
|
||||||
...
|
|
||||||
containers:
|
|
||||||
- command:
|
|
||||||
- bash
|
|
||||||
- -c
|
|
||||||
- /var/jenkins/scripts/init.sh && exec /sbin/tini -s -- /usr/local/bin/jenkins.sh
|
|
||||||
env:
|
|
||||||
- name: JAVA_OPTS
|
|
||||||
value: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
|
|
||||||
-XX:MaxRAMFraction=1 -Djenkins.install.runSetupWizard=false -Djava.awt.headless=true
|
|
||||||
image: jenkins/jenkins:2.263.3-lts-alpine
|
|
||||||
imagePullPolicy: Always
|
|
||||||
livenessProbe:
|
|
||||||
...
|
|
||||||
readinessProbe:
|
|
||||||
...
|
|
||||||
resources:
|
|
||||||
limits:
|
|
||||||
cpu: 1500m
|
|
||||||
memory: 3Gi
|
|
||||||
requests:
|
|
||||||
cpu: "1"
|
|
||||||
memory: 500Mi
|
|
||||||
disableCSRFProtection: false
|
|
||||||
restore:
|
|
||||||
action: {}
|
|
||||||
containerName: ""
|
|
||||||
getLatestAction: {}
|
|
||||||
seedJobs:
|
|
||||||
- additionalClasspath: ""
|
|
||||||
bitbucketPushTrigger: false
|
|
||||||
buildPeriodically: ""
|
|
||||||
description: Jenkins Operator repository
|
|
||||||
failOnMissingPlugin: false
|
|
||||||
githubPushTrigger: false
|
|
||||||
id: jenkins-operator
|
|
||||||
ignoreMissingFiles: false
|
|
||||||
pollSCM: ""
|
|
||||||
repositoryBranch: master
|
|
||||||
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git
|
|
||||||
targets: cicd/jobs/*.jenkins
|
|
||||||
unstableOnDeprecation: false
|
|
||||||
service:
|
|
||||||
port: 8080
|
|
||||||
type: NodePort
|
|
||||||
serviceAccount: {}
|
|
||||||
slaveService:
|
|
||||||
port: 50000
|
|
||||||
type: ClusterIP
|
|
||||||
status:
|
|
||||||
appliedGroovyScripts:
|
|
||||||
- configurationType: base-groovy
|
|
||||||
hash: 2ownqpRyBjQYmzTRttUx7axok3CKe2E45frI5iRwH0w=
|
|
||||||
name: 1-basic-settings.groovy
|
|
||||||
source: jenkins-operator-base-configuration-jenkins-example
|
|
||||||
...
|
|
||||||
baseConfigurationCompletedTime: "2021-02-08T13:27:01Z"
|
|
||||||
createdSeedJobs:
|
|
||||||
- jenkins-operator
|
|
||||||
operatorVersion: v0.5.0
|
|
||||||
provisionStartTime: "2021-02-08T13:24:55Z"
|
|
||||||
userAndPasswordHash: nnfZsWmFfAYlYyVYeKhWW2KB4L8mE61JUfetAsr9IMM=
|
|
||||||
userConfigurationCompletedTime: "2021-02-08T13:27:33Z"
|
|
||||||
kind: List
|
|
||||||
metadata:
|
|
||||||
resourceVersion: ""
|
|
||||||
selfLink: ""
|
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get po
|
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
|
||||||
jenkins-jenkins-example 1/1 Running 0 23m
|
|
||||||
seed-job-agent-jenkins-example-758cc7cc5c-82hbl 1/1 Running 0 21m
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### Debug Jenkins Operator
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make run OPERATOR_EXTRA_ARGS="--debug"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build and run with a remote Kubernetes cluster
|
|
||||||
|
|
||||||
You can also run the controller locally and make it listen to a remote Kubernetes server.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make run NAMESPACE=default KUBECTL_CONTEXT=remote-k8s EXTRA_ARGS='--kubeconfig ~/.kube/config'
|
|
||||||
```
|
|
||||||
|
|
||||||
Once **Jenkins Operator** are up and running, apply Jenkins custom resource:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl --context remote-k8s --namespace default apply -f deploy/crds/jenkins_v1alpha2_jenkins_cr.yaml
|
|
||||||
kubectl --context remote-k8s --namespace default get jenkins -o yaml
|
|
||||||
kubectl --context remote-k8s --namespace default get po
|
|
||||||
```
|
|
||||||
|
|
||||||
## Testing
|
|
||||||
|
|
||||||
Tests are written using [Ginkgo](https://onsi.github.io/ginkgo/) with [Gomega](https://onsi.github.io/gomega/).
|
|
||||||
|
|
||||||
Run unit tests with go fmt, lint, statickcheck, vet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make verify
|
|
||||||
```
|
|
||||||
|
|
||||||
Run unit tests only:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make test
|
|
||||||
```
|
|
||||||
|
|
||||||
### Running E2E tests
|
|
||||||
|
|
||||||
Run e2e tests with minikube:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make minikube-start
|
|
||||||
make e2e
|
|
||||||
```
|
|
||||||
|
|
||||||
Run the specific e2e test:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make e2e E2E_TEST_SELECTOR='^TestConfiguration$'
|
|
||||||
```
|
|
||||||
|
|
||||||
### Building docker image on minikube
|
|
||||||
|
|
||||||
To be able to work with the docker daemon on `minikube` machine run the following command before building an image:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
eval $(bin/minikube docker-env)
|
|
||||||
```
|
|
||||||
|
|
||||||
### When `api/v1alpha2/jenkins_types.go` has changed
|
|
||||||
|
|
||||||
Run:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
make manifests
|
|
||||||
```
|
|
||||||
|
|
||||||
### Getting the Jenkins URL and basic credentials
|
|
||||||
|
|
||||||
```bash
|
|
||||||
minikube service jenkins-operator-http-<cr_name> --url
|
|
||||||
kubectl get secret jenkins-operator-credentials-<cr_name> -o 'jsonpath={.data.user}' | base64 -d
|
|
||||||
kubectl get secret jenkins-operator-credentials-<cr_name> -o 'jsonpath={.data.password}' | base64 -d
|
|
||||||
```
|
|
||||||
|
|
||||||
[dep_tool]:https://golang.github.io/dep/docs/installation.html
|
|
||||||
[git_tool]:https://git-scm.com/downloads
|
|
||||||
[go_tool]:https://golang.org/dl/
|
|
||||||
[operator_sdk]:https://github.com/operator-framework/operator-sdk
|
|
||||||
[fork_guide]:https://help.github.com/articles/fork-a-repo/
|
|
||||||
[docker_tool]:https://docs.docker.com/install/
|
|
||||||
[kubectl_tool]:https://kubernetes.io/docs/tasks/tools/install-kubectl/
|
|
||||||
[minikube]:https://kubernetes.io/docs/tasks/tools/install-minikube/
|
|
||||||
[virtualbox]:https://www.virtualbox.org/wiki/Downloads
|
|
||||||
[install_dev_tools]:https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/tools/
|
|
||||||
|
|
||||||
## Self-learning
|
|
||||||
|
|
||||||
* [Tutorial: Deep Dive into the Operator Framework for... Melvin Hillsman, Michael Hrivnak, & Matt Dorn
|
|
||||||
](https://www.youtube.com/watch?v=8_DaCcRMp5I)
|
|
||||||
|
|
||||||
* [Operator Framework Training By OpenShift](https://www.katacoda.com/openshift/courses/operatorframework)
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
title: "Developer Guide"
|
title: "Developer Guide"
|
||||||
linkTitle: "Developer Guide"
|
linkTitle: "Developer Guide"
|
||||||
weight: 60
|
weight: 60
|
||||||
date: 2019-08-05
|
date: 2021-06-10
|
||||||
description: >
|
description: >
|
||||||
Jenkins Operator for developers
|
Jenkins Operator for developers
|
||||||
---
|
---
|
||||||
|
|
@ -13,11 +13,11 @@ This document explains how to setup your development environment.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- [operator_sdk][operator_sdk] version v0.17.0
|
- [operator_sdk][operator_sdk] version 1.3.0
|
||||||
- [git][git_tool]
|
- [git][git_tool]
|
||||||
- [go][go_tool] version v1.14+
|
- [go][go_tool] version 1.15.6
|
||||||
- [goimports, golint, checkmake and staticcheck][install_dev_tools]
|
- [goimports, golint, checkmake and staticcheck][install_dev_tools]
|
||||||
- [minikube][minikube] version v1.1.0+ (preferred Hypervisor - [virtualbox][virtualbox])
|
- [minikube][minikube] version 1.17.1 (preferred Hypervisor - [virtualbox][virtualbox]) (automatically downloaded)
|
||||||
- [docker][docker_tool] version 17.03+
|
- [docker][docker_tool] version 17.03+
|
||||||
|
|
||||||
## Clone repository and download dependencies
|
## Clone repository and download dependencies
|
||||||
|
|
@ -30,64 +30,67 @@ make go-dependencies
|
||||||
|
|
||||||
## Build and run with a minikube
|
## Build and run with a minikube
|
||||||
|
|
||||||
Build and run **Jenkins Operator** locally:
|
Start minikube instance configured for **Jenkins Operator**. Appropriate minikube version will be downloaded to bin folder.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build minikube-run
|
make minikube-start
|
||||||
|
|
||||||
INFO[0000] Running deepcopy code-generation for Custom Resource group versions: [jenkins:[v1alpha2], ]
|
|
||||||
INFO[0005] Code-generation complete.
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:51 Version: v0.4.0
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:52 Git commit: 4ffc58e-dirty
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:53 Go Version: go1.13.1
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:54 Go OS/Arch: linux/amd64
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:55 operator-sdk Version: v0.15.1
|
|
||||||
2020-04-27T09:52:26.520+0200 INFO controller-jenkins manager/main.go:80 Watch namespace: default
|
|
||||||
2020-04-27T09:52:26.527+0200 INFO leader leader/leader.go:46 Trying to become the leader.
|
|
||||||
2020-04-27T09:52:26.527+0200 INFO leader leader/leader.go:51 Skipping leader election; not running in a cluster.
|
|
||||||
2020-04-27T09:52:26.887+0200 INFO controller-runtime.metrics metrics/listener.go:40 metrics server is starting to listen {"addr": "0.0.0.0:8383"}
|
|
||||||
2020-04-27T09:52:26.887+0200 INFO controller-jenkins manager/main.go:105 Registering Components.
|
|
||||||
2020-04-27T09:52:26.897+0200 WARN controller-jenkins manager/main.go:138 Could not generate and serve custom resource metrics {"error": "namespace not found for current environment"}
|
|
||||||
2020-04-27T09:52:27.250+0200 INFO metrics metrics/metrics.go:55 Skipping metrics Service creation; not running in a cluster.
|
|
||||||
2020-04-27T09:52:27.601+0200 WARN controller-jenkins manager/main.go:157 Could not create ServiceMonitor object {"error": "no ServiceMonitor registered with the API"}
|
|
||||||
2020-04-27T09:52:27.601+0200 WARN controller-jenkins manager/main.go:161 Install prometheus-operator in your cluster to create ServiceMonitor objects {"error": "no ServiceMonitor registered with the API"}
|
|
||||||
2020-04-27T09:52:27.601+0200 INFO controller-jenkins manager/main.go:165 Starting the Cmd.
|
|
||||||
2020-04-27T09:52:27.601+0200 INFO controller-runtime.manager manager/internal.go:356 starting metrics server {"path": "/metrics"}
|
|
||||||
2020-04-27T09:52:27.601+0200 INFO controller-runtime.controller controller/controller.go:164 Starting EventSource {"controller": "jenkins-controller", "source": "kind source: jenkins.io/v1alpha2, Kind=Jenkins"}
|
|
||||||
2020-04-27T09:52:27.702+0200 INFO controller-runtime.controller controller/controller.go:164 Starting EventSource {"controller": "jenkins-controller", "source": "kind source: core/v1, Kind=Pod"}
|
|
||||||
2020-04-27T09:52:27.803+0200 INFO controller-runtime.controller controller/controller.go:164 Starting EventSource {"controller": "jenkins-controller", "source": "kind source: core/v1, Kind=Secret"}
|
|
||||||
2020-04-27T09:52:27.903+0200 INFO controller-runtime.controller controller/controller.go:164 Starting EventSource {"controller": "jenkins-controller", "source": "kind source: core/v1, Kind=Secret"}
|
|
||||||
2020-04-27T09:52:27.903+0200 INFO controller-runtime.controller controller/controller.go:164 Starting EventSource {"controller": "jenkins-controller", "source": "kind source: core/v1, Kind=ConfigMap"}
|
|
||||||
2020-04-27T09:52:28.005+0200 INFO controller-runtime.controller controller/controller.go:171 Starting Controller {"controller": "jenkins-controller"}
|
|
||||||
2020-04-27T09:52:28.005+0200 INFO controller-runtime.controller controller/controller.go:190 Starting workers {"controller": "jenkins-controller", "worker count": 1}
|
|
||||||
```
|
```
|
||||||
|
Next run **Jenkins Operator** locally.
|
||||||
```bash
|
```bash
|
||||||
kubectl apply -f deploy/crds/jenkins_v1alpha2_jenkins_cr.yaml
|
make run
|
||||||
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:404 Setting default Jenkins container command {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:409 Setting default Jenkins container JAVA_OPTS environment variable {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:417 Setting default operator plugins {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:436 Setting default Jenkins master service {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:449 Setting default Jenkins slave service {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.153+0200 INFO controller-jenkins jenkins/jenkins_controller.go:479 Setting default Jenkins API settings {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.158+0200 INFO controller-jenkins jenkins/handler.go:89 *v1alpha2.Jenkins/example has been updated {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.562+0200 INFO controller-jenkins base/pod.go:161 Creating a new Jenkins Master Pod default/jenkins-example {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.575+0200 INFO controller-jenkins base/reconcile.go:528 The Admission controller has changed the Jenkins master pod spec.securityContext, changing the Jenkinc CR spec.master.securityContext to '&PodSecurityContext{SELinuxOptions:nil,RunAsUser:nil,RunAsNonRoot:nil,SupplementalGroups:[],FSGroup:nil,RunAsGroup:nil,Sysctls:[]Sysctl{},WindowsOptions:nil,}' {"cr": "example"}
|
|
||||||
2020-04-27T09:56:40.584+0200 INFO controller-jenkins jenkins/handler.go:89 *v1alpha2.Jenkins/example has been updated {"cr": "example"}
|
|
||||||
2020-04-27T09:59:40.409+0200 INFO controller-jenkins base/reconcile.go:466 Generating Jenkins API token for operator {"cr": "example"}
|
|
||||||
2020-04-27T09:59:40.410+0200 WARN controller-jenkins jenkins/jenkins_controller.go:171 Reconcile loop failed: couldn't init Jenkins API client: Get http://192.168.99.100:32380/api/json: dial tcp 192.168.99.100:32380: connect: connection refused {"cr": "example"}
|
|
||||||
2020-04-27T09:59:40.455+0200 INFO controller-jenkins base/reconcile.go:466 Generating Jenkins API token for operator {"cr": "example"}
|
|
||||||
2020-04-27T09:59:41.415+0200 INFO controller-jenkins groovy/groovy.go:145 base-groovy ConfigMap 'jenkins-operator-base-configuration-example' name '1-basic-settings.groovy' running groovy script {"cr": "example"}
|
|
||||||
...
|
|
||||||
2020-04-27T09:59:49.030+0200 INFO controller-jenkins groovy/groovy.go:145 base-groovy ConfigMap 'jenkins-operator-base-configuration-example' name '8-disable-job-dsl-script-approval.groovy' running groovy script {"cr": "example"}
|
|
||||||
|
|
||||||
2020-04-27T09:59:49.257+0200 INFO controller-jenkins jenkins/jenkins_controller.go:289 Base configuration phase is complete, took 3m9s {"cr": "example"}
|
|
||||||
2020-04-27T09:59:51.165+0200 INFO controller-jenkins seedjobs/seedjobs.go:232 Waiting for Seed Job Agent `seed-job-agent`... {"cr": "example"}
|
|
||||||
...
|
|
||||||
2020-04-27T10:00:03.886+0200 INFO controller-jenkins seedjobs/seedjobs.go:232 Waiting for Seed Job Agent `seed-job-agent`... {"cr": "example"}
|
|
||||||
2020-04-27T10:00:06.140+0200 INFO controller-jenkins jenkins/jenkins_controller.go:338 User configuration phase is complete, took 3m26s {"cr": "example"}
|
|
||||||
```
|
```
|
||||||
|
Console output indicating readiness of this phase:
|
||||||
|
```bash
|
||||||
|
+ build
|
||||||
|
+ run
|
||||||
|
kubectl config use-context minikube
|
||||||
|
Switched to context "minikube".
|
||||||
|
Watching 'default' namespace
|
||||||
|
bin/manager --jenkins-api-hostname=192.168.99.252 --jenkins-api-port=0 --jenkins-api-use-nodeport=true --cluster-domain=cluster.local
|
||||||
|
2021-02-08T14:14:45.263+0100 INFO cmd Version: v0.5.0
|
||||||
|
2021-02-08T14:14:45.263+0100 INFO cmd Git commit: 305dbeda-dirty-dirty
|
||||||
|
2021-02-08T14:14:45.264+0100 INFO cmd Go Version: go1.15.6
|
||||||
|
2021-02-08T14:14:45.264+0100 INFO cmd Go OS/Arch: darwin/amd64
|
||||||
|
2021-02-08T14:14:45.264+0100 INFO cmd Watch namespace: default
|
||||||
|
2021-02-08T14:14:45.592+0100 INFO controller-runtime.metrics metrics server is starting to listen {"addr": "0.0.0.0:8383"}
|
||||||
|
2021-02-08T14:14:45.599+0100 INFO cmd starting manager
|
||||||
|
2021-02-08T14:14:45.599+0100 INFO controller-runtime.manager starting metrics server {"path": "/metrics"}
|
||||||
|
2021-02-08T14:14:45.599+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: jenkins.io/v1alpha2, Kind=Jenkins"}
|
||||||
|
2021-02-08T14:14:45.700+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
||||||
|
2021-02-08T14:14:45.800+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
||||||
|
2021-02-08T14:14:45.901+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: /, Kind="}
|
||||||
|
2021-02-08T14:14:46.003+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: core/v1, Kind=Secret"}
|
||||||
|
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: core/v1, Kind=ConfigMap"}
|
||||||
|
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting EventSource {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "source": "kind source: jenkins.io/v1alpha2, Kind=Jenkins"}
|
||||||
|
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting Controller {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins"}
|
||||||
|
2021-02-08T14:14:46.004+0100 INFO controller-runtime.manager.controller.jenkins Starting workers {"reconciler group": "jenkins.io", "reconciler kind": "Jenkins", "worker count": 1}
|
||||||
|
|
||||||
|
```
|
||||||
|
Lastly apply Jenkins Custom Resource to minikube cluster:
|
||||||
|
```bash
|
||||||
|
kubectl apply -f config/samples/jenkins.io_v1alpha2_jenkins.yaml
|
||||||
|
|
||||||
|
{"level":"info","ts":1612790690.875426,"logger":"controller-jenkins","msg":"Setting default Jenkins container command","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790690.8754492,"logger":"controller-jenkins","msg":"Setting default Jenkins container JAVA_OPTS environment variable","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790690.875456,"logger":"controller-jenkins","msg":"Setting default operator plugins","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790690.875463,"logger":"controller-jenkins","msg":"Setting default Jenkins master service","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790690.875467,"logger":"controller-jenkins","msg":"Setting default Jenkins slave service","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790690.881811,"logger":"controller-jenkins","msg":"*v1alpha2.Jenkins/jenkins-example has been updated","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790691.252834,"logger":"controller-jenkins","msg":"Creating a new Jenkins Master Pod default/jenkins-jenkins-example","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790691.322793,"logger":"controller-jenkins","msg":"Jenkins master pod restarted by operator:","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790691.322817,"logger":"controller-jenkins","msg":"Jenkins Operator version has changed, actual '' new 'v0.5.0'","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790691.3228202,"logger":"controller-jenkins","msg":"Jenkins CR has been replaced","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790695.8789551,"logger":"controller-jenkins","msg":"Creating a new Jenkins Master Pod default/jenkins-jenkins-example","cr":"jenkins-example"}
|
||||||
|
{"level":"warn","ts":1612790817.9423082,"logger":"controller-jenkins","msg":"Reconcile loop failed: couldn't init Jenkins API client: Get \"http://192.168.99.254:31998/api/json\": dial tcp 192.168.99.254:31998: connect: connection refused","cr":"jenkins-example"}
|
||||||
|
{"level":"warn","ts":1612790817.9998221,"logger":"controller-jenkins","msg":"Reconcile loop failed: couldn't init Jenkins API client: Get \"http://192.168.99.254:31998/api/json\": dial tcp 192.168.99.254:31998: connect: connection refused","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790818.581316,"logger":"controller-jenkins","msg":"base-groovy ConfigMap 'jenkins-operator-base-configuration-jenkins-example' name '1-basic-settings.groovy' running groovy script","cr":"jenkins-example"}
|
||||||
|
...
|
||||||
|
{"level":"info","ts":1612790820.9473379,"logger":"controller-jenkins","msg":"base-groovy ConfigMap 'jenkins-operator-base-configuration-jenkins-example' name '8-disable-job-dsl-script-approval.groovy' running groovy script","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790821.244055,"logger":"controller-jenkins","msg":"Base configuration phase is complete, took 2m6s","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790821.7953842,"logger":"controller-jenkins","msg":"Waiting for Seed Job Agent `seed-job-agent`...","cr":"jenkins-example"}
|
||||||
|
...
|
||||||
|
|
||||||
|
{"level":"info","ts":1612790851.843638,"logger":"controller-jenkins","msg":"Waiting for Seed Job Agent `seed-job-agent`...","cr":"jenkins-example"}
|
||||||
|
{"level":"info","ts":1612790853.489524,"logger":"controller-jenkins","msg":"User configuration phase is complete, took 2m38s","cr":"jenkins-example"}
|
||||||
|
|
||||||
Two log lines says that Jenkins Operator works correctly:
|
Two log lines says that Jenkins Operator works correctly:
|
||||||
|
|
||||||
|
|
@ -96,7 +99,7 @@ Two log lines says that Jenkins Operator works correctly:
|
||||||
|
|
||||||
> Details about base and user phase can be found [here](https://jenkinsci.github.io/kubernetes-operator/docs/how-it-works/architecture-and-design/).
|
> Details about base and user phase can be found [here](https://jenkinsci.github.io/kubernetes-operator/docs/how-it-works/architecture-and-design/).
|
||||||
|
|
||||||
|
```
|
||||||
```bash
|
```bash
|
||||||
kubectl get jenkins -o yaml
|
kubectl get jenkins -o yaml
|
||||||
|
|
||||||
|
|
@ -105,7 +108,7 @@ items:
|
||||||
- apiVersion: jenkins.io/v1alpha2
|
- apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
...
|
...
|
||||||
spec:
|
spec:
|
||||||
backup:
|
backup:
|
||||||
action: {}
|
action: {}
|
||||||
|
|
@ -113,18 +116,19 @@ items:
|
||||||
interval: 0
|
interval: 0
|
||||||
makeBackupBeforePodDeletion: false
|
makeBackupBeforePodDeletion: false
|
||||||
configurationAsCode:
|
configurationAsCode:
|
||||||
configurations: null
|
configurations: []
|
||||||
secret:
|
secret:
|
||||||
name: ""
|
name: ""
|
||||||
groovyScripts:
|
groovyScripts:
|
||||||
configurations: null
|
configurations: []
|
||||||
secret:
|
secret:
|
||||||
name: ""
|
name: ""
|
||||||
jenkinsAPISettings:
|
jenkinsAPISettings:
|
||||||
authorizationStrategy: createUser
|
authorizationStrategy: createUser
|
||||||
master:
|
master:
|
||||||
basePlugins:
|
basePlugins:
|
||||||
...
|
...
|
||||||
|
containers:
|
||||||
- command:
|
- command:
|
||||||
- bash
|
- bash
|
||||||
- -c
|
- -c
|
||||||
|
|
@ -133,13 +137,12 @@ items:
|
||||||
- name: JAVA_OPTS
|
- name: JAVA_OPTS
|
||||||
value: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
|
value: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap
|
||||||
-XX:MaxRAMFraction=1 -Djenkins.install.runSetupWizard=false -Djava.awt.headless=true
|
-XX:MaxRAMFraction=1 -Djenkins.install.runSetupWizard=false -Djava.awt.headless=true
|
||||||
image: jenkins/jenkins:lts
|
image: jenkins/jenkins:2.263.3-lts-alpine
|
||||||
imagePullPolicy: Always
|
imagePullPolicy: Always
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
...
|
...
|
||||||
name: jenkins-master
|
|
||||||
readinessProbe:
|
readinessProbe:
|
||||||
...
|
...
|
||||||
resources:
|
resources:
|
||||||
limits:
|
limits:
|
||||||
cpu: 1500m
|
cpu: 1500m
|
||||||
|
|
@ -148,7 +151,6 @@ items:
|
||||||
cpu: "1"
|
cpu: "1"
|
||||||
memory: 500Mi
|
memory: 500Mi
|
||||||
disableCSRFProtection: false
|
disableCSRFProtection: false
|
||||||
securityContext: {}
|
|
||||||
restore:
|
restore:
|
||||||
action: {}
|
action: {}
|
||||||
containerName: ""
|
containerName: ""
|
||||||
|
|
@ -179,15 +181,15 @@ items:
|
||||||
- configurationType: base-groovy
|
- configurationType: base-groovy
|
||||||
hash: 2ownqpRyBjQYmzTRttUx7axok3CKe2E45frI5iRwH0w=
|
hash: 2ownqpRyBjQYmzTRttUx7axok3CKe2E45frI5iRwH0w=
|
||||||
name: 1-basic-settings.groovy
|
name: 1-basic-settings.groovy
|
||||||
source: jenkins-operator-base-configuration-example
|
source: jenkins-operator-base-configuration-jenkins-example
|
||||||
...
|
...
|
||||||
baseConfigurationCompletedTime: "2020-04-27T07:59:49Z"
|
baseConfigurationCompletedTime: "2021-02-08T13:27:01Z"
|
||||||
createdSeedJobs:
|
createdSeedJobs:
|
||||||
- jenkins-operator
|
- jenkins-operator
|
||||||
operatorVersion: v0.4.0
|
operatorVersion: v0.5.0
|
||||||
provisionStartTime: "2020-04-27T07:56:40Z"
|
provisionStartTime: "2021-02-08T13:24:55Z"
|
||||||
userAndPasswordHash: kAeBnhHKU3LZuw+uo9oHILB59kAFSGDUbHwCSDgtMnE=
|
userAndPasswordHash: nnfZsWmFfAYlYyVYeKhWW2KB4L8mE61JUfetAsr9IMM=
|
||||||
userConfigurationCompletedTime: "2020-04-27T08:00:06Z"
|
userConfigurationCompletedTime: "2021-02-08T13:27:33Z"
|
||||||
kind: List
|
kind: List
|
||||||
metadata:
|
metadata:
|
||||||
resourceVersion: ""
|
resourceVersion: ""
|
||||||
|
|
@ -197,22 +199,16 @@ metadata:
|
||||||
```bash
|
```bash
|
||||||
kubectl get po
|
kubectl get po
|
||||||
|
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
jenkins-example 1/1 Running 0 15m
|
jenkins-jenkins-example 1/1 Running 0 23m
|
||||||
seed-job-agent-example-56569459c9-l69qf 1/1 Running 0 12m
|
seed-job-agent-jenkins-example-758cc7cc5c-82hbl 1/1 Running 0 21m
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Upon every next start of local **Jenkins Operator** switch first command with:
|
|
||||||
```
|
|
||||||
make minikube-start
|
|
||||||
make minikube-run
|
|
||||||
```
|
|
||||||
|
|
||||||
### Debug Jenkins Operator
|
### Debug Jenkins Operator
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build minikube-run OPERATOR_EXTRA_ARGS="--debug"
|
make run OPERATOR_EXTRA_ARGS="--debug"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Build and run with a remote Kubernetes cluster
|
## Build and run with a remote Kubernetes cluster
|
||||||
|
|
@ -233,7 +229,15 @@ kubectl --context remote-k8s --namespace default get po
|
||||||
|
|
||||||
## Testing
|
## Testing
|
||||||
|
|
||||||
Run unit tests:
|
Tests are written using [Ginkgo](https://onsi.github.io/ginkgo/) with [Gomega](https://onsi.github.io/gomega/).
|
||||||
|
|
||||||
|
Run unit tests with go fmt, lint, statickcheck, vet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
make verify
|
||||||
|
```
|
||||||
|
|
||||||
|
Run unit tests only:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make test
|
make test
|
||||||
|
|
@ -251,25 +255,23 @@ make e2e
|
||||||
Run the specific e2e test:
|
Run the specific e2e test:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make build e2e E2E_TEST_SELECTOR='^TestConfiguration$'
|
make e2e E2E_TEST_SELECTOR='^TestConfiguration$'
|
||||||
```
|
```
|
||||||
|
|
||||||
## Tips & Tricks
|
### Building docker image on minikube
|
||||||
|
|
||||||
### Building docker image on minikube (for e2e tests)
|
|
||||||
|
|
||||||
To be able to work with the docker daemon on `minikube` machine run the following command before building an image:
|
To be able to work with the docker daemon on `minikube` machine run the following command before building an image:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
eval $(minikube docker-env)
|
eval $(bin/minikube docker-env)
|
||||||
```
|
```
|
||||||
|
|
||||||
### When `pkg/apis/jenkinsio/*/jenkins_types.go` has changed
|
### When `api/v1alpha2/jenkins_types.go` has changed
|
||||||
|
|
||||||
Run:
|
Run:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
make deepcopy-gen
|
make manifests
|
||||||
```
|
```
|
||||||
|
|
||||||
### Getting the Jenkins URL and basic credentials
|
### Getting the Jenkins URL and basic credentials
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
---
|
---
|
||||||
title: "Latest (v0.5.x)"
|
title: "Latest (v0.6.x)"
|
||||||
linkTitle: "Latest (v0.5.x)"
|
linkTitle: "Latest (v0.6.x)"
|
||||||
weight: 10
|
weight: 10
|
||||||
date: 2021-01-18
|
date: 2021-01-18
|
||||||
description: >
|
description: >
|
||||||
How to work with jenkins-operator latest version
|
How to work with jenkins-operator to be released version
|
||||||
---
|
---
|
||||||
|
|
||||||
{{% pageinfo %}}
|
{{% pageinfo %}}
|
||||||
This document describes a getting started guide for **Jenkins Operator** `v0.5.x` and an additional configuration.
|
This document describes a getting started guide for **Jenkins Operator** currently in preview version and an additional configuration.
|
||||||
{{% /pageinfo %}}
|
{{% /pageinfo %}}
|
||||||
|
|
||||||
## First Steps
|
## First Steps
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ podTemplate(label: label,
|
||||||
|
|
||||||
Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest:
|
Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -150,7 +150,7 @@ If key was generated by `ssh-keygen` the public key content is located in <filen
|
||||||
|
|
||||||
Configure a seed job like this:
|
Configure a seed job like this:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -168,7 +168,7 @@ spec:
|
||||||
|
|
||||||
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -190,7 +190,7 @@ stringData:
|
||||||
|
|
||||||
Configure the seed job like:
|
Configure the seed job like:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -208,7 +208,7 @@ spec:
|
||||||
|
|
||||||
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -276,7 +276,7 @@ The `.dockerconfigjson` key's value needs to be replaced with a modified version
|
||||||
After modifications, it needs to be encoded as a Base64 value before setting the `.dockerconfigjson` key.
|
After modifications, it needs to be encoded as a Base64 value before setting the `.dockerconfigjson` key.
|
||||||
|
|
||||||
Example config file to modify and use:
|
Example config file to modify and use:
|
||||||
```json
|
```
|
||||||
{
|
{
|
||||||
"auths":{
|
"auths":{
|
||||||
"https://index.docker.io/v1/":{
|
"https://index.docker.io/v1/":{
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ spec:
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
containers:
|
containers:
|
||||||
- name: jenkins-master
|
- name: jenkins-master
|
||||||
image: jenkins/jenkins:2.263.2-lts-alpine
|
image: jenkins/jenkins:2.277.4-lts-alpine
|
||||||
- name: backup # container responsible for the backup and restore
|
- name: backup # container responsible for the backup and restore
|
||||||
env:
|
env:
|
||||||
- name: BACKUP_DIR
|
- name: BACKUP_DIR
|
||||||
|
|
@ -74,6 +74,10 @@ spec:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /home/user/bin/backup.sh # this command is invoked on "backup" container to make backup, for example /home/user/bin/backup.sh <backup_number>, <backup_number> is passed by operator
|
- /home/user/bin/backup.sh # this command is invoked on "backup" container to make backup, for example /home/user/bin/backup.sh <backup_number>, <backup_number> is passed by operator
|
||||||
|
getLatestAction:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /home/user/bin/get-latest.sh # this command is invoked on "backup" container to get last backup number before pod deletion. If you don't omit it in CR, you can lose data
|
||||||
interval: 30 # how often make backup in seconds
|
interval: 30 # how often make backup in seconds
|
||||||
makeBackupBeforePodDeletion: true # make a backup before pod deletion
|
makeBackupBeforePodDeletion: true # make a backup before pod deletion
|
||||||
restore:
|
restore:
|
||||||
|
|
@ -82,9 +86,5 @@ spec:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh <backup_number>, <backup_number> is passed by operator
|
- /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh <backup_number>, <backup_number> is passed by operator
|
||||||
getLatestAction:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- /home/user/bin/get-latest.sh # this command is invoked on "backup" container to get last backup number before pod deletion. If you don't omit it in CR, you can lose data
|
|
||||||
#recoveryOnce: <backup_number> # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored
|
#recoveryOnce: <backup_number> # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ Pre-installed plugins:
|
||||||
* git v4.5.0
|
* git v4.5.0
|
||||||
* job-dsl v1.77
|
* job-dsl v1.77
|
||||||
* kubernetes-credentials-provider v0.15
|
* kubernetes-credentials-provider v0.15
|
||||||
* kubernetes v1.29.2
|
* kubernetes v1.29.0
|
||||||
* workflow-aggregator v2.6
|
* workflow-aggregator v2.6
|
||||||
* workflow-job v2.40
|
* workflow-job v2.40
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ Rest of the plugins can be found in [plugins repository](https://plugins.jenkins
|
||||||
|
|
||||||
Edit Custom Resource under `spec.master.plugins`:
|
Edit Custom Resource under `spec.master.plugins`:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -51,7 +51,7 @@ spec:
|
||||||
master:
|
master:
|
||||||
basePlugins:
|
basePlugins:
|
||||||
- name: kubernetes
|
- name: kubernetes
|
||||||
version: "1.29.2"
|
version: "1.28.6"
|
||||||
- name: workflow-job
|
- name: workflow-job
|
||||||
version: "2.40"
|
version: "2.40"
|
||||||
- name: workflow-aggregator
|
- name: workflow-aggregator
|
||||||
|
|
@ -61,7 +61,7 @@ spec:
|
||||||
- name: job-dsl
|
- name: job-dsl
|
||||||
version: "1.77"
|
version: "1.77"
|
||||||
- name: configuration-as-code
|
- name: configuration-as-code
|
||||||
version: "1.47"
|
version: "1.46"
|
||||||
- name: kubernetes-credentials-provider
|
- name: kubernetes-credentials-provider
|
||||||
version: "0.15"
|
version: "0.15"
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ description: >
|
||||||
Once Jenkins Operator is up and running let's deploy actual Jenkins instance.
|
Once Jenkins Operator is up and running let's deploy actual Jenkins instance.
|
||||||
Create manifest e.g. **`jenkins_instance.yaml`** with following data and save it on drive.
|
Create manifest e.g. **`jenkins_instance.yaml`** with following data and save it on drive.
|
||||||
|
|
||||||
```bash
|
```yaml
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ $ kubectl create secret generic jenkins-operator-notification-data --from-litera
|
||||||
|
|
||||||
Example configuration for Slack:
|
Example configuration for Slack:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -40,7 +40,7 @@ Please follow [this](https://docs.microsoft.com/en-gb/outlook/actionable-message
|
||||||
|
|
||||||
Example configuration for Microsoft Teams:
|
Example configuration for Microsoft Teams:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -59,7 +59,7 @@ spec:
|
||||||
|
|
||||||
Example configuration for Mailgun:
|
Example configuration for Mailgun:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -90,7 +90,7 @@ As you see there is two debugging options:
|
||||||
You can use multiple providers to send notification to another communication channels at the same time.
|
You can use multiple providers to send notification to another communication channels at the same time.
|
||||||
For example you will send notifications to Slack and Teams.
|
For example you will send notifications to Slack and Teams.
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
---
|
---
|
||||||
title: "Preview"
|
title: "v0.5.x"
|
||||||
linkTitle: "Preview"
|
linkTitle: "v0.5.x"
|
||||||
weight: 10
|
weight: 10
|
||||||
date: 2021-01-18
|
date: 2021-01-18
|
||||||
description: >
|
description: >
|
||||||
How to work with jenkins-operator to be released version
|
How to work with jenkins-operator latest version
|
||||||
---
|
---
|
||||||
|
|
||||||
{{% pageinfo %}}
|
{{% pageinfo %}}
|
||||||
This document describes a getting started guide for **Jenkins Operator** currently in preview version and an additional configuration.
|
This document describes a getting started guide for **Jenkins Operator** `v0.5.x` and an additional configuration.
|
||||||
{{% /pageinfo %}}
|
{{% /pageinfo %}}
|
||||||
|
|
||||||
## First Steps
|
## First Steps
|
||||||
|
|
@ -89,7 +89,7 @@ podTemplate(label: label,
|
||||||
|
|
||||||
Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest:
|
Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -150,7 +150,7 @@ If key was generated by `ssh-keygen` the public key content is located in <filen
|
||||||
|
|
||||||
Configure a seed job like this:
|
Configure a seed job like this:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -168,7 +168,7 @@ spec:
|
||||||
|
|
||||||
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -190,7 +190,7 @@ stringData:
|
||||||
|
|
||||||
Configure the seed job like:
|
Configure the seed job like:
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -208,7 +208,7 @@ spec:
|
||||||
|
|
||||||
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
and create a Kubernetes Secret (name of secret should be the same from `credentialID` field):
|
||||||
|
|
||||||
```
|
```yaml
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
kind: Secret
|
kind: Secret
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -276,7 +276,7 @@ The `.dockerconfigjson` key's value needs to be replaced with a modified version
|
||||||
After modifications, it needs to be encoded as a Base64 value before setting the `.dockerconfigjson` key.
|
After modifications, it needs to be encoded as a Base64 value before setting the `.dockerconfigjson` key.
|
||||||
|
|
||||||
Example config file to modify and use:
|
Example config file to modify and use:
|
||||||
```
|
```json
|
||||||
{
|
{
|
||||||
"auths":{
|
"auths":{
|
||||||
"https://index.docker.io/v1/":{
|
"https://index.docker.io/v1/":{
|
||||||
|
|
@ -48,7 +48,7 @@ spec:
|
||||||
fsGroup: 1000
|
fsGroup: 1000
|
||||||
containers:
|
containers:
|
||||||
- name: jenkins-master
|
- name: jenkins-master
|
||||||
image: jenkins/jenkins:2.277.4-lts-alpine
|
image: jenkins/jenkins:2.263.2-lts-alpine
|
||||||
- name: backup # container responsible for the backup and restore
|
- name: backup # container responsible for the backup and restore
|
||||||
env:
|
env:
|
||||||
- name: BACKUP_DIR
|
- name: BACKUP_DIR
|
||||||
|
|
@ -74,10 +74,6 @@ spec:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /home/user/bin/backup.sh # this command is invoked on "backup" container to make backup, for example /home/user/bin/backup.sh <backup_number>, <backup_number> is passed by operator
|
- /home/user/bin/backup.sh # this command is invoked on "backup" container to make backup, for example /home/user/bin/backup.sh <backup_number>, <backup_number> is passed by operator
|
||||||
getLatestAction:
|
|
||||||
exec:
|
|
||||||
command:
|
|
||||||
- /home/user/bin/get-latest.sh # this command is invoked on "backup" container to get last backup number before pod deletion. If you don't omit it in CR, you can lose data
|
|
||||||
interval: 30 # how often make backup in seconds
|
interval: 30 # how often make backup in seconds
|
||||||
makeBackupBeforePodDeletion: true # make a backup before pod deletion
|
makeBackupBeforePodDeletion: true # make a backup before pod deletion
|
||||||
restore:
|
restore:
|
||||||
|
|
@ -86,5 +82,9 @@ spec:
|
||||||
exec:
|
exec:
|
||||||
command:
|
command:
|
||||||
- /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh <backup_number>, <backup_number> is passed by operator
|
- /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh <backup_number>, <backup_number> is passed by operator
|
||||||
|
getLatestAction:
|
||||||
|
exec:
|
||||||
|
command:
|
||||||
|
- /home/user/bin/get-latest.sh # this command is invoked on "backup" container to get last backup number before pod deletion. If you don't omit it in CR, you can lose data
|
||||||
#recoveryOnce: <backup_number> # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored
|
#recoveryOnce: <backup_number> # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored
|
||||||
```
|
```
|
||||||
|
|
@ -17,7 +17,7 @@ Pre-installed plugins:
|
||||||
* git v4.5.0
|
* git v4.5.0
|
||||||
* job-dsl v1.77
|
* job-dsl v1.77
|
||||||
* kubernetes-credentials-provider v0.15
|
* kubernetes-credentials-provider v0.15
|
||||||
* kubernetes v1.29.0
|
* kubernetes v1.29.2
|
||||||
* workflow-aggregator v2.6
|
* workflow-aggregator v2.6
|
||||||
* workflow-job v2.40
|
* workflow-job v2.40
|
||||||
|
|
||||||
|
|
@ -28,7 +28,7 @@ Rest of the plugins can be found in [plugins repository](https://plugins.jenkins
|
||||||
|
|
||||||
Edit Custom Resource under `spec.master.plugins`:
|
Edit Custom Resource under `spec.master.plugins`:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -51,7 +51,7 @@ spec:
|
||||||
master:
|
master:
|
||||||
basePlugins:
|
basePlugins:
|
||||||
- name: kubernetes
|
- name: kubernetes
|
||||||
version: "1.28.6"
|
version: "1.29.2"
|
||||||
- name: workflow-job
|
- name: workflow-job
|
||||||
version: "2.40"
|
version: "2.40"
|
||||||
- name: workflow-aggregator
|
- name: workflow-aggregator
|
||||||
|
|
@ -61,7 +61,7 @@ spec:
|
||||||
- name: job-dsl
|
- name: job-dsl
|
||||||
version: "1.77"
|
version: "1.77"
|
||||||
- name: configuration-as-code
|
- name: configuration-as-code
|
||||||
version: "1.46"
|
version: "1.47"
|
||||||
- name: kubernetes-credentials-provider
|
- name: kubernetes-credentials-provider
|
||||||
version: "0.15"
|
version: "0.15"
|
||||||
```
|
```
|
||||||
|
|
@ -10,7 +10,7 @@ description: >
|
||||||
Once Jenkins Operator is up and running let's deploy actual Jenkins instance.
|
Once Jenkins Operator is up and running let's deploy actual Jenkins instance.
|
||||||
Create manifest e.g. **`jenkins_instance.yaml`** with following data and save it on drive.
|
Create manifest e.g. **`jenkins_instance.yaml`** with following data and save it on drive.
|
||||||
|
|
||||||
```yaml
|
```bash
|
||||||
apiVersion: jenkins.io/v1alpha2
|
apiVersion: jenkins.io/v1alpha2
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
metadata:
|
metadata:
|
||||||
|
|
@ -19,7 +19,7 @@ $ kubectl create secret generic jenkins-operator-notification-data --from-litera
|
||||||
|
|
||||||
Example configuration for Slack:
|
Example configuration for Slack:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -40,7 +40,7 @@ Please follow [this](https://docs.microsoft.com/en-gb/outlook/actionable-message
|
||||||
|
|
||||||
Example configuration for Microsoft Teams:
|
Example configuration for Microsoft Teams:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -59,7 +59,7 @@ spec:
|
||||||
|
|
||||||
Example configuration for Mailgun:
|
Example configuration for Mailgun:
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -90,7 +90,7 @@ As you see there is two debugging options:
|
||||||
You can use multiple providers to send notification to another communication channels at the same time.
|
You can use multiple providers to send notification to another communication channels at the same time.
|
||||||
For example you will send notifications to Slack and Teams.
|
For example you will send notifications to Slack and Teams.
|
||||||
|
|
||||||
```yaml
|
```
|
||||||
kind: Jenkins
|
kind: Jenkins
|
||||||
spec:
|
spec:
|
||||||
master:
|
master:
|
||||||
|
|
@ -1,881 +0,0 @@
|
||||||
---
|
|
||||||
title: "Installation - Preview"
|
|
||||||
linkTitle: "Installation - Preview"
|
|
||||||
weight: 1
|
|
||||||
date: 2020-10-05
|
|
||||||
description: >
|
|
||||||
How to install Jenkins Operator
|
|
||||||
---
|
|
||||||
|
|
||||||
{{% pageinfo %}}
|
|
||||||
This document describes installation procedure for **Jenkins Operator**.
|
|
||||||
All container images can be found at [virtuslab/jenkins-operator](https://hub.docker.com/r/virtuslab/jenkins-operator)
|
|
||||||
{{% /pageinfo %}}
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
To run **Jenkins Operator**, you will need:
|
|
||||||
- access to a Kubernetes cluster version `1.17+`
|
|
||||||
- `kubectl` version `1.17+`
|
|
||||||
|
|
||||||
## Configure Custom Resource Definition
|
|
||||||
|
|
||||||
Install Jenkins Custom Resource Definition:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
## Deploy Jenkins Operator
|
|
||||||
|
|
||||||
There are two ways to deploy the Jenkins Operator.
|
|
||||||
|
|
||||||
### Using YAML's
|
|
||||||
|
|
||||||
Apply Service Account and RBAC roles:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/config/all-in-one-v1alpha2.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
Watch **Jenkins Operator** instance being created:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get pods -w
|
|
||||||
```
|
|
||||||
|
|
||||||
Now **Jenkins Operator** should be up and running in the `default` namespace.
|
|
||||||
|
|
||||||
### Using Helm Chart
|
|
||||||
|
|
||||||
There is an option to use Helm to install the operator. It requires the Helm 3+ for deployment.
|
|
||||||
|
|
||||||
Create a namespace for the operator:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ kubectl create namespace <your-namespace>
|
|
||||||
```
|
|
||||||
|
|
||||||
To install, you need only to type these commands:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ helm repo add jenkins https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart
|
|
||||||
$ helm install <name> jenkins/jenkins-operator -n <your-namespace>
|
|
||||||
```
|
|
||||||
|
|
||||||
In case you want to use released Chart **v0.4.1**, before installing/upgrading please install additional CRD into the cluster:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/chart/jenkins-operator/crds/jenkinsimage-crd.yaml
|
|
||||||
```
|
|
||||||
|
|
||||||
To add custom labels and annotations, you can use `values.yaml` file or pass them into `helm install` command, e.g.:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
$ helm install <name> jenkins/jenkins-operator -n <your-namespace> --set jenkins.labels.LabelKey=LabelValue,jenkins.annotations.AnnotationKey=AnnotationValue
|
|
||||||
```
|
|
||||||
You can further customize Jenkins using `values.yaml`:
|
|
||||||
<h3 id="JenkinsConfiguration">Jenkins instance configuration
|
|
||||||
</h3>
|
|
||||||
|
|
||||||
<table aria-colspan="4">
|
|
||||||
<thead aria-colspan="4">
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Default value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody aria-colspan="4">
|
|
||||||
<tr></tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="1">
|
|
||||||
<code>jenkins</code>
|
|
||||||
</td>
|
|
||||||
<td colspan="3">
|
|
||||||
<p>operator is section for configuring operator deployment</p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>enabled</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
true
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Enabled can enable or disable the Jenkins instance.
|
|
||||||
Set to false if you have configured CR already and/or you want to deploy an operator only.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>apiVersion</code>
|
|
||||||
</td>
|
|
||||||
<td>jenkins.io/v1alpha2</td>
|
|
||||||
<td>
|
|
||||||
Version of the CR manifest. The recommended and default value is <code>jenkins.io/v1alpha2</code>.
|
|
||||||
<a href="#github.io/kubernetes-operator/docs/getting-started/v0.1.x/migration-guide-v1alpha1-to-v1alpha2/">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>name</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
jenkins
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Name of resource. The pod name will be <code>jenkins-<name></code> (name will be set as suffix).
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>namespace</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
default
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Namespace the resources will be deployed to. It's not recommended to use default namespace.
|
|
||||||
Create new namespace for jenkins (e.g. <code>kubectl create -n jenkins</code>)
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>labels</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Labels are injected into metadata labels field.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>annotations</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Annotations are injected into metadata annotations field.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>image</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
jenkins/jenkins:lts
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Image is the name (and tag) of the Jenkins instance.
|
|
||||||
It's recommended to use LTS (tag: "lts") version.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>env</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Env contains jenkins container environment variables.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>imagePullPolicy</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Always
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Defines policy for pulling images
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>priorityClassName</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
""
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
PriorityClassName indicates the importance of a Pod relative to other Pods.
|
|
||||||
<a href="https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>disableCSRFProtection</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
false
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
disableCSRFProtection can enable or disable operator built-in CSRF protection.
|
|
||||||
Set it to true if you are using OpenShift Jenkins Plugin.
|
|
||||||
<a href="https://github.com/jenkinsci/kubernetes-operator/pull/193">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>imagePullSecrets</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Used if you want to pull images from private repository
|
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration/#pulling-docker-images-from-private-repositories">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>notifications</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Notifications is feature that notify user about Jenkins reconcilation status
|
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/notifications/">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>basePlugins</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
- name: kubernetes
|
|
||||||
version: "1.25.2"
|
|
||||||
- name: workflow-job
|
|
||||||
version: "2.39"
|
|
||||||
- name: workflow-aggregator
|
|
||||||
version: "2.6"
|
|
||||||
- name: git
|
|
||||||
version: "4.2.2"
|
|
||||||
- name: job-dsl
|
|
||||||
version: "1.77"
|
|
||||||
- name: configuration-as-code
|
|
||||||
version: "1.38"
|
|
||||||
- name: kubernetes-credentials
|
|
||||||
-provider
|
|
||||||
version: "0.13"
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Plugins installed and required by the operator
|
|
||||||
shouldn't contain plugins defined by user
|
|
||||||
You can change their versions here
|
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customization/#install-plugins">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>plugins</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Plugins required by the user. You can define plugins here.
|
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customization/#install-plugins">More info</a>
|
|
||||||
Example:
|
|
||||||
<pre>
|
|
||||||
plugins:
|
|
||||||
- name: simple-theme-plugin
|
|
||||||
version: 0.5.1
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>seedJobs</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Placeholder for jenkins seed jobs
|
|
||||||
For seed job creation tutorial, check:<br /> <a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration/#prepare-job-definitions-and-pipelines">Prepare seed jobs</a>
|
|
||||||
<br /><a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration/#configure-seed-jobs">Configure seed jobs</a>
|
|
||||||
<br />Example:
|
|
||||||
<code>
|
|
||||||
<pre>
|
|
||||||
seedJobs:
|
|
||||||
- id: jenkins-operator
|
|
||||||
targets: "cicd/jobs/*.jenkins"
|
|
||||||
description: "Jenkins Operator repository"
|
|
||||||
repositoryBranch: master
|
|
||||||
repositoryUrl:
|
|
||||||
- https://github.com/jenkinsci/kubernetes-operator.git
|
|
||||||
</pre>
|
|
||||||
</code>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>resources</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
limits:
|
|
||||||
cpu: 1500m
|
|
||||||
memory: 3Gi
|
|
||||||
requests:
|
|
||||||
cpu: 1
|
|
||||||
memory: 500M
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Resource limit/request for Jenkins
|
|
||||||
<a href="https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>volumes</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
- name: backup
|
|
||||||
persistentVolumeClaim:
|
|
||||||
claimName: jenkins-backup
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Volumes used by Jenkins
|
|
||||||
By default, we are only using PVC volume for storing backups.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>volumeMounts</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
volumeMounts are mounts for Jenkins pod.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>securityContext</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
runAsUser: 1000
|
|
||||||
fsGroup: 1000
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
SecurityContext for pod.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>service</code></td>
|
|
||||||
<td>not implemented</td>
|
|
||||||
<td>Http Jenkins service. See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/schema/#github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service for details.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><code>slaveService</code></td>
|
|
||||||
<td>not implemented</td>
|
|
||||||
<td>Slave Jenkins service. See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/schema/#github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service for details.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>livenessProbe</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
livenessProbe:
|
|
||||||
failureThreshold: 12
|
|
||||||
httpGet:
|
|
||||||
path: /login
|
|
||||||
port: http
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 80
|
|
||||||
periodSeconds: 10
|
|
||||||
successThreshold: 1
|
|
||||||
timeoutSeconds: 5
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
livenessProbe for Pod
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>readinessProbe</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
readinessProbe:
|
|
||||||
failureThreshold: 3
|
|
||||||
httpGet:
|
|
||||||
path: /login
|
|
||||||
port: http
|
|
||||||
scheme: HTTP
|
|
||||||
initialDelaySeconds: 30
|
|
||||||
periodSeconds: 10
|
|
||||||
successThreshold: 1
|
|
||||||
timeoutSeconds: 1
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
readinessProbe for Pod
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>
|
|
||||||
backup
|
|
||||||
</code>
|
|
||||||
<p>
|
|
||||||
<em>
|
|
||||||
<a href="#Backup">
|
|
||||||
Backup
|
|
||||||
</a>
|
|
||||||
</em>
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Backup is section for configuring operator's backup feature
|
|
||||||
By default backup feature is enabled and pre-configured
|
|
||||||
This section simplifies the configuration described here: <a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configure-backup-and-restore/">Configure backup and restore</a>
|
|
||||||
For customization tips see <a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/custom-backup-and-restore/">Custom backup and restore</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>configuration</code>
|
|
||||||
<p>
|
|
||||||
<em>
|
|
||||||
<a href="#Configuration">
|
|
||||||
Configuration
|
|
||||||
</a>
|
|
||||||
</em>
|
|
||||||
</p>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
<td>
|
|
||||||
Section where we can configure Jenkins instance.
|
|
||||||
See <a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customization/">Customization</a> for details
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
### Configuring operator deployment
|
|
||||||
|
|
||||||
<table aria-colspan="4">
|
|
||||||
<thead aria-colspan="4">
|
|
||||||
<tr>
|
|
||||||
<th></th>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Default value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody aria-colspan="4">
|
|
||||||
<tr></tr>
|
|
||||||
<tr>
|
|
||||||
<td colspan="1">
|
|
||||||
<code>operator</code>
|
|
||||||
</td>
|
|
||||||
<td colspan="3">
|
|
||||||
<p>operator is section for configuring operator deployment</p>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>replicaCount</code></br>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
1
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Number of Replicas.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>image</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
virtuslab/jenkins-operator:v0.4.0
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Name (and tag) of the Jenkins Operator image.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>imagePullPolicy</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
IfNotPresent
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Defines policy for pulling images.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>imagePullSecrets</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
[]
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Used if you want to pull images from private repository.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>nameOverride</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
""
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
nameOverride overrides the app name.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>fullnameOverride</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
""
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
fullnameOverride overrides the deployment name
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>resources</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>nodeSelector</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>tolerations</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>affinity</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<h3 id="Backup">Backup
|
|
||||||
</h3>
|
|
||||||
<p>
|
|
||||||
(<em>Appears on:</em>
|
|
||||||
<a href="#JenkinsConfiguration">JenkinsConfiguration</a>)
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
Backup defines configuration of Jenkins backup.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Default value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>enabled</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
true
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Enabled is enable/disable switch for backup feature.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>image</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
virtuslab/jenkins-operator-backup-pvc:v0.0.8
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Image used by backup feature.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>containerName</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
backup
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Backup container name.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>interval</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
30
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Defines how often make backup in seconds.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>makeBackupBeforePodDeletion</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
true
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
When enabled will make backup before pod deletion.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>backupCommand</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
/home/user/bin/backup.sh
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Backup container command.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>restoreCommand</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
/home/user/bin/restore.sh
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Backup restore command.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>pvc</code>
|
|
||||||
</td>
|
|
||||||
<td colspan="2">
|
|
||||||
<p>Persistent Volume Claim Kubernetes resource</p>
|
|
||||||
<br/>
|
|
||||||
<table colspan="2" style="width:100%">
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>enabled</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
true
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Enable/disable switch for PVC
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>enabled</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
true
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Enable/disable switch for PVC
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>size</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
5Gi
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Size of PVC
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>className</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
""
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
StorageClassName for PVC
|
|
||||||
<a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes/#class-1">More info</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>env</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
- name: BACKUP_DIR
|
|
||||||
value: /backup
|
|
||||||
- name: JENKINS_HOME
|
|
||||||
value: /jenkins-home
|
|
||||||
- name: BACKUP_COUNT
|
|
||||||
value: "3"
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Contains container environment variables.
|
|
||||||
PVC backup provider handles these variables:<br />
|
|
||||||
BACKUP_DIR - path for storing backup files (default: "/backup")<br />
|
|
||||||
JENKINS_HOME - path to jenkins home (default: "/jenkins-home")<br />
|
|
||||||
BACKUP_COUNT - define how much recent backups will be kept<br />
|
|
||||||
</td>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>volumeMounts</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<pre>
|
|
||||||
- name: jenkins-home
|
|
||||||
mountPath: /jenkins-home
|
|
||||||
- mountPath: /backup
|
|
||||||
name: backup
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
Holds the mount points for volumes.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<h4 id="Configuration">Configuration
|
|
||||||
</h3>
|
|
||||||
<p>
|
|
||||||
(<em>Appears on:</em>
|
|
||||||
<a href="#JenkinsConfiguration">Jenkins instance configuration</a>)
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<thead>
|
|
||||||
<tr>
|
|
||||||
<th>Field</th>
|
|
||||||
<th>Default value</th>
|
|
||||||
<th>Description</th>
|
|
||||||
</tr>
|
|
||||||
</thead>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>configurationAsCode</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin.
|
|
||||||
Example:<br />
|
|
||||||
<pre>
|
|
||||||
- configMapName: jenkins-casc
|
|
||||||
content: {}
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>groovyScripts</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
GroovyScripts defines configuration of Jenkins customization via groovy scripts.
|
|
||||||
Example:<br />
|
|
||||||
<pre>
|
|
||||||
- configMapName: jenkins-gs
|
|
||||||
content: {}
|
|
||||||
</pre>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>secretRefName</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
""
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
secretRefName of existing secret (previously created).
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<code>secretData</code>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
{}
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
If secretRefName is empty, secretData creates new secret and fills with data provided in secretData.
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
|
|
@ -15,10 +15,8 @@ All container images can be found at [virtuslab/jenkins-operator](https://hub.do
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
To run **Jenkins Operator**, you will need:
|
To run **Jenkins Operator**, you will need:
|
||||||
|
- access to a Kubernetes cluster version `1.17+`
|
||||||
- access to a Kubernetes cluster version `1.11+`
|
- `kubectl` version `1.17+`
|
||||||
|
|
||||||
- `kubectl` version `1.11+`
|
|
||||||
|
|
||||||
## Configure Custom Resource Definition
|
## Configure Custom Resource Definition
|
||||||
|
|
||||||
|
|
@ -37,7 +35,7 @@ There are two ways to deploy the Jenkins Operator.
|
||||||
Apply Service Account and RBAC roles:
|
Apply Service Account and RBAC roles:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/all-in-one-v1alpha2.yaml
|
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/config/all-in-one-v1alpha2.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
Watch **Jenkins Operator** instance being created:
|
Watch **Jenkins Operator** instance being created:
|
||||||
|
|
@ -50,7 +48,7 @@ Now **Jenkins Operator** should be up and running in the `default` namespace.
|
||||||
|
|
||||||
### Using Helm Chart
|
### Using Helm Chart
|
||||||
|
|
||||||
There is a option to use Helm to install the operator. It requires the Helm 3+ for deployment.
|
There is an option to use Helm to install the operator. It requires the Helm 3+ for deployment.
|
||||||
|
|
||||||
Create a namespace for the operator:
|
Create a namespace for the operator:
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue