diff --git a/api/v1alpha2/jenkins_types.go b/api/v1alpha2/jenkins_types.go index 817ac77af..7ffed5a86 100644 --- a/api/v1alpha2/jenkins_types.go +++ b/api/v1alpha2/jenkins_types.go @@ -387,16 +387,12 @@ type JenkinsMaster struct { // +optional HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"` - // Optional duration in seconds the pod needs to terminate gracefully. May be decreased in delete request. - // Value must be non-negative integer. The value zero indicates stop immediately via - // the kill signal (no opportunity to shut down). - // If this value is nil, the default grace period will be used instead. // The grace period is the duration in seconds after the processes running in the pod are sent // a termination signal and the time when the processes are forcibly halted with a kill signal. // Set this value longer than the expected cleanup time for your process. // Defaults to 30 seconds. // +optional - TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty" protobuf:"varint,4,opt,name=terminationGracePeriodSeconds"` + TerminationGracePeriodSeconds *int64 `json:"terminationGracePeriodSeconds,omitempty"` } // Service defines Kubernetes service attributes diff --git a/chart/jenkins-operator/README.md b/chart/jenkins-operator/README.md index ccaaae9c4..779a9826a 100644 --- a/chart/jenkins-operator/README.md +++ b/chart/jenkins-operator/README.md @@ -90,6 +90,7 @@ Kubernetes native operator which fully manages Jenkins on Kubernetes | jenkins.seedJobAgentImage | string | `""` | | | jenkins.seedJobs | list | `[]` | | | jenkins.serviceAccount.annotations | object | `{}` | | +| jenkins.terminationGracePeriodSecond | int | `30` | | | jenkins.tolerations | list | `[]` | | | jenkins.validateSecurityWarnings | bool | `false` | | | jenkins.volumeMounts | list | `[]` | | diff --git a/chart/jenkins-operator/templates/jenkins.yaml b/chart/jenkins-operator/templates/jenkins.yaml index 0a918a3d9..78e61dc0b 100644 --- a/chart/jenkins-operator/templates/jenkins.yaml +++ b/chart/jenkins-operator/templates/jenkins.yaml @@ -115,6 +115,9 @@ spec: {{- with .Values.jenkins.hostAliases }} hostAliases: {{ toYaml . | nindent 4 }} {{- end }} + {{- if .Values.jenkins.terminationGracePeriodSecond }} + terminationGracePeriodSecond: {{ .Values.jenkins.terminationGracePeriodSecond }} + {{- end }} containers: - name: jenkins-master image: {{ .Values.jenkins.image }} @@ -137,7 +140,7 @@ spec: {{- if .Values.jenkins.backup.enabled }} - name: {{ .Values.jenkins.backup.containerName }} image: {{ .Values.jenkins.backup.image }} - imagePullPolicy: {{ .Values.jenkins.imagePullPolicy }} + imagePullPolicy: {{ .Values.jenkins.imagePullPolicy }} {{- with .Values.jenkins.backup.resources }} resources: {{ toYaml . | nindent 10 }} {{- end }} diff --git a/chart/jenkins-operator/values.yaml b/chart/jenkins-operator/values.yaml index ed1e401d8..e01ba1fcc 100644 --- a/chart/jenkins-operator/values.yaml +++ b/chart/jenkins-operator/values.yaml @@ -65,6 +65,10 @@ jenkins: # - "foo.remote" # - "bar.remote" + # Optional duration in seconds the pod needs to terminate gracefully. + # Default 30sec + terminationGracePeriodSecond: 30 + # validateSecurityWarnings enables or disables validating potential security warnings in Jenkins plugins via admission webhooks. validateSecurityWarnings: false diff --git a/config/crd/bases/jenkins.io_jenkins.yaml b/config/crd/bases/jenkins.io_jenkins.yaml index 87d407049..0e3a40e5d 100644 --- a/config/crd/bases/jenkins.io_jenkins.yaml +++ b/config/crd/bases/jenkins.io_jenkins.yaml @@ -1330,6 +1330,14 @@ spec: type: string type: object type: object + terminationGracePeriodSeconds: + description: The grace period is the duration in seconds after + the processes running in the pod are sent a termination signal + and the time when the processes are forcibly halted with a kill + signal. Set this value longer than the expected cleanup time + for your process. Defaults to 30 seconds. + format: int64 + type: integer tolerations: description: If specified, the pod's tolerations. items: