This document describes steps needed to install Operator Service for Jenkins from Red Hat marketplace
You need to have access to a namespace in which you wish to deploy the operator. For information on registering your cluster and creating a namespace, see Red Hat Marketplace Docs. This must be done prior to operator installation.
- On the main menu, click Workspace > My Software > Product > Install Operator.
- Search for and select Operator Service for Jenkins
- On the Update Channel section, select an option.
- On the Approval Strategy section, select either Automatic or Manual. The approval strategy corresponds to how you want to process operator upgrades.
- On the Target Cluster section:
- Click the checkbox next to the clusters where you want to install the Operator.
- For each cluster you selected, under Namespace Scope, on the Select Scope list, select an option.
- Click Install. It may take several minutes for installation to complete.
- Once installation is complete, the status will change from Installing to Up to date.
- For further information, see the Red Hat Marketplace Operator documentation
- Once status changes to Up to date, click the vertical ellipses and select Cluster Console.
- Open the cluster where you installed the product
- Go to Operators > Installed Operators
- Select the Namespace or Project you installed on
- Verify status for the product is Succeeded
- Click the product name to open details
- Once the operator is up and running, you may proceed to deploy a Jenkins instance. To do so, you need to click the operator name and then create a Jenkins CR:
- Go into YAML view and paste the example Jenkins configuration:
apiVersion: operator-service.com/v1beta1 kind: Jenkins metadata: name: example spec: podSpec: containers: - command: - bash - '-c' - >- /var/jenkins/scripts/init.sh && /usr/bin/go-init -main /usr/libexec/s2i/run env: - name: OPENSHIFT_ENABLE_OAUTH value: 'true' - name: OPENSHIFT_ENABLE_REDIRECT_PROMPT value: 'true' - name: DISABLE_ADMINISTRATIVE_MONITORS value: 'false' - name: KUBERNETES_MASTER value: 'https://kubernetes.default:443' - name: KUBERNETES_TRUST_CERTIFICATES value: 'true' - name: JENKINS_SERVICE_NAME value: op-svc-jenkins-http-example - name: JNLP_SERVICE_NAME value: op-svc-jenkins-agent-example - name: JENKINS_UC_INSECURE value: 'false' - name: JENKINS_HOME value: /var/lib/jenkins - name: JAVA_OPTS value: >- -XX:+UnlockExperimentalVMOptions -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -XX:MaxRAMFraction=1 -Djenkins.install.runSetupWizard=false -Djava.awt.headless=true image: 'quay.io/openshift/origin-jenkins:4.9.0' imagePullPolicy: IfNotPresent name: jenkins-controller disableCSRFProtection: true authorizationStrategy: serviceAccount roles: - apiGroup: rbac.authorization.k8s.io name: admin kind: ClusterRole
- Click Create and then the Jenkins instance will start.
- Go to Jenkins tab and wait for Jenkins to report status Ready. It might take several minutes.
- Once Jenkins is ready, you can navigate to Networking > Routes to see the route that the Operator made for Jenkins. Clicking there will prompt you to login using OpenShift OAuth. After logging, you will be presented with Jenkins UI
- Jenkins jobs definitions are declared in the SeedJob CR. To create your first jobs that will persist after Jenkins’ restarts, go to the JenkinsSeedJob tab
- In the YAML view, paste the example SeedJob:
apiVersion: operator-service.com/v1beta1 kind: JenkinsSeedJob metadata: name: example-jenkins-seedjob labels: operator-service.com/jenkins: example spec: repository: url: https://github.com/jenkinsci/kubernetes-operator.git branch: master targets: "cicd/jobs/*.jenkins"
- Wait for the SeedJob to report the Ready status
- Go to Jenkins UI and you will see example jobs: