Files
kubernetes-operator/website/content/en/docs/Developer Guide/_index.md
T
Tomasz Sęk e18485788d Merge branch 'openshift'
# Conflicts:
#	docs/docs/developer-guide/index.html
#	docs/docs/developer-guide/tools/index.html
#	docs/docs/getting-started/index.html
#	docs/docs/getting-started/latest/aks/index.html
#	docs/docs/getting-started/latest/configuration/index.html
#	docs/docs/getting-started/latest/configure-backup-and-restore/index.html
#	docs/docs/getting-started/latest/custom-backup-and-restore/index.html
#	docs/docs/getting-started/latest/customization/index.html
#	docs/docs/getting-started/latest/deploy-jenkins/index.html
#	docs/docs/getting-started/latest/diagnostics/index.html
#	docs/docs/getting-started/latest/index.html
#	docs/docs/getting-started/latest/schema/index.html
#	docs/docs/getting-started/v0.1.x/aks/index.html
#	docs/docs/getting-started/v0.1.x/configuration/index.html
#	docs/docs/getting-started/v0.1.x/configure-backup-and-restore/index.html
#	docs/docs/getting-started/v0.1.x/customization/index.html
#	docs/docs/getting-started/v0.1.x/deploy-jenkins/index.html
#	docs/docs/getting-started/v0.1.x/diagnostics/index.html
#	docs/docs/getting-started/v0.1.x/index.html
#	docs/docs/getting-started/v0.1.x/migration-guide-v1alpha1-to-v1alpha2/index.html
#	docs/docs/getting-started/v0.1.x/scheme/index.html
#	docs/docs/getting-started/v0.2.x/migration/index.html
#	docs/docs/how-it-works/architecture-and-design/index.html
#	docs/docs/how-it-works/index.html
#	docs/docs/how-it-works/jenkins-docker-images/index.html
#	docs/docs/index.html
#	docs/docs/index.xml
#	docs/docs/installation/index.html
#	docs/docs/security/index.html
#	docs/sitemap.xml
2019-12-25 12:08:12 +01:00

3.2 KiB

title, linkTitle, weight, date, description
title linkTitle weight date description
Developer Guide Developer Guide 60 2019-08-05 Jenkins Operator for developers

{{% pageinfo %}} This document explains how to setup your development environment. {{% /pageinfo %}}

Prerequisites

Clone repository and download dependencies

mkdir -p $GOPATH/src/github.com/jenkinsci
cd $GOPATH/src/github.com/jenkinsci/
git clone git@github.com:jenkinsci/kubernetes-operator.git
cd kubernetes-operator
make go-dependencies

Build and run with a minikube

Build and run Jenkins Operator locally:

make build minikube-run EXTRA_ARGS='--minikube --local'

Once minikube and Jenkins Operator are up and running, apply Jenkins custom resource:

kubectl apply -f deploy/crds/jenkins_v1alpha2_jenkins_cr.yaml
kubectl get jenkins -o yaml
kubectl get po

Build and run with a remote Kubernetes cluster

You can also run the controller locally and make it listen to a remote Kubernetes server.

make run NAMESPACE=default KUBECTL_CONTEXT=remote-k8s EXTRA_ARGS='--kubeconfig ~/.kube/config'

Once minikube and Jenkins Operator are up and running, apply Jenkins custom resource:

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

Run unit tests:

make test

Running E2E tests

Run e2e tests with minikube:

make minikube-start
eval $(minikube docker-env)
make e2e

Run the specific e2e test:

make build e2e E2E_TEST_SELECTOR='^TestConfiguration$'

Tips & Tricks

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:

eval $(minikube docker-env)

When pkg/apis/jenkinsio/*/jenkins_types.go has changed

Run:

make deepcopy-gen

Getting the Jenkins URL and basic credentials

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