Skip to content

Conversation

@thokra-nav
Copy link
Contributor

Some features are therefore removed or altered, but most tests are fairly unchanged.

Requires an update to liberator that's not merged yet: nais/liberator#306

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Valkey provisioning and reconciliation in the API from Aiven aiven.io/v1alpha1 resources to nais.io/v1 Valkey resources (via pgrator/mapperator CRDs), while still listing/reading legacy Aiven Valkeys for compatibility.

Changes:

  • Create/Update/Delete Valkeys using github.com/nais/pgrator/pkg/api/v1 (nais.io/v1) and add a dedicated NaisValkeyWatcher.
  • Adjust Valkey conversion/mapping logic (tier/memory/maxMemoryPolicy) for the new CRD.
  • Update Kubernetes scheme + fake client mappings and bump dependencies (including adding pgrator API module).

Reviewed changes

Copilot reviewed 13 out of 14 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/persistence/valkey/queries.go Switch CRUD to nais.io/v1 Valkey CRD, merge legacy + new watchers in reads/lists
internal/persistence/valkey/models.go Add conversion from nais.io/v1 Valkey and adapt max memory policy parsing
internal/persistence/valkey/machines.go Remove tier+memory → plan lookup now that plan is no longer set in created resources
internal/persistence/valkey/dataloader.go Add nais.io/v1 GVR + NewNaisValkeyWatcher; add helper for NAIS dynamic client
internal/persistence/valkey/client.go Simplify client struct now that watcher isn’t stored on it
internal/kubernetes/watchers/watchers.go Register NaisValkeyWatcher in watcher setup
internal/kubernetes/watcher/watcher.go Extend SystemAuthenticatedClient signature to accept options
internal/kubernetes/utils.go Add helpers to convert to/from unstructured objects
internal/kubernetes/scheme.go Register pgrator API schemes
internal/kubernetes/fake/fake.go Register valkeys list kind for fake dynamic client
internal/cmd/api/http.go Wire NaisValkeyWatcher into Valkey loader context
integration_tests/valkey_crud.lua Update expected resources to nais.io/v1 Valkey CRD and remove Aiven ServiceIntegration assertions
go.mod / go.sum Add pgrator API module and bump several dependencies
Comments suppressed due to low confidence (1)

internal/kubernetes/watcher/watcher.go:316

  • SystemAuthenticatedClient now accepts opts ...ImpersonatedClientOption, but the implementation doesn’t forward opts to the underlying cluster watcher (it always calls watcher.SystemAuthenticatedClient(ctx) without options). This makes options like WithImpersonatedClientGVR ineffective. Suggestion: pass opts... through to watcher.SystemAuthenticatedClient(ctx, opts...).
func (w *Watcher[T]) SystemAuthenticatedClient(ctx context.Context, cluster string, opts ...ImpersonatedClientOption) (dynamic.NamespaceableResourceInterface, error) {
	for _, watcher := range w.watchers {
		if watcher.cluster == cluster {
			return watcher.SystemAuthenticatedClient(ctx)
		}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Some features are therefore removed or altered, but most tests are
fairly unchanged.

Requires an update to liberator that's not merged yet: nais/liberator#306
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant