Skip to content

feat: Added Konnect Workspace related changes#376

Open
shivaygupta-dotcom wants to merge 8 commits intomainfrom
feature/KOKO-3141-konnect-workspace
Open

feat: Added Konnect Workspace related changes#376
shivaygupta-dotcom wants to merge 8 commits intomainfrom
feature/KOKO-3141-konnect-workspace

Conversation

@shivaygupta-dotcom
Copy link
Contributor

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

Summary

We need to support Workspaces in Konnect.
more context: https://konghq.atlassian.net/browse/KOKO-3141

Full changelog

  1. Added new field workspacename in KonnectConfig struct.
  2. Added a helper func KonnectWorkspaceExists to check if workspace exists in Konnect.
  3. Added changes in GetDefaulter to handle workspace case for konnect using above helper func.

Issues resolved

Documentation

Testing

  • Unit tests
  • E2E tests
  • Manual testing on Universal
  • Manual testing on Kubernetes

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2026

Codecov Report

❌ Patch coverage is 18.18182% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 28.79%. Comparing base (a02660e) to head (8f3597b).

Files with missing lines Patch % Lines
pkg/utils/utils.go 0.00% 7 Missing ⚠️
pkg/utils/defaulter.go 40.00% 4 Missing and 2 partials ⚠️
pkg/diff/diff.go 0.00% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #376      +/-   ##
==========================================
- Coverage   28.80%   28.79%   -0.02%     
==========================================
  Files         121      121              
  Lines       16480    16498      +18     
==========================================
+ Hits         4747     4750       +3     
- Misses      11116    11130      +14     
- Partials      617      618       +1     

☔ 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.

@shivaygupta-dotcom shivaygupta-dotcom removed the request for review from Prashansa-K February 19, 2026 06:27
@shivaygupta-dotcom shivaygupta-dotcom force-pushed the feature/KOKO-3141-konnect-workspace branch from 7d8a887 to 6c6554e Compare February 21, 2026 03:49
@gitguardian
Copy link

gitguardian bot commented Mar 10, 2026

⚠️ GitGuardian has uncovered 3 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 894aafa tests/integration/testdata/dump/001-entities-with-tags/expected312.yaml View secret
27577921 Triggered Generic Private Key 894aafa tests/integration/testdata/dump/001-entities-with-tags/expected312.yaml View secret
27577938 Triggered Generic High Entropy Secret 894aafa tests/integration/testdata/dump/001-entities-with-tags/expected312.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.

…kspaces and commented some entites for time being, will revert back once APIs are avialable.
@shivaygupta-dotcom shivaygupta-dotcom force-pushed the feature/KOKO-3141-konnect-workspace branch from e3cf73f to 67939bb Compare March 11, 2026 11:09
@shivaygupta-dotcom shivaygupta-dotcom changed the title feat: Added WorkspaceName and ControlPlaneId in KonnectConfig feat: Added Konnect Workspace related changes Mar 12, 2026
"of the updated configuration file before applying\n" +
"the configuration in production. Incorrect changes will result in\n" +
"unintended traffic routing by Kong Gateway.\n\n" +

Copy link
Collaborator

Choose a reason for hiding this comment

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

Why this removal?

Copy link
Contributor Author

@shivaygupta-dotcom shivaygupta-dotcom Mar 13, 2026

Choose a reason for hiding this comment

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

oh sorry, by mistake. I did bit of formatting and it got removed by IDE. I am reverting.

return false
}
for i := 0; i < len(want); i++ {
for i := range want {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are we doing here?

Copy link
Contributor Author

@shivaygupta-dotcom shivaygupta-dotcom Mar 13, 2026

Choose a reason for hiding this comment

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

I got linter error as slice index out of range, because while accessing have slice inside below for loop
for i := 0; i < len(want); i++ , we didn't had any check and linter was assuming that it might cause nil pointer dereference.
So added a fix, for the same.

github.com/hexops/gotextdiff v1.0.3
github.com/kong/deck v1.56.0
github.com/kong/go-kong v0.72.1
github.com/kong/deck v1.55.1
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why would you downgrade deck version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually, when I am adding go-kong changes ref here it is automatically downgrading decK version.

if workspace == "" {
return true, nil
}
return client.Workspaces.ExistsByName(ctx, &workspace)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we using ExistsByName() here and not just Exists() like in the above function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For checking workspace existence, the endpoints are different:
• In Kong, the endpoint is /%v/workspaces/%v
• In Konnect, the endpoint is /workspaces/%s
Due to this difference, the handling needs to be separate. I added this logic in the existsByName function. Since workspaceExists in decK already uses existsByName, I am using existsByName here instead of exists to ensure the Konnect flow works correctly.

var exists bool
var err error
if opts.IsKonnect {
exists, err = KonnectWorkspaceExists(ctx, opts.Client)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need a separate utility if both utilities work almost similarly?

What's the difference between client.Workspaces.ExistsByName(ctx, &workspace) and client.Workspaces.Exists(ctx, &workspace)? Why can't Konnect use the existing utility?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While creating a request for Kong, the NewRequest method appends the workspace name to the base endpoint. This behavior is not required for Konnect. Because of this difference, I implemented a separate utility function called NewKonnectWorkspaceRequest.

For checking workspace existence, the endpoints are also different:
• In Kong, the endpoint is /%v/workspaces/%v
• In Konnect, the endpoint is /workspaces/%s
Due to this difference, the handling needs to be separate. I added this logic in the existsByName function. Since workspaceExists in decK already uses existsByName, I am using existsByName here instead of exists to ensure the Konnect flow works correctly.

Apologies for not adding this in description.

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