#239 Allow to set tolerations for the Jenkins master pod

This commit is contained in:
Tomasz Sęk 2019-12-31 09:13:09 +01:00
parent e1e21f92d6
commit 28a7c11f8c
No known key found for this signature in database
GPG Key ID: DC356D23F6A644D0
3 changed files with 12 additions and 2 deletions

View File

@ -295,6 +295,10 @@ type JenkinsMaster struct {
// +optional
Volumes []corev1.Volume `json:"volumes,omitempty"`
// If specified, the pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// BasePlugins contains plugins required by operator
// Defaults to :
// - name: kubernetes

View File

@ -317,6 +317,13 @@ func (in *JenkinsMaster) DeepCopyInto(out *JenkinsMaster) {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.Tolerations != nil {
in, out := &in.Tolerations, &out.Tolerations
*out = make([]v1.Toleration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.BasePlugins != nil {
in, out := &in.BasePlugins, &out.BasePlugins
*out = make([]Plugin, len(*in))

View File

@ -38,8 +38,6 @@ const (
httpPortName = "http"
slavePortName = "slavelistener"
// HTTPPortInt defines Jenkins master HTTP port
HTTPPortInt = 8080
)
func buildPodTypeMeta() metav1.TypeMeta {
@ -309,6 +307,7 @@ func NewJenkinsMasterPod(objectMeta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins
Volumes: append(GetJenkinsMasterPodBaseVolumes(jenkins), jenkins.Spec.Master.Volumes...),
SecurityContext: jenkins.Spec.Master.SecurityContext,
ImagePullSecrets: jenkins.Spec.Master.ImagePullSecrets,
Tolerations: jenkins.Spec.Master.Tolerations,
},
}
}