New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make termination grace seconds configurable #4681
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,13 +325,6 @@ func makeStatefulSetService(p *monitoringv1.Prometheus, config operator.Config) | |
|
||
func makeStatefulSetSpec(p monitoringv1.Prometheus, c *operator.Config, shard int32, ruleConfigMapNames []string, | ||
tlsAssetSecrets []string, version semver.Version) (*appsv1.StatefulSetSpec, error) { | ||
// Prometheus may take quite long to shut down to checkpoint existing data. | ||
// Allow up to 10 minutes for clean termination if not specified. | ||
if p.Spec.TerminationGracePeriodSeconds == nil { | ||
terminationGracePeriod := int64(600) | ||
p.Spec.TerminationGracePeriodSeconds = &terminationGracePeriod | ||
} | ||
|
||
prometheusImagePath, err := operator.BuildImagePath( | ||
operator.StringPtrValOrDefault(p.Spec.Image, ""), | ||
operator.StringValOrDefault(p.Spec.BaseImage, c.PrometheusDefaultBaseImage), | ||
|
@@ -907,10 +900,16 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *operator.Config, shard in | |
} | ||
} | ||
|
||
var minReadySeconds int32 | ||
var ( | ||
minReadySeconds int32 | ||
terminationGracePeriod int64 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No it is casted from uint64. The pod spec needs int64 not uint64. |
||
) | ||
if p.Spec.MinReadySeconds != nil { | ||
minReadySeconds = int32(*p.Spec.MinReadySeconds) | ||
} | ||
if p.Spec.TerminationGracePeriodSeconds != nil { | ||
terminationGracePeriod = int64(*p.Spec.TerminationGracePeriodSeconds) | ||
} | ||
|
||
operatorInitContainers = append(operatorInitContainers, | ||
operator.CreateConfigReloader( | ||
|
@@ -1004,7 +1003,7 @@ func makeStatefulSetSpec(p monitoringv1.Prometheus, c *operator.Config, shard in | |
AutomountServiceAccountToken: &boolTrue, | ||
NodeSelector: p.Spec.NodeSelector, | ||
PriorityClassName: p.Spec.PriorityClassName, | ||
TerminationGracePeriodSeconds: p.Spec.TerminationGracePeriodSeconds, | ||
TerminationGracePeriodSeconds: &terminationGracePeriod, | ||
Volumes: volumes, | ||
Tolerations: p.Spec.Tolerations, | ||
Affinity: p.Spec.Affinity, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since its int type we don't need quotes
// +kubebuilder:default:=600
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Updated