Skip to content

Commit 69847b0

Browse files
authored
add verifyenv
Signed-off-by: GitHub <[email protected]>
1 parent 8c63a03 commit 69847b0

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

e2e/profiles/llm-d/profile.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,55 @@ func (p *Profile) verifyEnvironment(ctx context.Context, opts *framework.SetupOp
244244
return err
245245
}
246246

247+
// Verify required CRDs/APIs from Gateway API and Inference Extension are registered.
248+
type apiCheck struct {
249+
groupVersion string
250+
expectedResources []string
251+
optional bool
252+
}
253+
checkAPIGroup := func(c apiCheck) error {
254+
resources, err := client.Discovery().ServerResourcesForGroupVersion(c.groupVersion)
255+
if err != nil {
256+
if c.optional {
257+
if p.verbose {
258+
fmt.Printf("[Verify] API group %s not found (optional): %v\n", c.groupVersion, err)
259+
}
260+
return nil
261+
}
262+
return fmt.Errorf("discover %s: %w", c.groupVersion, err)
263+
}
264+
found := make(map[string]bool, len(resources.APIResources))
265+
for _, r := range resources.APIResources {
266+
found[r.Name] = true
267+
}
268+
for _, r := range c.expectedResources {
269+
if !found[r] {
270+
if c.optional {
271+
if p.verbose {
272+
fmt.Printf("[Verify] Missing optional resource %s in %s\n", r, c.groupVersion)
273+
}
274+
return nil
275+
}
276+
return fmt.Errorf("missing %s in %s", r, c.groupVersion)
277+
}
278+
}
279+
if p.verbose {
280+
fmt.Printf("[Verify] API group %s present with %v\n", c.groupVersion, c.expectedResources)
281+
}
282+
return nil
283+
}
284+
285+
for _, c := range []apiCheck{
286+
{groupVersion: "gateway.networking.k8s.io/v1", expectedResources: []string{"gateways", "httproutes"}},
287+
{groupVersion: "inference.networking.k8s.io/v1", expectedResources: []string{"inferencepools"}},
288+
// EndpointPickerConfig CRD is optional in some environments; treat as best-effort.
289+
{groupVersion: "inference.networking.x-k8s.io/v1alpha1", expectedResources: []string{"endpointpickerconfigs"}, optional: true},
290+
} {
291+
if err := checkAPIGroup(c); err != nil {
292+
return err
293+
}
294+
}
295+
247296
// Actively wait for critical deployments to become Available before checking readiness counts.
248297
// This avoids flakiness when resources are still pulling images just after creation.
249298
deployer := helm.NewDeployer(opts.KubeConfig, opts.Verbose)
@@ -252,6 +301,8 @@ func (p *Profile) verifyEnvironment(ctx context.Context, opts *framework.SetupOp
252301
}{
253302
{semanticNamespace, "semantic-router"},
254303
{gatewayNamespace, "istiod"},
304+
{"default", "vllm-llama3-8b-instruct"},
305+
{"default", "phi4-mini"},
255306
{"default", "llm-d-inference-scheduler-llama3-8b"},
256307
{"default", "llm-d-inference-scheduler-phi4-mini"},
257308
{"default", "inference-gateway-istio"},
@@ -268,6 +319,12 @@ func (p *Profile) verifyEnvironment(ctx context.Context, opts *framework.SetupOp
268319
if err := helpers.CheckDeployment(ctx, client, gatewayNamespace, "istiod", p.verbose); err != nil {
269320
return err
270321
}
322+
if err := helpers.CheckDeployment(ctx, client, "default", "vllm-llama3-8b-instruct", p.verbose); err != nil {
323+
return err
324+
}
325+
if err := helpers.CheckDeployment(ctx, client, "default", "phi4-mini", p.verbose); err != nil {
326+
return err
327+
}
271328
if err := helpers.CheckDeployment(ctx, client, "default", "llm-d-inference-scheduler-llama3-8b", p.verbose); err != nil {
272329
return err
273330
}

0 commit comments

Comments
 (0)