Skip to content

Enhance on-prem API key sync logic to support only RestApi#2216

Merged
renuka-fernando merged 3 commits into
wso2:mainfrom
DinithHerath:main
Jun 30, 2026
Merged

Enhance on-prem API key sync logic to support only RestApi#2216
renuka-fernando merged 3 commits into
wso2:mainfrom
DinithHerath:main

Conversation

@DinithHerath

@DinithHerath DinithHerath commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This pull request updates the API key synchronization logic to support on-premises control planes more accurately. Specifically, it ensures that only supported artifact kinds (currently RestApi) are considered for API key backfill when running in on-prem mode, while skipping unsupported kinds and logging the action.

On-premises API key sync improvements:

  • Introduced the onPremSupportedAPIKeyKinds map to explicitly list artifact kinds (RestApi) for which the on-prem control plane exposes an API-key backfill endpoint, clarifying that other kinds (e.g., LLM, WebSub, WebBroker) are cloud-only.
  • Updated the syncAPIKeysForExistingArtifacts method to skip unsupported kinds during bulk API key sync when running on-prem, logging a debug message for each skipped kind instead of skipping the entire sync process.

Related to https://github.com/wso2-enterprise/wso2-apim-internal/issues/17413

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5940fb3d-8b16-4ec7-8d55-15dae4bab7d2

📥 Commits

Reviewing files that changed from the base of the PR and between ee51c2a and 17dd730.

📒 Files selected for processing (1)
  • gateway/gateway-controller/pkg/controlplane/client.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • gateway/gateway-controller/pkg/controlplane/client.go

📝 Walkthrough

Summary

This PR updates API key synchronization for on-premises control planes by refining bulk API-key backfill to process only supported artifact kinds when running in on-prem mode.

Changes

  • Introduced an onPremSupportedAPIKeyKinds map to explicitly enumerate which artifact kinds are eligible for on-prem API-key backfill (currently RestApi).
  • Updated syncAPIKeysForExistingArtifacts to skip only unsupported kinds during the per-kind bulk sync loop in on-prem mode, rather than skipping the entire sync.
  • Added debug logging for each artifact kind skipped due to on-prem support constraints.

Impact

On-prem deployments will backfill and reconcile API keys for supported kinds while consistently ignoring cloud-only kinds (e.g., LLM, WebSub, WebBroker) without stopping the overall bulk synchronization flow.

Walkthrough

client.go changes syncAPIKeysForExistingArtifacts from an on-prem blanket skip to a per-kind filter. It adds an unexported onPremSupportedAPIKeyKinds map with models.KindRestApi, then skips only unsupported kinds on on-prem with a debug log. The existing fetch, upsert, and reconciliation flow remains unchanged.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description omits most required template sections and is largely incomplete. Add the required sections: Purpose, Goals, Approach, User stories, Documentation, Automation tests, Security checks, Samples, Related PRs, and Test environment.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change to on-prem API key sync support.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain modules listed in go.work or their selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@DinithHerath

Copy link
Copy Markdown
Contributor Author

@coderabbitai approve

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Comments resolved. Approval is disabled; enable reviews.request_changes_workflow to allow explicit top-level @coderabbitai resolve or @coderabbitai approve commands.

@DinithHerath DinithHerath self-assigned this Jun 17, 2026
@renuka-fernando renuka-fernando merged commit 99afdad into wso2:main Jun 30, 2026
9 checks passed
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.

2 participants