Auto-updated docs (#789)
Co-authored-by: prryb <prryb@users.noreply.github.com>
This commit is contained in:
parent
60b8ee56de
commit
7a72939de8
|
|
@ -26,7 +26,7 @@
|
||||||
" />
|
" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/" />
|
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/" />
|
||||||
<meta property="og:updated_time" content="2021-10-20T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
<meta property="og:updated_time" content="2023-01-12T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
||||||
<meta itemprop="name" content="Developer Guide">
|
<meta itemprop="name" content="Developer Guide">
|
||||||
<meta itemprop="description" content="Jenkins Operator for developers
|
<meta itemprop="description" content="Jenkins Operator for developers
|
||||||
"><meta name="twitter:card" content="summary"/>
|
"><meta name="twitter:card" content="summary"/>
|
||||||
|
|
@ -1365,7 +1365,7 @@ make deploy-webhook</code></pre></div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="text-muted mt-5 pt-3 border-top">Last modified October 20, 2021
|
<div class="text-muted mt-5 pt-3 border-top">Last modified January 12, 2023
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1408,4 +1408,4 @@ make deploy-webhook</code></pre></div>
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<link>https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/</link>
|
<link>https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/</link>
|
||||||
<description>Recent Hugo news from gohugo.io</description>
|
<description>Recent Hugo news from gohugo.io</description>
|
||||||
<generator>Hugo -- gohugo.io</generator>
|
<generator>Hugo -- gohugo.io</generator>
|
||||||
<lastBuildDate>Wed, 20 Oct 2021 00:00:00 +0000</lastBuildDate>
|
<lastBuildDate>Thu, 12 Jan 2023 00:00:00 +0000</lastBuildDate>
|
||||||
<image>
|
<image>
|
||||||
<url>https://jenkinsci.github.io/kubernetes-operator/img/hugo.png</url>
|
<url>https://jenkinsci.github.io/kubernetes-operator/img/hugo.png</url>
|
||||||
<title>GoHugo.io</title>
|
<title>GoHugo.io</title>
|
||||||
|
|
|
||||||
|
|
@ -968,6 +968,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -995,8 +997,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.4.x/">v0.4.x</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.4.x/">v0.4.x</a>
|
||||||
|
|
|
||||||
|
|
@ -962,6 +962,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -989,8 +991,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/">Customizing Jenkins</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/customizing-jenkins/">Customizing Jenkins</a>
|
||||||
|
|
@ -1033,6 +1033,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/">Configuring backup and restore</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/">Configuring backup and restore</a>
|
||||||
|
|
@ -1047,8 +1049,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/separate-namespaces/">Separate namespaces for Jenkins and Operator</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/separate-namespaces/">Separate namespaces for Jenkins and Operator</a>
|
||||||
|
|
|
||||||
|
|
@ -25,13 +25,13 @@
|
||||||
" />
|
" />
|
||||||
<meta property="og:type" content="article" />
|
<meta property="og:type" content="article" />
|
||||||
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/" />
|
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/" />
|
||||||
<meta property="article:published_time" content="2019-08-05T00:00:00+00:00" />
|
<meta property="article:published_time" content="2023-01-12T00:00:00+00:00" />
|
||||||
<meta property="article:modified_time" content="2019-08-05T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
<meta property="article:modified_time" content="2023-01-12T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
||||||
<meta itemprop="name" content="Configuration">
|
<meta itemprop="name" content="Configuration">
|
||||||
<meta itemprop="description" content="How to configure Jenkins with Operator
|
<meta itemprop="description" content="How to configure Jenkins with Operator
|
||||||
">
|
">
|
||||||
<meta itemprop="datePublished" content="2019-08-05T00:00:00+00:00" />
|
<meta itemprop="datePublished" content="2023-01-12T00:00:00+00:00" />
|
||||||
<meta itemprop="dateModified" content="2019-08-05T00:00:00+00:00" />
|
<meta itemprop="dateModified" content="2023-01-12T00:00:00+00:00" />
|
||||||
<meta itemprop="wordCount" content="675">
|
<meta itemprop="wordCount" content="675">
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1176,7 +1176,7 @@ The <code>/usr/bin/tini -s -- /usr/local/bin/jenkins.sh</code> command runs the
|
||||||
</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">&&</span><span style="color:#f8f8f8;text-decoration:underline"> </span><custom-code-here><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">&&</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>
|
</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">&&</span><span style="color:#f8f8f8;text-decoration:underline"> </span><custom-code-here><span style="color:#f8f8f8;text-decoration:underline"> </span><span style="color:#8f5902;font-style:italic">&&</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>
|
||||||
|
|
||||||
|
|
||||||
<div class="text-muted mt-5 pt-3 border-top">Last modified August 5, 2019
|
<div class="text-muted mt-5 pt-3 border-top">Last modified January 12, 2023
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -1220,4 +1220,4 @@ The <code>/usr/bin/tini -s -- /usr/local/bin/jenkins.sh</code> command runs the
|
||||||
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -964,20 +964,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/">Configuration</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/">Configuration</a>
|
||||||
|
|
@ -997,6 +983,20 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ kubectl get secret jenkins-operator-credentials-&lt;cr_name&gt; -o <s
|
||||||
<item>
|
<item>
|
||||||
<title>Docs: Configuration</title>
|
<title>Docs: Configuration</title>
|
||||||
<link>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</link>
|
<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>
|
<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>
|
<guid>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</guid>
|
||||||
<description>
|
<description>
|
||||||
|
|
@ -2319,4 +2319,4 @@ or use the default deployment manifest:</p>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
@ -975,6 +975,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
|
|
@ -1000,8 +1002,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.3.x/customization/">Customization</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.3.x/customization/">Customization</a>
|
||||||
|
|
|
||||||
|
|
@ -973,6 +973,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
|
|
@ -998,8 +1000,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.4.x/customization/">Customization</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.4.x/customization/">Customization</a>
|
||||||
|
|
|
||||||
|
|
@ -968,6 +968,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.5.x/configuration/">Configuration</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.5.x/configuration/">Configuration</a>
|
||||||
|
|
@ -993,8 +995,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
|
|
|
||||||
|
|
@ -964,6 +964,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -991,8 +993,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/customizing-jenkins/">Customizing Jenkins</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/customizing-jenkins/">Customizing Jenkins</a>
|
||||||
|
|
@ -1035,6 +1035,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/configuring-backup-and-restore/">Configuring backup and restore</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/configuring-backup-and-restore/">Configuring backup and restore</a>
|
||||||
|
|
@ -1049,8 +1051,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/separate-namespaces/">Separate namespaces for Jenkins and Operator</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.6.x/separate-namespaces/">Separate namespaces for Jenkins and Operator</a>
|
||||||
|
|
|
||||||
|
|
@ -936,6 +936,8 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
|
|
@ -959,8 +961,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/security/">Security</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/security/">Security</a>
|
||||||
|
|
@ -999,10 +999,6 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/">Developer Guide</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/">Developer Guide</a>
|
||||||
|
|
@ -1019,6 +1015,10 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
<h5>
|
<h5>
|
||||||
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/faq/">FAQ</a>
|
<a href="https://jenkinsci.github.io/kubernetes-operator/docs/faq/">FAQ</a>
|
||||||
|
|
|
||||||
|
|
@ -2293,6 +2293,243 @@ kubectl get secret jenkins-operator-credentials-&lt;cr_name&gt; -o <s
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<title>Docs: Deploying Jenkins</title>
|
<title>Docs: Deploying Jenkins</title>
|
||||||
<link>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/</link>
|
<link>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/</link>
|
||||||
|
|
@ -3338,243 +3575,6 @@ stringData:
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</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>
|
<item>
|
||||||
<title>Docs: Configuration</title>
|
<title>Docs: Configuration</title>
|
||||||
<link>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/configuration/</link>
|
<link>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/configuration/</link>
|
||||||
|
|
@ -8817,4 +8817,4 @@ the restart of a Jenkins pod over and over again.</p>
|
||||||
</item>
|
</item>
|
||||||
|
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
<meta property="og:description" content="A native operator for Kubernetes to manage Jenkins" />
|
<meta property="og:description" content="A native operator for Kubernetes to manage Jenkins" />
|
||||||
<meta property="og:type" content="website" />
|
<meta property="og:type" content="website" />
|
||||||
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/" />
|
<meta property="og:url" content="https://jenkinsci.github.io/kubernetes-operator/" />
|
||||||
<meta property="og:updated_time" content="2023-01-08T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
<meta property="og:updated_time" content="2023-01-12T00:00:00+00:00" /><meta property="og:site_name" content="Jenkins Operator" />
|
||||||
<meta itemprop="name" content="Jenkins Kubernetes Operator">
|
<meta itemprop="name" content="Jenkins Kubernetes Operator">
|
||||||
<meta itemprop="description" content="A native operator for Kubernetes to manage Jenkins"><meta name="twitter:card" content="summary"/>
|
<meta itemprop="description" content="A native operator for Kubernetes to manage Jenkins"><meta name="twitter:card" content="summary"/>
|
||||||
<meta name="twitter:title" content="Jenkins Kubernetes Operator"/>
|
<meta name="twitter:title" content="Jenkins Kubernetes Operator"/>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
<link>https://jenkinsci.github.io/kubernetes-operator/</link>
|
<link>https://jenkinsci.github.io/kubernetes-operator/</link>
|
||||||
<description>Recent Hugo news from gohugo.io</description>
|
<description>Recent Hugo news from gohugo.io</description>
|
||||||
<generator>Hugo -- gohugo.io</generator>
|
<generator>Hugo -- gohugo.io</generator>
|
||||||
<lastBuildDate>Sun, 08 Jan 2023 00:00:00 +0000</lastBuildDate>
|
<lastBuildDate>Thu, 12 Jan 2023 00:00:00 +0000</lastBuildDate>
|
||||||
<image>
|
<image>
|
||||||
<url>https://jenkinsci.github.io/kubernetes-operator/img/hugo.png</url>
|
<url>https://jenkinsci.github.io/kubernetes-operator/img/hugo.png</url>
|
||||||
<title>GoHugo.io</title>
|
<title>GoHugo.io</title>
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,11 @@
|
||||||
<lastmod>2019-08-05T00:00:00+00:00</lastmod>
|
<lastmod>2019-08-05T00:00:00+00:00</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</loc>
|
||||||
|
<lastmod>2023-01-12T00:00:00+00:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/</loc>
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/deploying-jenkins/</loc>
|
||||||
<lastmod>2021-12-08T00:00:00+00:00</lastmod>
|
<lastmod>2021-12-08T00:00:00+00:00</lastmod>
|
||||||
|
|
@ -92,11 +97,6 @@
|
||||||
<lastmod>2019-12-20T00:00:00+00:00</lastmod>
|
<lastmod>2019-12-20T00:00:00+00:00</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.1.x/configuration/</loc>
|
|
||||||
<lastmod>2019-08-05T00:00:00+00:00</lastmod>
|
|
||||||
</url>
|
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/configuration/</loc>
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/configuration/</loc>
|
||||||
<lastmod>2019-08-05T00:00:00+00:00</lastmod>
|
<lastmod>2019-08-05T00:00:00+00:00</lastmod>
|
||||||
|
|
@ -167,6 +167,11 @@
|
||||||
<lastmod>2021-08-19T00:00:00+00:00</lastmod>
|
<lastmod>2021-08-19T00:00:00+00:00</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
|
<url>
|
||||||
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/</loc>
|
||||||
|
<lastmod>2023-01-12T00:00:00+00:00</lastmod>
|
||||||
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/</loc>
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuring-backup-and-restore/</loc>
|
||||||
<lastmod>2023-01-08T00:00:00+00:00</lastmod>
|
<lastmod>2023-01-08T00:00:00+00:00</lastmod>
|
||||||
|
|
@ -177,11 +182,6 @@
|
||||||
<lastmod>2021-12-08T00:00:00+00:00</lastmod>
|
<lastmod>2021-12-08T00:00:00+00:00</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/developer-guide/</loc>
|
|
||||||
<lastmod>2021-10-20T00:00:00+00:00</lastmod>
|
|
||||||
</url>
|
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/</loc>
|
<loc>https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/v0.2.x/</loc>
|
||||||
<lastmod>2021-08-19T00:00:00+00:00</lastmod>
|
<lastmod>2021-08-19T00:00:00+00:00</lastmod>
|
||||||
|
|
@ -439,7 +439,7 @@
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>https://jenkinsci.github.io/kubernetes-operator/</loc>
|
<loc>https://jenkinsci.github.io/kubernetes-operator/</loc>
|
||||||
<lastmod>2023-01-08T00:00:00+00:00</lastmod>
|
<lastmod>2023-01-12T00:00:00+00:00</lastmod>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
title: "Developer Guide"
|
title: "Developer Guide"
|
||||||
linkTitle: "Developer Guide"
|
linkTitle: "Developer Guide"
|
||||||
weight: 5
|
weight: 5
|
||||||
date: 2021-10-20
|
date: 2023-01-12
|
||||||
description: >
|
description: >
|
||||||
Jenkins Operator for developers
|
Jenkins Operator for developers
|
||||||
---
|
---
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
title: "Configuration"
|
title: "Configuration"
|
||||||
linkTitle: "Configuration"
|
linkTitle: "Configuration"
|
||||||
weight: 2
|
weight: 2
|
||||||
date: 2019-08-05
|
date: 2023-01-12
|
||||||
description: >
|
description: >
|
||||||
How to configure Jenkins with Operator
|
How to configure Jenkins with Operator
|
||||||
---
|
---
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue