@@ -2293,6 +2293,243 @@ kubectl get secret jenkins-operator-credentials-&lt;cr_name&gt; -o <s
</description>
</item>
<item >
<title > Docs: Configuration</title>
<link > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</link>
<pubDate > Thu, 12 Jan 2023 00:00:00 +0000</pubDate>
<guid > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</guid>
<description >
< p> Jenkins operator uses < a href=" https://github.com/jenkinsci/job-dsl-plugin" > job-dsl< /a> and < a href=" https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/" > kubernetes-credentials-provider< /a> plugins for configuring jobs
and deploy keys.< /p>
< h2 id=" prepare-job-definitions-and-pipelines" > Prepare job definitions and pipelines< /h2>
< p> First you have to prepare pipelines and job definition in your GitHub repository using the following structure:< /p>
< pre> < code> cicd/
├── jobs
│ └── build.jenkins
└── pipelines
└── build.jenkins< /code> < /pre>
< p> < strong> cicd/jobs/build.jenkins< /strong> it& rsquo;s a job definition:< /p>
< pre> < code> #!/usr/bin/env groovy
pipelineJob(' build-jenkins-operator' ) {
displayName(' Build jenkins-operator' )
definition {
cpsScm {
scm {
git {
remote {
url(' https://github.com/jenkinsci/kubernetes-operator.git' )
credentials(' jenkins-operator' )
}
branches(' */master' )
}
}
scriptPath(' cicd/pipelines/build.jenkins' )
}
}
}< /code> < /pre>
< p> < strong> cicd/pipelines/build.jenkins< /strong> is an actual Jenkins pipeline:< /p>
< pre> < code> #!/usr/bin/env groovy
def label = " build-jenkins-operator-${UUID.randomUUID().toString()}"
def home = " /home/jenkins"
def workspace = " ${home}/workspace/build-jenkins-operator"
def workdir = " ${workspace}/src/github.com/jenkinsci/kubernetes-operator/"
podTemplate(label: label,
containers: [
containerTemplate(name: ' jnlp' , image: ' jenkins/inbound-agent:alpine' ),
containerTemplate(name: ' go' , image: ' golang:1-alpine' , command: ' cat' , ttyEnabled: true),
],
envVars: [
envVar(key: ' GOPATH' , value: workspace),
],
) {
node(label) {
dir(workdir) {
stage(' Init' ) {
timeout(time: 3, unit: ' MINUTES' ) {
checkout scm
}
container(' go' ) {
sh ' apk --no-cache --update add make git gcc libc-dev'
}
}
stage(' Dep' ) {
container(' go' ) {
sh ' make dep'
}
}
stage(' Test' ) {
container(' go' ) {
sh ' make test'
}
}
stage(' Build' ) {
container(' go' ) {
sh ' make build'
}
}
}
}
}< /code> < /pre>
< h2 id=" configure-seed-jobs" > Configure Seed Jobs< /h2>
< p> Jenkins Seed Jobs are configured using < code> Jenkins.spec.seedJobs< /code> section from your custom resource manifest:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> < strong> Jenkins Operator< /strong> will automatically discover and configure all the seed jobs.< /p>
< p> You can verify if deploy keys were successfully configured in the Jenkins < strong> Credentials< /strong> tab.< /p>
< p> < img src=" https://jenkinsci.github.io/kubernetes-operator/kubernetes-operator/img/jenkins-credentials.png" alt=" jenkins" /> < /p>
< p> You can verify if your pipelines were successfully configured in the Jenkins Seed Job console output.< /p>
< p> < img src=" https://jenkinsci.github.io/kubernetes-operator/kubernetes-operator/img/jenkins-seed.png" alt=" jenkins" /> < /p>
< p> If your GitHub repository is < strong> private< /strong> you have to configure SSH or username/password authentication.< /p>
< h3 id=" ssh-authentication" > SSH authentication< /h3>
< h4 id=" generate-ssh-keys" > Generate SSH Keys< /h4>
< p> There are two methods of SSH private key generation:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ openssl genrsa -out & lt;filename& gt; < span style=" color:#0000cf;font-weight:bold" > 2048< /span> < /code> < /pre> < /div>
< p> or< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ ssh-keygen -t rsa -b < span style=" color:#0000cf;font-weight:bold" > 2048< /span>
$ ssh-keygen -p -f & lt;filename& gt; -m pem< /code> < /pre> < /div>
< p> Then copy content from generated file.< /p>
< h4 id=" public-key" > Public key< /h4>
< p> If you want to upload your public key to your Git server you need to extract it.< /p>
< p> If key was generated by < code> openssl< /code> then you need to type this to extract public key:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ openssl rsa -in & lt;filename& gt; -pubout & gt; & lt;filename& gt;.pub< /code> < /pre> < /div>
< p> If key was generated by < code> ssh-keygen< /code> the public key content is located in < filename> .pub and there is no need to extract public key< /p>
< h4 id=" configure-ssh-authentication" > Configure SSH authentication< /h4>
< p> Configure a seed job like this:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator-ssh
credentialType: basicSSHUserPrivateKey
credentialID: k8s-ssh
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: git@github.com:jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> and create a Kubernetes Secret (name of secret should be the same from < code> credentialID< /code> field):< /p>
< pre> < code> apiVersion: v1
kind: Secret
metadata:
name: k8s-ssh
stringData:
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAxxDpleJjMCN5nusfW/AtBAZhx8UVVlhhhIKXvQ+dFODQIdzO
oDXybs1zVHWOj31zqbbJnsfsVZ9Uf3p9k6xpJ3WFY9b85WasqTDN1xmSd6swD4N8
...
username: github_user_name< /code> < /pre>
< h3 id=" username-password-authentication" > Username & amp; password authentication< /h3>
< p> Configure a seed job like this:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator-user-pass
credentialType: usernamePassword
credentialID: k8s-user-pass
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> and create a Kubernetes Secret (name of secret should be the same from < code> credentialID< /code> field):< /p>
< pre> < code> apiVersion: v1
kind: Secret
metadata:
name: k8s-user-pass
stringData:
username: github_user_name
password: password_or_token< /code> < /pre>
< h2 id=" http-proxy-for-downloading-plugins" > HTTP Proxy for downloading plugins< /h2>
< p> To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins CR, for e.g.:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > spec< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> master< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> containers< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> jenkins-master< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> env< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> CURL_OPTIONS< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> value< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -L< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -x< span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;proxy_url& gt;< /code> < /pre> < /div>
< p> In < code> CURL_OPTIONS< /code> var you can set additional arguments to curl command.< /p>
< h2 id=" jenkins-login-credentials" > Jenkins login credentials< /h2>
< p> The operator automatically generates a Jenkins username and password and stores it in Kubernetes secret named
< code> jenkins-operator-credentials-& lt;cr_name& gt;< /code> in the namespace where Jenkins CR has been deployed.< /p>
< p> If you want change it you can override the secret:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > apiVersion< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> v1< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> kind< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> Secret< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> metadata< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> jenkins-operator-credentials-& lt;cr-name< span style=" color:#8f5902;font-style:italic" > & gt;
< /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > namespace: & lt;namespace& gt;< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> data< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> user< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;base64-encoded-new-username< span style=" color:#8f5902;font-style:italic" > & gt;
< /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > password: & lt;base64-encoded-new-password& gt;< /span> < /code> < /pre> < /div>
< p> If needed < strong> Jenkins Operator< /strong> will restart the Jenkins master pod and then you can login with the new username and password
credentials.< /p>
< h2 id=" override-default-jenkins-container-command" > Override default Jenkins container command< /h2>
< p> The default command for the Jenkins master container < code> jenkins/jenkins:lts< /code> looks like:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > command< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> bash< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -c< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /var/jenkins/scripts/init.sh< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/bin/tini< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -s< span style=" color:#f8f8f8;text-decoration:underline" > < /span> --< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/local/bin/jenkins.sh< /code> < /pre> < /div>
< p> The script< code> /var/jenkins/scripts/init.sh< /code> is provided by the operator and configures init.groovy.d (creates the Jenkins user)
and installs plugins.
The < code> /usr/bin/tini -s -- /usr/local/bin/jenkins.sh< /code> command runs the Jenkins master main process.< /p>
< p> You can overwrite it in the following pattern:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > command< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> bash< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -c< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /var/jenkins/scripts/init.sh< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;custom-code-here& gt;< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/bin/tini< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -s< span style=" color:#f8f8f8;text-decoration:underline" > < /span> --< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/local/bin/jenkins.sh< /code> < /pre> < /div>
</description>
</item>
<item >
<title > Docs: Deploying Jenkins</title>
<link > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/</link>
@@ -3338,243 +3575,6 @@ stringData:
</description>
</item>
<item >
<title > Docs: Configuration</title>
<link > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</link>
<pubDate > Mon, 05 Aug 2019 00:00:00 +0000</pubDate>
<guid > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</guid>
<description >
< p> Jenkins operator uses < a href=" https://github.com/jenkinsci/job-dsl-plugin" > job-dsl< /a> and < a href=" https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/" > kubernetes-credentials-provider< /a> plugins for configuring jobs
and deploy keys.< /p>
< h2 id=" prepare-job-definitions-and-pipelines" > Prepare job definitions and pipelines< /h2>
< p> First you have to prepare pipelines and job definition in your GitHub repository using the following structure:< /p>
< pre> < code> cicd/
├── jobs
│ └── build.jenkins
└── pipelines
└── build.jenkins< /code> < /pre>
< p> < strong> cicd/jobs/build.jenkins< /strong> it& rsquo;s a job definition:< /p>
< pre> < code> #!/usr/bin/env groovy
pipelineJob(' build-jenkins-operator' ) {
displayName(' Build jenkins-operator' )
definition {
cpsScm {
scm {
git {
remote {
url(' https://github.com/jenkinsci/kubernetes-operator.git' )
credentials(' jenkins-operator' )
}
branches(' */master' )
}
}
scriptPath(' cicd/pipelines/build.jenkins' )
}
}
}< /code> < /pre>
< p> < strong> cicd/pipelines/build.jenkins< /strong> is an actual Jenkins pipeline:< /p>
< pre> < code> #!/usr/bin/env groovy
def label = " build-jenkins-operator-${UUID.randomUUID().toString()}"
def home = " /home/jenkins"
def workspace = " ${home}/workspace/build-jenkins-operator"
def workdir = " ${workspace}/src/github.com/jenkinsci/kubernetes-operator/"
podTemplate(label: label,
containers: [
containerTemplate(name: ' jnlp' , image: ' jenkins/inbound-agent:alpine' ),
containerTemplate(name: ' go' , image: ' golang:1-alpine' , command: ' cat' , ttyEnabled: true),
],
envVars: [
envVar(key: ' GOPATH' , value: workspace),
],
) {
node(label) {
dir(workdir) {
stage(' Init' ) {
timeout(time: 3, unit: ' MINUTES' ) {
checkout scm
}
container(' go' ) {
sh ' apk --no-cache --update add make git gcc libc-dev'
}
}
stage(' Dep' ) {
container(' go' ) {
sh ' make dep'
}
}
stage(' Test' ) {
container(' go' ) {
sh ' make test'
}
}
stage(' Build' ) {
container(' go' ) {
sh ' make build'
}
}
}
}
}< /code> < /pre>
< h2 id=" configure-seed-jobs" > Configure Seed Jobs< /h2>
< p> Jenkins Seed Jobs are configured using < code> Jenkins.spec.seedJobs< /code> section from your custom resource manifest:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> < strong> Jenkins Operator< /strong> will automatically discover and configure all the seed jobs.< /p>
< p> You can verify if deploy keys were successfully configured in the Jenkins < strong> Credentials< /strong> tab.< /p>
< p> < img src=" https://jenkinsci.github.io/kubernetes-operator/kubernetes-operator/img/jenkins-credentials.png" alt=" jenkins" /> < /p>
< p> You can verify if your pipelines were successfully configured in the Jenkins Seed Job console output.< /p>
< p> < img src=" https://jenkinsci.github.io/kubernetes-operator/kubernetes-operator/img/jenkins-seed.png" alt=" jenkins" /> < /p>
< p> If your GitHub repository is < strong> private< /strong> you have to configure SSH or username/password authentication.< /p>
< h3 id=" ssh-authentication" > SSH authentication< /h3>
< h4 id=" generate-ssh-keys" > Generate SSH Keys< /h4>
< p> There are two methods of SSH private key generation:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ openssl genrsa -out & lt;filename& gt; < span style=" color:#0000cf;font-weight:bold" > 2048< /span> < /code> < /pre> < /div>
< p> or< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ ssh-keygen -t rsa -b < span style=" color:#0000cf;font-weight:bold" > 2048< /span>
$ ssh-keygen -p -f & lt;filename& gt; -m pem< /code> < /pre> < /div>
< p> Then copy content from generated file.< /p>
< h4 id=" public-key" > Public key< /h4>
< p> If you want to upload your public key to your Git server you need to extract it.< /p>
< p> If key was generated by < code> openssl< /code> then you need to type this to extract public key:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-bash" data-lang=" bash" > $ openssl rsa -in & lt;filename& gt; -pubout & gt; & lt;filename& gt;.pub< /code> < /pre> < /div>
< p> If key was generated by < code> ssh-keygen< /code> the public key content is located in < filename> .pub and there is no need to extract public key< /p>
< h4 id=" configure-ssh-authentication" > Configure SSH authentication< /h4>
< p> Configure a seed job like this:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator-ssh
credentialType: basicSSHUserPrivateKey
credentialID: k8s-ssh
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: git@github.com:jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> and create a Kubernetes Secret (name of secret should be the same from < code> credentialID< /code> field):< /p>
< pre> < code> apiVersion: v1
kind: Secret
metadata:
name: k8s-ssh
stringData:
privateKey: |
-----BEGIN RSA PRIVATE KEY-----
MIIJKAIBAAKCAgEAxxDpleJjMCN5nusfW/AtBAZhx8UVVlhhhIKXvQ+dFODQIdzO
oDXybs1zVHWOj31zqbbJnsfsVZ9Uf3p9k6xpJ3WFY9b85WasqTDN1xmSd6swD4N8
...
username: github_user_name< /code> < /pre>
< h3 id=" username-password-authentication" > Username & amp; password authentication< /h3>
< p> Configure a seed job like this:< /p>
< pre> < code> apiVersion: jenkins.io/v1alpha2
kind: Jenkins
metadata:
name: example
spec:
seedJobs:
- id: jenkins-operator-user-pass
credentialType: usernamePassword
credentialID: k8s-user-pass
targets: " cicd/jobs/*.jenkins"
description: " Jenkins Operator repository"
repositoryBranch: master
repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git< /code> < /pre>
< p> and create a Kubernetes Secret (name of secret should be the same from < code> credentialID< /code> field):< /p>
< pre> < code> apiVersion: v1
kind: Secret
metadata:
name: k8s-user-pass
stringData:
username: github_user_name
password: password_or_token< /code> < /pre>
< h2 id=" http-proxy-for-downloading-plugins" > HTTP Proxy for downloading plugins< /h2>
< p> To use forwarding proxy with an operator to download plugins you need to add the following environment variable to Jenkins CR, for e.g.:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > spec< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> master< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> containers< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> jenkins-master< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> env< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> CURL_OPTIONS< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> value< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -L< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -x< span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;proxy_url& gt;< /code> < /pre> < /div>
< p> In < code> CURL_OPTIONS< /code> var you can set additional arguments to curl command.< /p>
< h2 id=" jenkins-login-credentials" > Jenkins login credentials< /h2>
< p> The operator automatically generates a Jenkins username and password and stores it in Kubernetes secret named
< code> jenkins-operator-credentials-& lt;cr_name& gt;< /code> in the namespace where Jenkins CR has been deployed.< /p>
< p> If you want change it you can override the secret:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > apiVersion< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> v1< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> kind< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> Secret< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> metadata< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> name< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> jenkins-operator-credentials-& lt;cr-name< span style=" color:#8f5902;font-style:italic" > & gt;
< /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > namespace: & lt;namespace& gt;< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> data< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> user< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;base64-encoded-new-username< span style=" color:#8f5902;font-style:italic" > & gt;
< /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > < /span> < span style=" color:#8f5902;font-style:italic" > password: & lt;base64-encoded-new-password& gt;< /span> < /code> < /pre> < /div>
< p> If needed < strong> Jenkins Operator< /strong> will restart the Jenkins master pod and then you can login with the new username and password
credentials.< /p>
< h2 id=" override-default-jenkins-container-command" > Override default Jenkins container command< /h2>
< p> The default command for the Jenkins master container < code> jenkins/jenkins:lts< /code> looks like:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > command< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> bash< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -c< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /var/jenkins/scripts/init.sh< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/bin/tini< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -s< span style=" color:#f8f8f8;text-decoration:underline" > < /span> --< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/local/bin/jenkins.sh< /code> < /pre> < /div>
< p> The script< code> /var/jenkins/scripts/init.sh< /code> is provided by the operator and configures init.groovy.d (creates the Jenkins user)
and installs plugins.
The < code> /usr/bin/tini -s -- /usr/local/bin/jenkins.sh< /code> command runs the Jenkins master main process.< /p>
< p> You can overwrite it in the following pattern:< /p>
< div class=" highlight" > < pre style=" background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4" > < code class=" language-yaml" data-lang=" yaml" > command< span style=" color:#000;font-weight:bold" > :< /span> < span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> bash< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -c< span style=" color:#f8f8f8;text-decoration:underline" >
< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> -< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /var/jenkins/scripts/init.sh< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> & lt;custom-code-here& gt;< span style=" color:#f8f8f8;text-decoration:underline" > < /span> < span style=" color:#8f5902;font-style:italic" > & amp;& amp;< /span> < span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/bin/tini< span style=" color:#f8f8f8;text-decoration:underline" > < /span> -s< span style=" color:#f8f8f8;text-decoration:underline" > < /span> --< span style=" color:#f8f8f8;text-decoration:underline" > < /span> /usr/local/bin/jenkins.sh< /code> < /pre> < /div>
</description>
</item>
<item >
<title > Docs: Configuration</title>
<link > https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/configuration/</link>