From cd3dbeb0a5419f4f86750f69c107f6f40e3db5dd Mon Sep 17 00:00:00 2001 From: Mateusz Korus Date: Thu, 10 Jun 2021 10:39:12 +0200 Subject: [PATCH] Update website - 0.6.0 release --- Makefile | 6 +- .../en/docs/Developer Guide/Preview/_index.md | 301 ------ .../content/en/docs/Developer Guide/_index.md | 188 ++-- .../en/docs/Getting Started/latest/_index.md | 8 +- .../Getting Started/latest/configuration.md | 12 +- .../latest/configure-backup-and-restore.md | 10 +- .../Getting Started/latest/customization.md | 8 +- .../Getting Started/latest/deploy-jenkins.md | 2 +- .../Getting Started/latest/notifications.md | 8 +- .../{Preview => v0.5.x}/_index.md | 8 +- .../{Preview => v0.5.x}/aks.md | 0 .../{Preview => v0.5.x}/configuration.md | 12 +- .../configure-backup-and-restore.md | 10 +- .../custom-backup-and-restore.md | 0 .../{Preview => v0.5.x}/customization.md | 8 +- .../{Preview => v0.5.x}/deploy-jenkins.md | 2 +- .../{Preview => v0.5.x}/diagnostics.md | 0 .../{Preview => v0.5.x}/notifications.md | 8 +- .../{Preview => v0.5.x}/openshift.md | 0 .../{Preview => v0.5.x}/schema.md | 0 .../en/docs/Installation/Preview/_index.md | 881 ------------------ .../content/en/docs/Installation/_index.md | 10 +- 22 files changed, 150 insertions(+), 1332 deletions(-) delete mode 100644 website/content/en/docs/Developer Guide/Preview/_index.md rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/_index.md (70%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/aks.md (100%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/configuration.md (99%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/configure-backup-and-restore.md (98%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/custom-backup-and-restore.md (100%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/customization.md (98%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/deploy-jenkins.md (99%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/diagnostics.md (100%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/notifications.md (98%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/openshift.md (100%) rename website/content/en/docs/Getting Started/{Preview => v0.5.x}/schema.md (100%) delete mode 100644 website/content/en/docs/Installation/Preview/_index.md diff --git a/Makefile b/Makefile index 04e68e7f..b101483e 100644 --- a/Makefile +++ b/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 @echo "+ $@" 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) - @tar -C $(GEN_CRD_API) -zxf $(GEN_CRD_API)_linux_amd64.tar.gz - @rm $(GEN_CRD_API)_linux_amd64.tar.gz + @tar -C $(GEN_CRD_API) -zxf $(GEN_CRD_API)_$(PLATFORM)_amd64.tar.gz + @rm $(GEN_CRD_API)_$(PLATFORM)_amd64.tar.gz 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 diff --git a/website/content/en/docs/Developer Guide/Preview/_index.md b/website/content/en/docs/Developer Guide/Preview/_index.md deleted file mode 100644 index 595fe717..00000000 --- a/website/content/en/docs/Developer Guide/Preview/_index.md +++ /dev/null @@ -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- --url -kubectl get secret jenkins-operator-credentials- -o 'jsonpath={.data.user}' | base64 -d -kubectl get secret jenkins-operator-credentials- -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) diff --git a/website/content/en/docs/Developer Guide/_index.md b/website/content/en/docs/Developer Guide/_index.md index b7a594c5..5dab11e5 100644 --- a/website/content/en/docs/Developer Guide/_index.md +++ b/website/content/en/docs/Developer Guide/_index.md @@ -2,7 +2,7 @@ title: "Developer Guide" linkTitle: "Developer Guide" weight: 60 -date: 2019-08-05 +date: 2021-06-10 description: > Jenkins Operator for developers --- @@ -13,11 +13,11 @@ This document explains how to setup your development environment. ## Prerequisites -- [operator_sdk][operator_sdk] version v0.17.0 +- [operator_sdk][operator_sdk] version 1.3.0 - [git][git_tool] -- [go][go_tool] version v1.14+ +- [go][go_tool] version 1.15.6 - [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+ ## Clone repository and download dependencies @@ -30,64 +30,67 @@ make go-dependencies ## 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 -make build minikube-run - -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} +make minikube-start ``` - +Next run **Jenkins Operator** locally. ```bash -kubectl apply -f deploy/crds/jenkins_v1alpha2_jenkins_cr.yaml - -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"} +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: @@ -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/). - +``` ```bash kubectl get jenkins -o yaml @@ -105,7 +108,7 @@ items: - apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: - ... + ... spec: backup: action: {} @@ -113,18 +116,19 @@ items: interval: 0 makeBackupBeforePodDeletion: false configurationAsCode: - configurations: null + configurations: [] secret: name: "" groovyScripts: - configurations: null + configurations: [] secret: name: "" jenkinsAPISettings: authorizationStrategy: createUser master: basePlugins: - ... + ... + containers: - command: - bash - -c @@ -133,13 +137,12 @@ items: - name: JAVA_OPTS value: -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -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 livenessProbe: - ... - name: jenkins-master + ... readinessProbe: - ... + ... resources: limits: cpu: 1500m @@ -148,7 +151,6 @@ items: cpu: "1" memory: 500Mi disableCSRFProtection: false - securityContext: {} restore: action: {} containerName: "" @@ -179,15 +181,15 @@ items: - configurationType: base-groovy hash: 2ownqpRyBjQYmzTRttUx7axok3CKe2E45frI5iRwH0w= name: 1-basic-settings.groovy - source: jenkins-operator-base-configuration-example - ... - baseConfigurationCompletedTime: "2020-04-27T07:59:49Z" + source: jenkins-operator-base-configuration-jenkins-example + ... + baseConfigurationCompletedTime: "2021-02-08T13:27:01Z" createdSeedJobs: - jenkins-operator - operatorVersion: v0.4.0 - provisionStartTime: "2020-04-27T07:56:40Z" - userAndPasswordHash: kAeBnhHKU3LZuw+uo9oHILB59kAFSGDUbHwCSDgtMnE= - userConfigurationCompletedTime: "2020-04-27T08:00:06Z" + operatorVersion: v0.5.0 + provisionStartTime: "2021-02-08T13:24:55Z" + userAndPasswordHash: nnfZsWmFfAYlYyVYeKhWW2KB4L8mE61JUfetAsr9IMM= + userConfigurationCompletedTime: "2021-02-08T13:27:33Z" kind: List metadata: resourceVersion: "" @@ -197,22 +199,16 @@ metadata: ```bash kubectl get po -NAME READY STATUS RESTARTS AGE -jenkins-example 1/1 Running 0 15m -seed-job-agent-example-56569459c9-l69qf 1/1 Running 0 12m +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 ``` -Upon every next start of local **Jenkins Operator** switch first command with: -``` -make minikube-start -make minikube-run -``` - ### Debug Jenkins Operator ```bash -make build minikube-run OPERATOR_EXTRA_ARGS="--debug" +make run OPERATOR_EXTRA_ARGS="--debug" ``` ## Build and run with a remote Kubernetes cluster @@ -233,7 +229,15 @@ kubectl --context remote-k8s --namespace default get po ## 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 make test @@ -251,25 +255,23 @@ make e2e Run the specific e2e test: ```bash -make build e2e E2E_TEST_SELECTOR='^TestConfiguration$' +make e2e E2E_TEST_SELECTOR='^TestConfiguration$' ``` -## Tips & Tricks - -### Building docker image on minikube (for e2e tests) +### 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 $(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: ```bash -make deepcopy-gen +make manifests ``` ### Getting the Jenkins URL and basic credentials diff --git a/website/content/en/docs/Getting Started/latest/_index.md b/website/content/en/docs/Getting Started/latest/_index.md index 6cf18443..3a02a0c7 100644 --- a/website/content/en/docs/Getting Started/latest/_index.md +++ b/website/content/en/docs/Getting Started/latest/_index.md @@ -1,14 +1,14 @@ --- -title: "Latest (v0.5.x)" -linkTitle: "Latest (v0.5.x)" +title: "Latest (v0.6.x)" +linkTitle: "Latest (v0.6.x)" weight: 10 date: 2021-01-18 description: > - How to work with jenkins-operator latest version + How to work with jenkins-operator to be released version --- {{% 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 %}} ## First Steps diff --git a/website/content/en/docs/Getting Started/latest/configuration.md b/website/content/en/docs/Getting Started/latest/configuration.md index 439a0de8..f3c4b8a7 100644 --- a/website/content/en/docs/Getting Started/latest/configuration.md +++ b/website/content/en/docs/Getting Started/latest/configuration.md @@ -89,7 +89,7 @@ podTemplate(label: label, Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest: -```yaml +``` apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: @@ -150,7 +150,7 @@ If key was generated by `ssh-keygen` the public key content is located in , 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 makeBackupBeforePodDeletion: true # make a backup before pod deletion restore: @@ -82,9 +86,5 @@ spec: exec: command: - /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh , 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: # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored ``` diff --git a/website/content/en/docs/Getting Started/latest/customization.md b/website/content/en/docs/Getting Started/latest/customization.md index 1cc93540..76b12e10 100644 --- a/website/content/en/docs/Getting Started/latest/customization.md +++ b/website/content/en/docs/Getting Started/latest/customization.md @@ -17,7 +17,7 @@ Pre-installed plugins: * git v4.5.0 * job-dsl v1.77 * kubernetes-credentials-provider v0.15 -* kubernetes v1.29.2 +* kubernetes v1.29.0 * workflow-aggregator v2.6 * 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`: -``` +```yaml apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: @@ -51,7 +51,7 @@ spec: master: basePlugins: - name: kubernetes - version: "1.29.2" + version: "1.28.6" - name: workflow-job version: "2.40" - name: workflow-aggregator @@ -61,7 +61,7 @@ spec: - name: job-dsl version: "1.77" - name: configuration-as-code - version: "1.47" + version: "1.46" - name: kubernetes-credentials-provider version: "0.15" ``` diff --git a/website/content/en/docs/Getting Started/latest/deploy-jenkins.md b/website/content/en/docs/Getting Started/latest/deploy-jenkins.md index 4330aae1..5e057b22 100644 --- a/website/content/en/docs/Getting Started/latest/deploy-jenkins.md +++ b/website/content/en/docs/Getting Started/latest/deploy-jenkins.md @@ -10,7 +10,7 @@ description: > 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. -```bash +```yaml apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: diff --git a/website/content/en/docs/Getting Started/latest/notifications.md b/website/content/en/docs/Getting Started/latest/notifications.md index b02f450a..06845e29 100644 --- a/website/content/en/docs/Getting Started/latest/notifications.md +++ b/website/content/en/docs/Getting Started/latest/notifications.md @@ -19,7 +19,7 @@ $ kubectl create secret generic jenkins-operator-notification-data --from-litera Example configuration for Slack: -``` +```yaml kind: Jenkins spec: master: @@ -40,7 +40,7 @@ Please follow [this](https://docs.microsoft.com/en-gb/outlook/actionable-message Example configuration for Microsoft Teams: -``` +```yaml kind: Jenkins spec: master: @@ -59,7 +59,7 @@ spec: Example configuration for Mailgun: -``` +```yaml kind: Jenkins spec: 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. For example you will send notifications to Slack and Teams. -``` +```yaml kind: Jenkins spec: master: diff --git a/website/content/en/docs/Getting Started/Preview/_index.md b/website/content/en/docs/Getting Started/v0.5.x/_index.md similarity index 70% rename from website/content/en/docs/Getting Started/Preview/_index.md rename to website/content/en/docs/Getting Started/v0.5.x/_index.md index 64cd1b66..8950c703 100644 --- a/website/content/en/docs/Getting Started/Preview/_index.md +++ b/website/content/en/docs/Getting Started/v0.5.x/_index.md @@ -1,14 +1,14 @@ --- -title: "Preview" -linkTitle: "Preview" +title: "v0.5.x" +linkTitle: "v0.5.x" weight: 10 date: 2021-01-18 description: > - How to work with jenkins-operator to be released version + How to work with jenkins-operator latest version --- {{% 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 %}} ## First Steps diff --git a/website/content/en/docs/Getting Started/Preview/aks.md b/website/content/en/docs/Getting Started/v0.5.x/aks.md similarity index 100% rename from website/content/en/docs/Getting Started/Preview/aks.md rename to website/content/en/docs/Getting Started/v0.5.x/aks.md diff --git a/website/content/en/docs/Getting Started/Preview/configuration.md b/website/content/en/docs/Getting Started/v0.5.x/configuration.md similarity index 99% rename from website/content/en/docs/Getting Started/Preview/configuration.md rename to website/content/en/docs/Getting Started/v0.5.x/configuration.md index f3c4b8a7..439a0de8 100644 --- a/website/content/en/docs/Getting Started/Preview/configuration.md +++ b/website/content/en/docs/Getting Started/v0.5.x/configuration.md @@ -89,7 +89,7 @@ podTemplate(label: label, Jenkins Seed Jobs are configured using `Jenkins.spec.seedJobs` section from your custom resource manifest: -``` +```yaml apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: @@ -150,7 +150,7 @@ If key was generated by `ssh-keygen` the public key content is located in , 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 makeBackupBeforePodDeletion: true # make a backup before pod deletion restore: @@ -86,5 +82,9 @@ spec: exec: command: - /home/user/bin/restore.sh # this command is invoked on "backup" container to make restore backup, for example /home/user/bin/restore.sh , 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: # if want to restore specific backup configure this field and then Jenkins will be restarted and desired backup will be restored ``` diff --git a/website/content/en/docs/Getting Started/Preview/custom-backup-and-restore.md b/website/content/en/docs/Getting Started/v0.5.x/custom-backup-and-restore.md similarity index 100% rename from website/content/en/docs/Getting Started/Preview/custom-backup-and-restore.md rename to website/content/en/docs/Getting Started/v0.5.x/custom-backup-and-restore.md diff --git a/website/content/en/docs/Getting Started/Preview/customization.md b/website/content/en/docs/Getting Started/v0.5.x/customization.md similarity index 98% rename from website/content/en/docs/Getting Started/Preview/customization.md rename to website/content/en/docs/Getting Started/v0.5.x/customization.md index 76b12e10..1cc93540 100644 --- a/website/content/en/docs/Getting Started/Preview/customization.md +++ b/website/content/en/docs/Getting Started/v0.5.x/customization.md @@ -17,7 +17,7 @@ Pre-installed plugins: * git v4.5.0 * job-dsl v1.77 * kubernetes-credentials-provider v0.15 -* kubernetes v1.29.0 +* kubernetes v1.29.2 * workflow-aggregator v2.6 * 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`: -```yaml +``` apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: @@ -51,7 +51,7 @@ spec: master: basePlugins: - name: kubernetes - version: "1.28.6" + version: "1.29.2" - name: workflow-job version: "2.40" - name: workflow-aggregator @@ -61,7 +61,7 @@ spec: - name: job-dsl version: "1.77" - name: configuration-as-code - version: "1.46" + version: "1.47" - name: kubernetes-credentials-provider version: "0.15" ``` diff --git a/website/content/en/docs/Getting Started/Preview/deploy-jenkins.md b/website/content/en/docs/Getting Started/v0.5.x/deploy-jenkins.md similarity index 99% rename from website/content/en/docs/Getting Started/Preview/deploy-jenkins.md rename to website/content/en/docs/Getting Started/v0.5.x/deploy-jenkins.md index 5e057b22..4330aae1 100644 --- a/website/content/en/docs/Getting Started/Preview/deploy-jenkins.md +++ b/website/content/en/docs/Getting Started/v0.5.x/deploy-jenkins.md @@ -10,7 +10,7 @@ description: > 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. -```yaml +```bash apiVersion: jenkins.io/v1alpha2 kind: Jenkins metadata: diff --git a/website/content/en/docs/Getting Started/Preview/diagnostics.md b/website/content/en/docs/Getting Started/v0.5.x/diagnostics.md similarity index 100% rename from website/content/en/docs/Getting Started/Preview/diagnostics.md rename to website/content/en/docs/Getting Started/v0.5.x/diagnostics.md diff --git a/website/content/en/docs/Getting Started/Preview/notifications.md b/website/content/en/docs/Getting Started/v0.5.x/notifications.md similarity index 98% rename from website/content/en/docs/Getting Started/Preview/notifications.md rename to website/content/en/docs/Getting Started/v0.5.x/notifications.md index 06845e29..b02f450a 100644 --- a/website/content/en/docs/Getting Started/Preview/notifications.md +++ b/website/content/en/docs/Getting Started/v0.5.x/notifications.md @@ -19,7 +19,7 @@ $ kubectl create secret generic jenkins-operator-notification-data --from-litera Example configuration for Slack: -```yaml +``` kind: Jenkins spec: master: @@ -40,7 +40,7 @@ Please follow [this](https://docs.microsoft.com/en-gb/outlook/actionable-message Example configuration for Microsoft Teams: -```yaml +``` kind: Jenkins spec: master: @@ -59,7 +59,7 @@ spec: Example configuration for Mailgun: -```yaml +``` kind: Jenkins spec: 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. For example you will send notifications to Slack and Teams. -```yaml +``` kind: Jenkins spec: master: diff --git a/website/content/en/docs/Getting Started/Preview/openshift.md b/website/content/en/docs/Getting Started/v0.5.x/openshift.md similarity index 100% rename from website/content/en/docs/Getting Started/Preview/openshift.md rename to website/content/en/docs/Getting Started/v0.5.x/openshift.md diff --git a/website/content/en/docs/Getting Started/Preview/schema.md b/website/content/en/docs/Getting Started/v0.5.x/schema.md similarity index 100% rename from website/content/en/docs/Getting Started/Preview/schema.md rename to website/content/en/docs/Getting Started/v0.5.x/schema.md diff --git a/website/content/en/docs/Installation/Preview/_index.md b/website/content/en/docs/Installation/Preview/_index.md deleted file mode 100644 index 60f42ee0..00000000 --- a/website/content/en/docs/Installation/Preview/_index.md +++ /dev/null @@ -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 -``` - -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 jenkins/jenkins-operator -n -``` - -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 jenkins/jenkins-operator -n --set jenkins.labels.LabelKey=LabelValue,jenkins.annotations.AnnotationKey=AnnotationValue -``` -You can further customize Jenkins using `values.yaml`: -

Jenkins instance configuration -

- - - - - - - - - - - - - - - - - -
FieldDefault valueDescription
-jenkins - -

operator is section for configuring operator deployment

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-enabled - -true - -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. -
-apiVersion -jenkins.io/v1alpha2 -Version of the CR manifest. The recommended and default value is jenkins.io/v1alpha2. -More info -
-name - -jenkins - -Name of resource. The pod name will be jenkins-<name> (name will be set as suffix). -
-namespace - -default - -Namespace the resources will be deployed to. It's not recommended to use default namespace. -Create new namespace for jenkins (e.g. kubectl create -n jenkins) -
-labels - -{} - -Labels are injected into metadata labels field. -
-annotations - -{} - -Annotations are injected into metadata annotations field. -
-image - -jenkins/jenkins:lts - -Image is the name (and tag) of the Jenkins instance. -It's recommended to use LTS (tag: "lts") version. -
-env - -[] - -Env contains jenkins container environment variables. -
-imagePullPolicy - -Always - -Defines policy for pulling images -
-priorityClassName - -"" - -PriorityClassName indicates the importance of a Pod relative to other Pods. -More info -
-disableCSRFProtection - -false - -disableCSRFProtection can enable or disable operator built-in CSRF protection. -Set it to true if you are using OpenShift Jenkins Plugin. -More info -
-imagePullSecrets - -[] - -Used if you want to pull images from private repository -More info -
-notifications - -[] - -Notifications is feature that notify user about Jenkins reconcilation status -More info -
-basePlugins - -
-- 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"
-
-
-Plugins installed and required by the operator -shouldn't contain plugins defined by user -You can change their versions here -More info -
-plugins - -[] - -Plugins required by the user. You can define plugins here. -More info -Example: -
-plugins:
- - name: simple-theme-plugin
-   version: 0.5.1
-
-
-seedJobs - -[] - -Placeholder for jenkins seed jobs -For seed job creation tutorial, check:
Prepare seed jobs -
Configure seed jobs -
Example: - -
-seedJobs:
-- id: jenkins-operator
-  targets: "cicd/jobs/*.jenkins"
-  description: "Jenkins Operator repository"
-  repositoryBranch: master
-  repositoryUrl: 
-  - https://github.com/jenkinsci/kubernetes-operator.git
-
-
-
-resources - -
-limits:
-  cpu: 1500m
-  memory: 3Gi
-requests:
-  cpu: 1
-  memory: 500M
-
-
-Resource limit/request for Jenkins -More info -
-volumes - -
-- name: backup
-  persistentVolumeClaim:
-    claimName: jenkins-backup
-
-
-Volumes used by Jenkins -By default, we are only using PVC volume for storing backups. -
-volumeMounts - -[] - -volumeMounts are mounts for Jenkins pod. -
-securityContext - -runAsUser: 1000 -fsGroup: 1000 - -SecurityContext for pod. -
servicenot implementedHttp 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.
slaveServicenot implementedSlave 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.
-livenessProbe - -
-livenessProbe:
-  failureThreshold: 12
-  httpGet:
-    path: /login
-    port: http
-    scheme: HTTP
-  initialDelaySeconds: 80
-  periodSeconds: 10
-  successThreshold: 1
-  timeoutSeconds: 5
-
-
-livenessProbe for Pod -
-readinessProbe - -
-readinessProbe:
-  failureThreshold: 3
-  httpGet:
-    path: /login
-    port: http
-    scheme: HTTP
-  initialDelaySeconds: 30
-  periodSeconds: 10
-  successThreshold: 1
-  timeoutSeconds: 1
-
-
-readinessProbe for Pod -
- -backup - -

- - -Backup - - -

-
- -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: Configure backup and restore -For customization tips see Custom backup and restore -
-configuration -

- - -Configuration - - -

-
-Section where we can configure Jenkins instance. -See Customization for details -
-
- -### Configuring operator deployment - - - - - - - - - - - - - - - - - -
FieldDefault valueDescription
- operator - -

operator is section for configuring operator deployment

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- replicaCount
-
- 1 - - Number of Replicas. -
- image - - virtuslab/jenkins-operator:v0.4.0 - - Name (and tag) of the Jenkins Operator image. -
- imagePullPolicy - - IfNotPresent - - Defines policy for pulling images. -
- imagePullSecrets - - [] - - Used if you want to pull images from private repository. -
- nameOverride - - "" - - nameOverride overrides the app name. -
- fullnameOverride - - "" - - fullnameOverride overrides the deployment name -
- resources - - {} - -
- nodeSelector - - {} - -
- tolerations - - {} - -
- affinity - - {} - -
-
- - - -

Backup -

-

-(Appears on: -JenkinsConfiguration) -

-

-Backup defines configuration of Jenkins backup. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDefault valueDescription
- enabled - - true - - Enabled is enable/disable switch for backup feature. -
- image - - virtuslab/jenkins-operator-backup-pvc:v0.0.8 - - Image used by backup feature. -
- containerName - - backup - - Backup container name. -
- interval - - 30 - - Defines how often make backup in seconds. -
- makeBackupBeforePodDeletion - - true - - When enabled will make backup before pod deletion. -
- backupCommand - - /home/user/bin/backup.sh - - Backup container command. -
- restoreCommand - - /home/user/bin/restore.sh - - Backup restore command. -
- pvc - -

Persistent Volume Claim Kubernetes resource

-
- - - - - - - - - - - - - - - - - - - - - - - -
- enabled - - true - - Enable/disable switch for PVC -
- enabled - - true - - Enable/disable switch for PVC -
- size - - 5Gi - - Size of PVC -
- className - - "" - - StorageClassName for PVC - More info -
-
- env - -
-- name: BACKUP_DIR
-  value: /backup
-- name: JENKINS_HOME
-  value: /jenkins-home
-- name: BACKUP_COUNT
-  value: "3"
-
-
- Contains container environment variables. - PVC backup provider handles these variables:
- BACKUP_DIR - path for storing backup files (default: "/backup")
- JENKINS_HOME - path to jenkins home (default: "/jenkins-home")
- BACKUP_COUNT - define how much recent backups will be kept
-
- volumeMounts - -
-- name: jenkins-home
-  mountPath: /jenkins-home
-- mountPath: /backup
-  name: backup
-
-
- Holds the mount points for volumes. -
- -

Configuration -

-

- (Appears on: - Jenkins instance configuration) -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FieldDefault valueDescription
- configurationAsCode - - {} - - ConfigurationAsCode defines configuration of Jenkins customization via Configuration as Code Jenkins plugin. -Example:
-
-- configMapName: jenkins-casc
-  content: {}
-
-
- groovyScripts - - {} - - GroovyScripts defines configuration of Jenkins customization via groovy scripts. - Example:
-
-- configMapName: jenkins-gs
-  content: {}
-
-
- secretRefName - - "" - - secretRefName of existing secret (previously created). -
- secretData - - {} - - If secretRefName is empty, secretData creates new secret and fills with data provided in secretData. -
- diff --git a/website/content/en/docs/Installation/_index.md b/website/content/en/docs/Installation/_index.md index 9e457b83..d1fc5576 100644 --- a/website/content/en/docs/Installation/_index.md +++ b/website/content/en/docs/Installation/_index.md @@ -15,10 +15,8 @@ All container images can be found at [virtuslab/jenkins-operator](https://hub.do ## Requirements To run **Jenkins Operator**, you will need: - -- access to a Kubernetes cluster version `1.11+` - -- `kubectl` version `1.11+` +- access to a Kubernetes cluster version `1.17+` +- `kubectl` version `1.17+` ## Configure Custom Resource Definition @@ -37,7 +35,7 @@ There are two ways to deploy the Jenkins Operator. Apply Service Account and RBAC roles: ```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: @@ -50,7 +48,7 @@ Now **Jenkins Operator** should be up and running in the `default` namespace. ### 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: