Copy sample cr to docs with new required values && fix urls (#575)
This commit is contained in:
parent
485abaad8d
commit
985517b04f
|
|
@ -15,45 +15,57 @@ apiVersion: jenkins.io/v1alpha2
|
|||
kind: Jenkins
|
||||
metadata:
|
||||
name: example
|
||||
namespace: default
|
||||
spec:
|
||||
configurationAsCode:
|
||||
configurations: []
|
||||
secret:
|
||||
name: ""
|
||||
groovyScripts:
|
||||
configurations: []
|
||||
secret:
|
||||
name: ""
|
||||
jenkinsAPISettings:
|
||||
authorizationStrategy: createUser
|
||||
master:
|
||||
disableCSRFProtection: false
|
||||
containers:
|
||||
- name: jenkins-master
|
||||
image: jenkins/jenkins:2.277.4-lts-alpine
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 12
|
||||
httpGet:
|
||||
path: /login
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 80
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
failureThreshold: 3
|
||||
httpGet:
|
||||
path: /login
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1500m
|
||||
memory: 3Gi
|
||||
requests:
|
||||
cpu: "1"
|
||||
memory: 500Mi
|
||||
- name: jenkins-master
|
||||
image: jenkins/jenkins:2.277.4-lts-alpine
|
||||
imagePullPolicy: Always
|
||||
livenessProbe:
|
||||
failureThreshold: 12
|
||||
httpGet:
|
||||
path: /login
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 100
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 5
|
||||
readinessProbe:
|
||||
failureThreshold: 10
|
||||
httpGet:
|
||||
path: /login
|
||||
port: http
|
||||
scheme: HTTP
|
||||
initialDelaySeconds: 80
|
||||
periodSeconds: 10
|
||||
successThreshold: 1
|
||||
timeoutSeconds: 1
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1500m
|
||||
memory: 3Gi
|
||||
requests:
|
||||
cpu: "1"
|
||||
memory: 500Mi
|
||||
seedJobs:
|
||||
- id: jenkins-operator
|
||||
targets: "cicd/jobs/*.jenkins"
|
||||
description: "Jenkins Operator repository"
|
||||
repositoryBranch: master
|
||||
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git
|
||||
- id: jenkins-operator
|
||||
targets: "cicd/jobs/*.jenkins"
|
||||
description: "Jenkins Operator repository"
|
||||
repositoryBranch: master
|
||||
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git
|
||||
```
|
||||
|
||||
Deploy a Jenkins to Kubernetes:
|
||||
|
|
|
|||
|
|
@ -7,98 +7,4 @@ description: >
|
|||
Additional configuration for OpenShift
|
||||
---
|
||||
|
||||
## SecurityContext
|
||||
|
||||
OpenShift enforces Security Constraints Context (scc) when deploying an image.
|
||||
By default, container images run in restricted scc which prevents from setting
|
||||
a fixed user id to run with. You need to have ensure that you do not provide a
|
||||
securityContext with a runAsUser and that your image does not use a hardcoded user.
|
||||
|
||||
```yaml
|
||||
securityContext: {}
|
||||
```
|
||||
|
||||
## OpenShift Jenkins image
|
||||
|
||||
OpenShift provides a pre-configured Jenkins image containing 3 openshift plugins for
|
||||
jenkins (openshift-login-plugin, openshift-sync-plugin and openshift-client-plugin)
|
||||
which allows better jenkins integration with kubernetes and OpenShift.
|
||||
|
||||
The OpenShift Jenkins image requires additional configuration to be fully enabled.
|
||||
|
||||
### Sample OpenShift CR
|
||||
The following Custom Resource can be used to create a Jenkins instance using the
|
||||
OpenShift Jenkins image and sets values for:
|
||||
- `image: 'quay.io/openshift/origin-jenkins:latest' : This is the OpenShift Jenkins image.
|
||||
|
||||
- serviceAccount: to allow oauth authentication to work, the service account needs
|
||||
a specific annotation pointing to the route exposing the jenkins service. Here,
|
||||
the route is named `jenkins-route`
|
||||
|
||||
- `OPENSHIFT_ENABLE_OAUTH` environment variable for the master container is set to true.
|
||||
|
||||
Here is a complete Jenkins CR allowing the deployment of the Jenkins OpenShift image.
|
||||
```yaml
|
||||
apiVersion: jenkins.io/v1alpha2
|
||||
kind: Jenkins
|
||||
metadata:
|
||||
annotations:
|
||||
jenkins.io/openshift-mode: 'true'
|
||||
name: jenkins
|
||||
spec:
|
||||
serviceAccount:
|
||||
annotations:
|
||||
serviceaccounts.openshift.io/oauth-redirectreference.jenkins: '{"kind":"OAuthRedirectReference","apiVersion":"v1","reference":{"kind":"Route","name":"jenkins-route"}}'
|
||||
master:
|
||||
containers:
|
||||
- name: jenkins-master
|
||||
image: 'quay.io/openshift/origin-jenkins:latest'
|
||||
command:
|
||||
- /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: jenkins-operator-http-jenkins
|
||||
- name: JNLP_SERVICE_NAME
|
||||
value: jenkins-operator-slave-jenkins
|
||||
- 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
|
||||
imagePullPolicy: Always
|
||||
service:
|
||||
port: 8080
|
||||
type: ClusterIP
|
||||
slaveService:
|
||||
port: 50000
|
||||
type: ClusterIP
|
||||
```
|
||||
|
||||
### OpenShift OAuth integration
|
||||
The creation of a Route is required for the integraiton of Jenkins with
|
||||
OpenShift oauth authentication. By default, the jenkins http service is named
|
||||
`jenkins-operator-http-${jenkins-cr-name}`
|
||||
|
||||
```bash
|
||||
oc create route edge jenkins-route --service=jenkins-operator-http-jenkins
|
||||
```
|
||||
Note: the route name (jenkins-route) must match the pointed route on the serviceaccount annotation.
|
||||
|
||||
|
||||
After the creation of the Route. It can be used to navigate to the Jenkins Login Page and login with your Openshift Credentials.
|
||||
## Release 0.6.0 is not compatible with OpenShift and JenkinsImage crd was removed from it.
|
||||
|
|
@ -23,7 +23,7 @@ To run **Jenkins Operator**, you will need:
|
|||
Install Jenkins Custom Resource Definition:
|
||||
|
||||
```bash
|
||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/crds/jenkins_v1alpha2_jenkins_crd.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/config/crd/bases/jenkins.io_jenkins.yaml
|
||||
```
|
||||
|
||||
## Deploy Jenkins Operator
|
||||
|
|
@ -35,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/config/all-in-one-v1alpha2.yaml
|
||||
kubectl apply -f https://raw.githubusercontent.com/jenkinsci/kubernetes-operator/master/deploy/all-in-one-v1alpha2.yaml
|
||||
```
|
||||
|
||||
Watch **Jenkins Operator** instance being created:
|
||||
|
|
|
|||
Loading…
Reference in New Issue