feat: Added Konnect Workspace related changes#376
feat: Added Konnect Workspace related changes#376shivaygupta-dotcom wants to merge 8 commits intomainfrom
Conversation
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
7d8a887 to
6c6554e
Compare
|
| 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
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secrets safely. Learn here the best practices.
- Revoke and rotate these secrets.
- 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
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 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.
e3cf73f to
67939bb
Compare
| "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" + | ||
|
|
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
What are we doing here?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
Why would you downgrade deck version?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Why are we using ExistsByName() here and not just Exists() like in the above function?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
Summary
We need to support Workspaces in Konnect.
more context: https://konghq.atlassian.net/browse/KOKO-3141
Full changelog
Issues resolved
Documentation
Testing