Fix: Preserve portal identity provider refs in dump output#901
Merged
Fix: Preserve portal identity provider refs in dump output#901
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Fixes portal identity provider dump/load round-trips by ensuring kongctl metadata (ref, portal) is preserved when serializing embedded SDK identity provider payloads.
Changes:
- Add custom JSON/YAML marshaling for
PortalIdentityProviderResourceto includeref/portalalongside SDK fields. - Add regression tests for JSON + YAML dump output containing portal identity provider metadata.
- Tighten the portal IdP e2e scenario assertion to require the dumped nested provider
ref.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| test/e2e/scenarios/portal/identity_providers/scenario.yaml | Strengthens scenario dump assertions to verify the provider ref is preserved. |
| internal/declarative/resources/portal_identity_provider_test.go | Adds regression coverage to ensure JSON/YAML serialization includes ref/portal. |
| internal/declarative/resources/portal_identity_provider.go | Introduces explicit marshalers to avoid embedded SDK MarshalJSON dropping kongctl metadata. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix portal identity provider dump round trips by preserving kongctl metadata during serialization.
PortalIdentityProviderResourcesorefandportalare emitted alongside the embedded SDK identity provider payload.ref.Root Cause
PortalIdentityProviderResourceembeds the SDKCreateIdentityProvidertype, which has its ownMarshalJSON. That promoted marshaler caused dump output to include SDK fields liketype,enabled, andconfig, but drop kongctl metadata such asref. Loading the dumped YAML then failed validation with an empty portal identity provider ref.Validation
go test ./internal/declarative/resources ./internal/cmd/root/verbs/dumpmake formatmake testmake buildmake lintThe full portal identity provider e2e scenario was not run locally because it requires real IdP environment variables and resets the test organization.