Skip to content

Commit a04e330

Browse files
srirooparclaude
andcommitted
Remove OLS-3192 changes from branch — keep only OLS-3221 liveness probe threshold
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent d971945 commit a04e330

5 files changed

Lines changed: 4 additions & 98 deletions

File tree

internal/controller/postgres/assets_test.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,18 +87,6 @@ var _ = Describe("App postgres server assets", func() {
8787
Expect(dep.Spec.Selector.MatchLabels).To(Equal(utils.GeneratePostgresSelectorLabels()))
8888
Expect(dep.Spec.RevisionHistoryLimit).To(Equal(&revisionHistoryLimit))
8989
Expect(dep.Spec.Replicas).To(Equal(&replicas))
90-
// Verify preStop lifecycle hook for clean postgres shutdown
91-
Expect(dep.Spec.Template.Spec.Containers[0].Lifecycle).NotTo(BeNil())
92-
Expect(dep.Spec.Template.Spec.Containers[0].Lifecycle.PreStop).NotTo(BeNil())
93-
Expect(dep.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec).NotTo(BeNil())
94-
Expect(dep.Spec.Template.Spec.Containers[0].Lifecycle.PreStop.Exec.Command).To(Equal([]string{
95-
"/bin/sh", "-c",
96-
"pg_ctl stop -D /var/lib/pgsql/data/userdata -m fast -w -t 55",
97-
}))
98-
// Verify terminationGracePeriodSeconds gives postgres time to shut down
99-
Expect(dep.Spec.Template.Spec.TerminationGracePeriodSeconds).NotTo(BeNil())
100-
Expect(*dep.Spec.Template.Spec.TerminationGracePeriodSeconds).To(Equal(int64(60)))
101-
10290
Expect(dep.Spec.Template.Spec.Containers[0].VolumeMounts).To(Equal([]corev1.VolumeMount{
10391
{
10492
Name: "secret-" + utils.PostgresCertsSecretName,

internal/controller/postgres/deployment.go

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -234,21 +234,10 @@ func GeneratePostgresDeployment(r reconciler.Reconciler, ctx context.Context, cr
234234
Value: strconv.Itoa(cr.Spec.OLSConfig.ConversationCache.Postgres.MaxConnections),
235235
},
236236
},
237-
Lifecycle: &corev1.Lifecycle{
238-
PreStop: &corev1.LifecycleHandler{
239-
Exec: &corev1.ExecAction{
240-
Command: []string{
241-
"/bin/sh", "-c",
242-
"pg_ctl stop -D /var/lib/pgsql/data/userdata -m fast -w -t 55",
243-
},
244-
},
245-
},
246-
},
247237
},
248238
},
249-
Volumes: volumes,
250-
ServiceAccountName: utils.PostgreServiceAccountName,
251-
TerminationGracePeriodSeconds: &[]int64{60}[0],
239+
Volumes: volumes,
240+
ServiceAccountName: utils.PostgreServiceAccountName,
252241
},
253242
},
254243
RevisionHistoryLimit: &revisionHistoryLimit,

internal/controller/utils/utils.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,7 @@ func DeploymentSpecEqual(a, b *appsv1.DeploymentSpec, compareInitContainers bool
199199
!apiequality.Semantic.DeepEqual(a.Strategy, b.Strategy) || // check strategy
200200
!PodVolumeEqual(a.Template.Spec.Volumes, b.Template.Spec.Volumes) || // check volumes
201201
*a.Replicas != *b.Replicas || // check replicas
202-
a.Template.Spec.ServiceAccountName != b.Template.Spec.ServiceAccountName || // check service account name
203-
!apiequality.Semantic.DeepEqual(a.Template.Spec.TerminationGracePeriodSeconds, b.Template.Spec.TerminationGracePeriodSeconds) { // check termination grace period
202+
a.Template.Spec.ServiceAccountName != b.Template.Spec.ServiceAccountName { // check service account name
204203
return false
205204
}
206205

@@ -245,8 +244,7 @@ func ContainerSpecEqual(a, b *corev1.Container) bool {
245244
a.ImagePullPolicy == b.ImagePullPolicy && // check image pull policy
246245
ProbeEqual(a.LivenessProbe, b.LivenessProbe) && // check liveness probe
247246
ProbeEqual(a.ReadinessProbe, b.ReadinessProbe) && // check readiness probe
248-
ProbeEqual(a.StartupProbe, b.StartupProbe) && // check startup probe
249-
apiequality.Semantic.DeepEqual(a.Lifecycle, b.Lifecycle)) // check lifecycle hooks
247+
ProbeEqual(a.StartupProbe, b.StartupProbe)) // check startup probe
250248
}
251249

252250
// EnvEqual compares two EnvVar slices ignoring order

internal/controller/utils/utils_comparison_test.go

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -127,46 +127,6 @@ var _ = Describe("Container Comparison", func() {
127127
It("should handle empty container lists", func() {
128128
Expect(ContainersEqual([]corev1.Container{}, []corev1.Container{})).To(BeTrue())
129129
})
130-
131-
It("should return false when lifecycle hooks differ", func() {
132-
containers1 := []corev1.Container{
133-
{
134-
Name: "app",
135-
Image: "myapp:v1",
136-
Lifecycle: &corev1.Lifecycle{
137-
PreStop: &corev1.LifecycleHandler{
138-
Exec: &corev1.ExecAction{
139-
Command: []string{"/bin/sh", "-c", "pg_ctl stop"},
140-
},
141-
},
142-
},
143-
},
144-
}
145-
containers2 := []corev1.Container{
146-
{
147-
Name: "app",
148-
Image: "myapp:v1",
149-
},
150-
}
151-
Expect(ContainersEqual(containers1, containers2)).To(BeFalse())
152-
})
153-
154-
It("should return true when lifecycle hooks are equal", func() {
155-
lifecycle := &corev1.Lifecycle{
156-
PreStop: &corev1.LifecycleHandler{
157-
Exec: &corev1.ExecAction{
158-
Command: []string{"/bin/sh", "-c", "pg_ctl stop"},
159-
},
160-
},
161-
}
162-
containers1 := []corev1.Container{
163-
{Name: "app", Image: "myapp:v1", Lifecycle: lifecycle},
164-
}
165-
containers2 := []corev1.Container{
166-
{Name: "app", Image: "myapp:v1", Lifecycle: lifecycle.DeepCopy()},
167-
}
168-
Expect(ContainersEqual(containers1, containers2)).To(BeTrue())
169-
})
170130
})
171131
})
172132

