Skip to content

feat: Added changes to support workspace with konnect flow#1892

Merged
Prashansa-K merged 38 commits into
mainfrom
feature/konnect-workspaces
Mar 26, 2026
Merged

feat: Added changes to support workspace with konnect flow#1892
Prashansa-K merged 38 commits into
mainfrom
feature/konnect-workspaces

Conversation

@shivaygupta-dotcom
Copy link
Copy Markdown
Contributor

@shivaygupta-dotcom shivaygupta-dotcom commented Feb 20, 2026

https://konghq.atlassian.net/browse/KOKO-3141
#1859

Supporting PRs:
Kong/go-kong#602
Kong/go-database-reconciler#376

Summary:

This PR introduces workspace support for Konnect as part of the referenced Jira task. The changes extend existing commands to support workspaces when operating in Konnect mode. Added changes in sync, diff, reset, apply, dump and validate command.
The overall flow is similar to the existing Kong workspace implementation, but Konnect uses different workspace API endpoints, which required additional handling.
In Konnect/Kong, all entities are attached to the default workspace by default but Konnect endpoint is bit different then what we have in Kong . Therefore, when the user explicitly specifies the default workspace, the system should follow the existing normal Konnect flow, without triggering workspace-specific logic.

Testing:
Verified that Konnect workspace behavior aligns with Kong workspaces, ensuring consistent behavior across both flows.
I have added all the integration tests below for the review reference.

Integration tests For Konnect Workspaces:

Dump Command

  1. dump empty workspace
  2. dump workspace with single entity
  3. dump without _workspace field in state file
  4. dump with default workspace name
  5. workspace isolation - entities synced to workspace should not appear in CP-level dump
  6. dump all workspaces (workspace1, workspace2, default)

Reset Command

  1. reset workspace with single entity
  2. reset workspace with multiple entities
  3. reset without workspace flag (CP-level)
  4. reset with default workspace name
  5. reset workspace isolation - reset workspace1, verify workspace2 unaffected
  6. reset all workspaces

Sync Command

  1. sync entities into konnect workspace
  2. sync empty workspace - no entities
  3. sync without _workspace field in state file
  4. sync with different workspace name - workspace mismatch
  5. sync then reset to empty workspace

Diff Command

  1. create konnect workspace with entity creation
  2. create konnect workspace with existing entity deletion and new entity creation
  3. update single entity in konnect workspace
  4. empty state file should show deletion of all entities
  5. workspace mismatch - different workspace name should create new workspace
  6. idempotency - no diff after sync

Apply Command

  1. apply entity into konnect workspace
  2. apply and update entity in konnect workspace
  3. apply is additive - does not delete existing entities
  4. apply without _workspace field in state file

Validate Command

  1. validate with _workspace in state file
  2. validate with --workspace flag
  3. validate without workspace (CP-level)
  4. validate with default workspace in state file
  5. validate with --workspace=default flag
  6. validate empty workspace
  7. validate with non-existent --workspace flag
  8. validate workspace isolation - sync entity to workspace, validate both workspace and CP-level files

@shivaygupta-dotcom
Copy link
Copy Markdown
Contributor Author

shivaygupta-dotcom commented Mar 11, 2026

CI is failing because, no other entity is present other than routes for Konnect Workspaces.This will be fixed once changes are deployed from KoKo side.

Changes are inProgress from KoKo side, I didn't got any specific ETA.
https://konghq.atlassian.net/browse/KOKO-3141?focusedCommentId=206410

@shivaygupta-dotcom shivaygupta-dotcom marked this pull request as ready for review March 12, 2026 05:59
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 0% with 178 lines in your changes missing coverage. Please review.
✅ Project coverage is 32.58%. Comparing base (4a293ab) to head (7a2971e).

Files with missing lines Patch % Lines
cmd/common_konnect.go 0.00% 70 Missing ⚠️
cmd/gateway_reset.go 0.00% 53 Missing ⚠️
cmd/common.go 0.00% 25 Missing ⚠️
cmd/gateway_validate.go 0.00% 23 Missing ⚠️
validate/validate.go 0.00% 6 Missing ⚠️
cmd/gateway_dump.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1892      +/-   ##
==========================================
- Coverage   33.04%   32.58%   -0.47%     
==========================================
  Files          77       77              
  Lines        6812     6903      +91     
==========================================
- Hits         2251     2249       -2     
- Misses       4381     4474      +93     
  Partials      180      180              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread tests/integration/validate_test.go
Comment thread validate/validate.go
Comment thread cmd/common_konnect.go
Comment thread cmd/common.go
Comment thread cmd/common.go Outdated
Comment thread cmd/common.go Outdated
Comment thread cmd/common_konnect.go Outdated
Comment thread cmd/common_konnect.go
Comment thread cmd/gateway_validate.go Outdated
Comment thread tests/integration/validate_test.go
Comment thread tests/integration/validate_test.go Outdated
Comment thread tests/integration/validate_test.go
@gitguardian
Copy link
Copy Markdown

gitguardian Bot commented Mar 26, 2026

⚠️ GitGuardian has uncovered 5 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
27577943 Triggered Generic High Entropy Secret 561788b tests/integration/testdata/dump/009-skip-defaults/konnect/credentials.expected.yaml View secret
27577964 Triggered Generic Password 561788b tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/credentials.expected.yaml View secret
27577964 Triggered Generic Password 561788b tests/integration/testdata/dump/009-skip-defaults/konnect/credentials.expected.yaml View secret
27577943 Triggered Generic High Entropy Secret 561788b tests/integration/testdata/dump/009-skip-defaults/enterprise/3.4/credentials.expected.yaml View secret
27577956 Triggered Generic Password d31b8ce tests/integration/testdata/sync/047-basic-auth-skip-hash/expected-dump.yaml View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Prashansa-K Prashansa-K merged commit 8c7210b into main Mar 26, 2026
40 of 41 checks passed
@Prashansa-K Prashansa-K deleted the feature/konnect-workspaces branch March 26, 2026 09:31
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.

3 participants