Skip to content
Draft
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions api/v4/common_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ type Spec struct {

// TopologySpreadConstraint https://kubernetes.io/docs/concepts/scheduling-eviction/topology-spread-constraints/
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`

TerminationGracePeriodSeconds int64 `json:"terminationGracePeriodSeconds"`
}

// Phase is used to represent the current phase of a custom resource
Expand Down
74 changes: 69 additions & 5 deletions config/crd/bases/enterprise.splunk.com_clustermanagers.yaml

Large diffs are not rendered by default.

74 changes: 69 additions & 5 deletions config/crd/bases/enterprise.splunk.com_clustermasters.yaml

Large diffs are not rendered by default.

146 changes: 137 additions & 9 deletions config/crd/bases/enterprise.splunk.com_indexerclusters.yaml

Large diffs are not rendered by default.

74 changes: 69 additions & 5 deletions config/crd/bases/enterprise.splunk.com_licensemanagers.yaml

Large diffs are not rendered by default.

74 changes: 69 additions & 5 deletions config/crd/bases/enterprise.splunk.com_licensemasters.yaml

Large diffs are not rendered by default.

146 changes: 137 additions & 9 deletions config/crd/bases/enterprise.splunk.com_monitoringconsoles.yaml

Large diffs are not rendered by default.

148 changes: 139 additions & 9 deletions config/crd/bases/enterprise.splunk.com_searchheadclusters.yaml

Large diffs are not rendered by default.

146 changes: 137 additions & 9 deletions config/crd/bases/enterprise.splunk.com_standalones.yaml

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions pkg/splunk/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ func MergePodSpecUpdates(ctx context.Context, current *corev1.PodSpec, revised *
}
}
}
if current.TerminationGracePeriodSeconds != revised.TerminationGracePeriodSeconds {
scopedLog.Info("Pod TerminationGracePeriodSeconds differs",
"current", current.TerminationGracePeriodSeconds,
"revised", revised.TerminationGracePeriodSeconds)
current.TerminationGracePeriodSeconds = revised.TerminationGracePeriodSeconds
result = true
}

// check for changes in container images; assume that the ordering is same for pods with > 1 container
if len(current.Containers) != len(revised.Containers) {
Expand Down Expand Up @@ -244,6 +251,13 @@ func MergePodSpecUpdates(ctx context.Context, current *corev1.PodSpec, revised *
current.Containers[idx].StartupProbe = revised.Containers[idx].StartupProbe
result = true
}
current.Containers[idx].Lifecycle = &corev1.Lifecycle{
PreStop: &corev1.LifecycleHandler{
Exec: &corev1.ExecAction{
Command: []string{"/bin/sh", "-c", "/opt/splunk/bin/splunk offline && /opt/splunk/bin/splunk stop"},
},
},
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions pkg/splunk/enterprise/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,15 @@ func updateSplunkPodTemplateWithConfig(ctx context.Context, client splcommon.Con
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
}
podTemplateSpec.Spec.Containers[idx].Lifecycle = &corev1.Lifecycle{
PreStop: &corev1.LifecycleHandler{
Exec: &corev1.ExecAction{
Command: []string{"/bin/sh", "-c", "/opt/splunk/bin/splunk offline && /opt/splunk/bin/splunk stop"},
},
},
}
}
podTemplateSpec.Spec.TerminationGracePeriodSeconds = &spec.TerminationGracePeriodSeconds
}

func removeDuplicateEnvVars(sliceList []corev1.EnvVar) []corev1.EnvVar {
Expand Down
Loading