@@ -310,21 +270,6 @@ var _ = Describe("Resource Comparison Functions", func() {
310270

311271
Expect(DeploymentSpecEqual(deployment1, deployment2, true)).To(BeFalse())
312272
})
313-
314-
It("should return false when terminationGracePeriodSeconds differs", func() {
315-
gracePeriod := int64(60)
316-
deployment2.Template.Spec.TerminationGracePeriodSeconds = &gracePeriod
317-
318-
Expect(DeploymentSpecEqual(deployment1, deployment2, true)).To(BeFalse())
319-
})
320-
321-
It("should return true when terminationGracePeriodSeconds is equal", func() {
322-
gracePeriod := int64(60)
323-
deployment1.Template.Spec.TerminationGracePeriodSeconds = &gracePeriod
324-
deployment2.Template.Spec.TerminationGracePeriodSeconds = &gracePeriod
325-
326-
Expect(DeploymentSpecEqual(deployment1, deployment2, true)).To(BeTrue())
327-
})
328273
})
329274

330275
Describe("ServiceEqual", func() {

test/e2e/all_features_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -720,20 +720,6 @@ var _ = Describe("All Features Enabled", Ordered, Label("AllFeatures"), func() {
720720
}
721721
Expect(foundSharedBuffers).To(BeTrue(), "POSTGRESQL_SHARED_BUFFERS should be set to 512MB")
722722
Expect(foundMaxConnections).To(BeTrue(), "POSTGRESQL_MAX_CONNECTIONS should be set to 3000")
723-
724-
By("Verifying postgres deployment has preStop lifecycle hook")
725-
postgresContainer := postgresDeployment.Spec.Template.Spec.Containers[0]
726-
Expect(postgresContainer.Lifecycle).NotTo(BeNil(), "postgres container should have a lifecycle configuration")
727-
Expect(postgresContainer.Lifecycle.PreStop).NotTo(BeNil(), "postgres container should have a preStop hook")
728-
Expect(postgresContainer.Lifecycle.PreStop.Exec).NotTo(BeNil(), "preStop hook should use exec")
729-
Expect(postgresContainer.Lifecycle.PreStop.Exec.Command).To(ContainElement(ContainSubstring("pg_ctl stop")),
730-
"preStop hook should run pg_ctl stop for clean shutdown")
731-
732-
By("Verifying postgres deployment has terminationGracePeriodSeconds")
733-
Expect(postgresDeployment.Spec.Template.Spec.TerminationGracePeriodSeconds).NotTo(BeNil(),
734-
"postgres pod should have terminationGracePeriodSeconds set")
735-
Expect(*postgresDeployment.Spec.Template.Spec.TerminationGracePeriodSeconds).To(Equal(int64(60)),
736-
"postgres pod should have 60s termination grace period")
737723
})
738724

739725
// Test 10: Resource Limits Validation

0 commit comments

Comments
 (0)