Skip to content

Commit 6a5685f

Browse files
committed
Keep Services and RBAC stable across e2e specs
Signed-off-by: Revital Sur <eres@il.ibm.com>
1 parent f9d2288 commit 6a5685f

2 files changed

Lines changed: 28 additions & 28 deletions

File tree

test/coordinator/e2e/coordinator/e2e_suite_test.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,10 @@ var (
9797

9898
readyTimeout = env.GetEnvDuration("READY_TIMEOUT", defaultReadyTimeout, ginkgo.GinkgoLogr)
9999

100-
portForwardSessions []*gexec.Session
101-
rendererObjects []string
102-
stableServiceObjects []string
103-
createdNameSpace bool
100+
portForwardSessions []*gexec.Session
101+
rendererObjects []string
102+
stableInfraObjects []string
103+
createdNameSpace bool
104104
)
105105

106106
func TestCoordinatorE2E(t *testing.T) {
@@ -133,9 +133,10 @@ var _ = ginkgo.BeforeSuite(func() {
133133

134134
rendererObjects = createRenderer()
135135

136-
// Coordinator and EPP Services are created once and kept stable across specs
137-
// so Envoy's STRICT_DNS clusters never have to re-resolve a rotated ClusterIP.
138-
stableServiceObjects = createStableServices()
136+
// Coordinator and EPP Services, ServiceAccounts, and RoleBindings are created
137+
// once and kept stable across specs so Envoy's STRICT_DNS clusters never have
138+
// to re-resolve a rotated ClusterIP.
139+
stableInfraObjects = createStableInfra()
139140
})
140141

141142
var _ = ginkgo.ReportAfterSuite("cleanup", func(report ginkgo.Report) {
@@ -153,8 +154,8 @@ var _ = ginkgo.ReportAfterSuite("cleanup", func(report ginkgo.Report) {
153154
if len(rendererObjects) > 0 {
154155
testutils.DeleteObjects(testConfig, rendererObjects, nsName)
155156
}
156-
if len(stableServiceObjects) > 0 {
157-
testutils.DeleteObjects(testConfig, stableServiceObjects, nsName)
157+
if len(stableInfraObjects) > 0 {
158+
testutils.DeleteObjects(testConfig, stableInfraObjects, nsName)
158159
}
159160
for _, session := range portForwardSessions {
160161
session.Terminate()

test/coordinator/e2e/coordinator/setup_test.go

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func createEndPointPicker(phase, config string) []string {
9696

9797
objects := make([]string, 1, 8)
9898
objects[0] = "ConfigMap/" + cmName
99-
// The Service is created once by createStableServices; recreate only the
100-
// rest (ServiceAccount, RoleBinding, Deployment) per spec.
101-
objects = append(objects, applyManifest(manifest, eppSubstitutions(), "Service")...)
99+
// The Service, ServiceAccount, and RoleBinding are created once by
100+
// createStableInfra; recreate only the Deployment per spec.
101+
objects = append(objects, applyManifest(manifest, eppSubstitutions(), "Service", "ServiceAccount", "RoleBinding")...)
102102
podsInDeploymentsReady(objects)
103103
return objects
104104
}
@@ -179,9 +179,9 @@ func createCoordinator(config string) []string {
179179
objects[0] = "ConfigMap/llm-d-coordinator-config"
180180

181181
docs := e2eutil.RunKustomize(coordinatorComponentDir)
182-
// The Service is created once by createStableServices so its ClusterIP is
183-
// stable across specs; recreate only the Deployment (and SA) per spec.
184-
docs = e2eutil.FilterKinds(docs, "ConfigMap", "Service")
182+
// The Service and ServiceAccount are created once by createStableInfra so the
183+
// ClusterIP is stable across specs; recreate only the Deployment per spec.
184+
docs = e2eutil.FilterKinds(docs, "ConfigMap", "Service", "ServiceAccount")
185185
docs = e2eutil.SubstituteMany(docs, coordinatorSubstitutions())
186186
docs = e2eutil.RemoveEmptyArgs(docs)
187187
objects = append(objects, testutils.CreateObjsFromYaml(testConfig, docs, nsName)...)
@@ -194,7 +194,7 @@ func createCoordinator(config string) []string {
194194
// waitForCoordinatorReady polls /readyz through Envoy until it returns 200,
195195
// confirming the freshly recreated coordinator pod is reachable through the
196196
// gateway before the test sends its request. The gateway Service is stable
197-
// across specs (see createStableServices), so this waits for the new pod to
197+
// across specs (see createStableInfra), so this waits for the new pod to
198198
// appear behind it, not for Envoy to re-resolve a rotated ClusterIP.
199199
// (podsInDeploymentsReady already confirms the coordinator pod itself is ready.)
200200
func waitForCoordinatorReady() {
@@ -239,25 +239,24 @@ func applyManifest(path string, subs map[string]string, excludeKinds ...string)
239239
return testutils.CreateObjsFromYaml(testConfig, docs, getNamespace())
240240
}
241241

242-
// createStableServices creates the coordinator and per-phase EPP Services once,
243-
// up front, and returns their ids for suite teardown. Envoy fronts these via
244-
// STRICT_DNS clusters and outlives the per-spec workload; recreating the
245-
// Services each spec would rotate their ClusterIPs and force Envoy to
246-
// re-resolve, so only the Deployments behind them churn per spec. Mirrors the
247-
// non-coordinator e2e, which creates the EPP Services once in its per-container
248-
// setup and recreates only the Deployment per test.
249-
func createStableServices() []string {
250-
objects := make([]string, 0, 4)
242+
// createStableInfra creates the coordinator and per-phase EPP Services,
243+
// ServiceAccounts, and RoleBindings once, up front, and returns their ids for
244+
// suite teardown. Envoy fronts the Services via STRICT_DNS clusters and outlives
245+
// the per-spec workload; recreating a Service each spec would rotate its
246+
// ClusterIP and force Envoy to re-resolve, so only the Deployments behind them
247+
// churn per spec. Mirrors the non-coordinator e2e, which creates the EPP
248+
// Services and RBAC once in its setup and recreates only the Deployment per test.
249+
func createStableInfra() []string {
250+
objects := make([]string, 0, 12)
251251

252252
docs := e2eutil.RunKustomize(coordinatorComponentDir)
253-
docs = e2eutil.FilterKinds(docs, "ConfigMap", "Deployment", "ServiceAccount")
253+
docs = e2eutil.FilterKinds(docs, "ConfigMap", "Deployment")
254254
docs = e2eutil.SubstituteMany(docs, coordinatorSubstitutions())
255255
docs = e2eutil.RemoveEmptyArgs(docs)
256256
objects = append(objects, testutils.CreateObjsFromYaml(testConfig, docs, getNamespace())...)
257257

258258
for _, manifest := range []string{encodeEPPManifest, prefillEPPManifest, decodeEPPManifest} {
259-
objects = append(objects,
260-
applyManifest(manifest, eppSubstitutions(), "ServiceAccount", "RoleBinding", "Deployment")...)
259+
objects = append(objects, applyManifest(manifest, eppSubstitutions(), "Deployment")...)
261260
}
262261
return objects
263262
}

0 commit comments

Comments
 (0)