replace hardcoded SlesCSDDriverVersions map with actual registry.suse.com check #572
replace hardcoded SlesCSDDriverVersions map with actual registry.suse.com check #572Priyankasaggu11929 wants to merge 2 commits into
Conversation
yansun1996
left a comment
There was a problem hiding this comment.
Hi @Priyankasaggu11929 , thanks for raising this PR, please check the comment regarding the possible situation in disconnected / air-gapped deployment.
….com check with cache and air-gapped support
fa32846 to
2e2e60a
Compare
2e2e60a to
ccb2005
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates SLES driver version validation to stop relying on a hardcoded supported-versions map and instead validate availability by querying SUSE’s registry endpoints (with a short-lived cache), with corresponding unit test updates and air-gapped documentation adjustments.
Changes:
- Replace static SLES driver-version allowlist logic with a registry.suse.com availability check (plus caching).
- Update validator and tests to pass
context.Contextand to mock registry/auth endpoints. - Adjust SLES prebuilt driver image resolution to support custom base registry mirroring, and document SLES-specific mirroring steps for air-gapped installs.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/validator/utils.go | Switch validation from hardcoded map to context-aware registry availability checks; skip when using a custom base registry. |
| internal/utils.go | Implement SUSE registry token+manifest probing with caching; update SLES default mapper error handling. |
| internal/utils_test.go | Update unit test to use httptest servers for auth/registry and validate new error behavior. |
| internal/kmmmodule/kmmmodule.go | Build SUSE prebuilt driver image references using either default SUSE repo or a custom mirrored base registry. |
| docs/specialized_networks/airgapped-install.md | Document mirroring of SLES base/prebuilt driver images and configuring baseImageRegistry for SLES nodes. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| var ( | ||
| slesVersionCache = map[string]slesVersionCacheEntry{} | ||
| slesVersionCacheTTL = 5 * time.Minute | ||
| ) |
| cacheKey := cs + "@" + driverVersion | ||
| if e, ok := slesVersionCache[cacheKey]; ok && time.Now().Before(e.expiresAt) { | ||
| logr.FromContextOrDiscard(ctx).Info("SLES driver version cache hit", "codestream", cs, "version", driverVersion) | ||
| return e.err | ||
| } |
| default: | ||
| result = fmt.Errorf("unexpected status %d from SUSE registry for SLES %s version %q", resp2.StatusCode, cs, driverVersion) | ||
| } | ||
| slesVersionCache[cacheKey] = slesVersionCacheEntry{err: result, expiresAt: time.Now().Add(slesVersionCacheTTL)} |
| "net/http" | ||
| "regexp" | ||
| "strconv" | ||
| "strings" | ||
| "time" |
| resp, err := slesRegistryHTTPClient.Do(req) | ||
| if err != nil { | ||
| return fmt.Errorf("could not reach SUSE registry: %w", err) | ||
| } | ||
| defer resp.Body.Close() |
|
Hi @Priyankasaggu11929 2
|
|
Thanks for the review @yansun1996. jfyi - i am on leave this week. i will get back to this next week. |
Motivation
follow up on point (1) - #562 (comment)
Technical Details
and cache logs would look like:
Test Plan
updated test in
internal/utils_test.go, to rewrite TestValidateSLESDriverVersion to accomodate the new model of driver version validationTest Result
Submission Checklist