Skip to content

Commit

Permalink
add terminationGracePeriodSeconds param to jenkins pod, crd
Browse files Browse the repository at this point in the history
  • Loading branch information
DionJones615 committed May 8, 2024
1 parent 25b329a commit 4a9b833
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
2 changes: 2 additions & 0 deletions api/v1alpha2/jenkins_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,8 @@ type JenkinsMaster struct {
// HostAliases for Jenkins master pod and SeedJob agent
// +optional
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`

TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"`
}

// Service defines Kubernetes service attributes
Expand Down
4 changes: 4 additions & 0 deletions chart/jenkins-operator/crds/jenkins-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1330,6 +1330,10 @@ spec:
type: string
type: object
type: object
terminationGracePeriodSeconds:
description: 'Optional duration in seconds the pod needs to terminate gracefully.'
type: integer
default: 30
tolerations:
description: If specified, the pod's tolerations.
items:
Expand Down
21 changes: 11 additions & 10 deletions pkg/configuration/base/resources/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,17 @@ func NewJenkinsMasterPod(objectMeta metav1.ObjectMeta, jenkins *v1alpha2.Jenkins
TypeMeta: buildPodTypeMeta(),
ObjectMeta: objectMeta,
Spec: corev1.PodSpec{
ServiceAccountName: serviceAccountName,
RestartPolicy: corev1.RestartPolicyNever,
NodeSelector: jenkins.Spec.Master.NodeSelector,
Containers: newContainers(jenkins),
Volumes: append(GetJenkinsMasterPodBaseVolumes(jenkins), jenkins.Spec.Master.Volumes...),
SecurityContext: jenkins.Spec.Master.SecurityContext,
ImagePullSecrets: jenkins.Spec.Master.ImagePullSecrets,
Tolerations: jenkins.Spec.Master.Tolerations,
PriorityClassName: jenkins.Spec.Master.PriorityClassName,
HostAliases: jenkins.Spec.Master.HostAliases,
ServiceAccountName: serviceAccountName,
RestartPolicy: corev1.RestartPolicyNever,
NodeSelector: jenkins.Spec.Master.NodeSelector,
Containers: newContainers(jenkins),
Volumes: append(GetJenkinsMasterPodBaseVolumes(jenkins), jenkins.Spec.Master.Volumes...),
SecurityContext: jenkins.Spec.Master.SecurityContext,
ImagePullSecrets: jenkins.Spec.Master.ImagePullSecrets,
Tolerations: jenkins.Spec.Master.Tolerations,
PriorityClassName: jenkins.Spec.Master.PriorityClassName,
HostAliases: jenkins.Spec.Master.HostAliases,
TerminationGracePeriodSeconds: jenkins.Spec.Master.TerminationGracePeriodSeconds,
},
}
}

0 comments on commit 4a9b833

Please sign in to comment.