Allow to specify seed agent image (#718)
* Allow to specify seed agent image * Fix formatting issue * Add optional for documentation * Add entry for helm chart * Add default value for helm chart Co-authored-by: bhubert <bhubert@expediagroup.com>
This commit is contained in:
parent
46f64fea6a
commit
56b65aed16
|
|
@ -18,6 +18,10 @@ type JenkinsSpec struct {
|
|||
// +optional
|
||||
SeedJobs []SeedJob `json:"seedJobs,omitempty"`
|
||||
|
||||
// SeedJobAgentImage defines the image that will be used by the seed job agent. If not defined jenkins/inbound-agent:4.9-1 will be used.
|
||||
// +optional
|
||||
SeedJobAgentImage string `json:"seedJobAgentImage,omitempty"`
|
||||
|
||||
// ValidateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks.
|
||||
//+optional
|
||||
ValidateSecurityWarnings bool `json:"validateSecurityWarnings,omitempty"`
|
||||
|
|
|
|||
|
|
@ -3118,6 +3118,9 @@ spec:
|
|||
- name
|
||||
type: object
|
||||
type: array
|
||||
seedJobAgentImage:
|
||||
type: string
|
||||
description: 'SeedJobAgentImage defines the image that will be used by the seed job agent. If not defined jenkins/inbound-agent:4.9-1 will be used.'
|
||||
seedJobs:
|
||||
description: 'SeedJobs defines list of Jenkins Seed Job configurations
|
||||
More info: https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/configuration#configure-seed-jobs-and-pipelines'
|
||||
|
|
|
|||
|
|
@ -111,6 +111,9 @@ jenkins:
|
|||
# repositoryUrl: https://github.com/jenkinsci/kubernetes-operator.git
|
||||
seedJobs: []
|
||||
|
||||
# SeedJobAgentImage defines the image that will be used by the seed job agent. If not defined jenkins/inbound-agent:4.9-1 will be used.
|
||||
seedJobAgentImage: ""
|
||||
|
||||
# Resource limit/request for Jenkins
|
||||
# See https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/ for details
|
||||
resources:
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ const (
|
|||
// AgentName is the name of seed job agent
|
||||
AgentName = "seed-job-agent"
|
||||
|
||||
// DefaultAgentImage is the default image used for the seed-job agent
|
||||
defaultAgentImage = "jenkins/inbound-agent:4.9-1"
|
||||
|
||||
creatingGroovyScriptName = "seed-job-groovy-script.groovy"
|
||||
|
||||
homeVolumeName = "home"
|
||||
|
|
@ -416,6 +419,11 @@ func agentDeployment(jenkins *v1alpha2.Jenkins, namespace string, agentName stri
|
|||
return nil, err
|
||||
}
|
||||
|
||||
agentImage := jenkins.Spec.SeedJobAgentImage
|
||||
if jenkins.Spec.SeedJobAgentImage == "" {
|
||||
agentImage = defaultAgentImage
|
||||
}
|
||||
|
||||
suffix := ""
|
||||
if prefix, ok := resources.GetJenkinsOpts(*jenkins)["prefix"]; ok {
|
||||
suffix = prefix
|
||||
|
|
@ -445,7 +453,7 @@ func agentDeployment(jenkins *v1alpha2.Jenkins, namespace string, agentName stri
|
|||
Containers: []corev1.Container{
|
||||
{
|
||||
Name: "jnlp",
|
||||
Image: "jenkins/inbound-agent:4.9-1",
|
||||
Image: agentImage,
|
||||
Env: []corev1.EnvVar{
|
||||
{
|
||||
Name: "JENKINS_TUNNEL",
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ func TestEnsureSeedJobs(t *testing.T) {
|
|||
var agentDeployment appsv1.Deployment
|
||||
err = fakeClient.Get(ctx, types.NamespacedName{Namespace: jenkins.Namespace, Name: agentDeploymentName(*jenkins, AgentName)}, &agentDeployment)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, "jenkins/inbound-agent:4.9-1", agentDeployment.Spec.Template.Spec.Containers[0].Image)
|
||||
})
|
||||
|
||||
t.Run("delete agent deployment when no seed jobs", func(t *testing.T) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue