Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(cli): create 'gateway' subcommand for network commands #962

Merged
merged 3 commits into from
Oct 31, 2023

Conversation

Tieske
Copy link
Member

@Tieske Tieske commented Jul 14, 2023

This introduces the gateway sub-command, and moves the existing commands under the new sub-command. Since aliases are in place this is non-breaking.

The old commands will now display a deprecation warning.

New structure:

- version     Print the decK version
- completion  Generate completion script
- help        Help about any command
​
- file        decK file operations
  - add-tags     Adds tags to objects in a decK file
  - list-tags    Lists current tags to objects in a decK file
  - merge        Merges multiple decK files into one
  - openapi2kong Convert OpenAPI files to Kong's decK format
  - patch        Applies patches on top of a decK file
  - remove-tags  Removes tags from objects in a decK file
  - convert      Convert files from one format into another format
  - render       renders a final decK file as it would be synced (for local diffs)
  - validate     Validate the state file (locally)
- gateway     online operations
  - diff         Diff the current entities in Kong with the one on disks
  - dump         Export Kong configuration to a file
  - ping         Verify connectivity with Kong
  - reset        Reset deletes all entities in Kong
  - sync         Sync performs operations to get Kong's configuration to match the state file
  - validate     Validate the state file (online)
- diff        ==> alias for backward compatibilty
- dump        ==> alias for backward compatibilty
- ping        ==> alias for backward compatibilty
- reset       ==> alias for backward compatibilty
- sync        ==> alias for backward compatibilty
- validate    ==> alias for backward compatibilty
- convert     ==> alias for backward compatibilty

Todo:

Jira: APIOPS-98

@Tieske Tieske requested a review from a team as a code owner July 14, 2023 11:04
Base automatically changed from subcommand to feat/apiops July 14, 2023 11:10
@Tieske Tieske added this to the 1.24.0 milestone Jul 14, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 14, 2023

Codecov Report

Attention: 548 lines in your changes are missing coverage. Please review.

Comparison is base (94c197b) 33.18% compared to head (33abcc8) 32.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #962      +/-   ##
==========================================
- Coverage   33.18%   32.75%   -0.43%     
==========================================
  Files         102      103       +1     
  Lines       12582    12746     +164     
==========================================
  Hits         4175     4175              
- Misses       8000     8164     +164     
  Partials      407      407              
Files Coverage Δ
cmd/konnect.go 0.00% <0.00%> (ø)
cmd/file.go 0.00% <0.00%> (ø)
cmd/gateway.go 0.00% <0.00%> (ø)
cmd/file_convert.go 0.00% <0.00%> (ø)
cmd/gateway_ping.go 0.00% <0.00%> (ø)
cmd/gateway_sync.go 0.00% <0.00%> (ø)
cmd/root.go 0.84% <0.00%> (-0.05%) ⬇️
cmd/gateway_diff.go 0.00% <0.00%> (ø)
cmd/gateway_validate.go 0.00% <0.00%> (ø)
cmd/gateway_reset.go 0.00% <0.00%> (ø)
... and 1 more

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

@Tieske Tieske force-pushed the feat/apiops branch 3 times, most recently from c4acd9a to ec9f9b7 Compare July 14, 2023 16:06
Base automatically changed from feat/apiops to main July 14, 2023 16:11
@rspurgeon
Copy link
Collaborator

@Tieske @GGabriele This should not be merged. We are not adding the kong at this time. Once we GA the apiops file subcommand we can prioritize the kong command which has deeper repercussions to docs and other guides

@GGabriele GGabriele removed this from the 1.24.0 milestone Jul 17, 2023
@Tieske
Copy link
Member Author

Tieske commented Jul 17, 2023

we cannot move the top-level flags now, since that would break the existing commands. That can only be done after we finally remove the compatibility-commands we keep at the top-level.

@Tieske Tieske changed the title chore(cli): create 'kong' subcommand for network commands chore(cli): create 'gateway' subcommand for network commands Jul 18, 2023
@Tieske Tieske added this to the 1.25.0 milestone Jul 18, 2023
@Tieske Tieske force-pushed the change/kong-subcommand branch 2 times, most recently from 0a153b3 to 3db5260 Compare July 25, 2023 11:42
@Tieske Tieske force-pushed the change/kong-subcommand branch 2 times, most recently from f4479ba to 525f850 Compare July 27, 2023 15:23
@Tieske Tieske removed this from the 1.25.0 milestone Oct 16, 2023
@Tieske Tieske force-pushed the change/kong-subcommand branch 2 times, most recently from 477aa82 to f6edfa1 Compare October 18, 2023 13:21
cmd/root.go Outdated Show resolved Hide resolved
@Tieske Tieske force-pushed the change/kong-subcommand branch 3 times, most recently from 19ef437 to d8de662 Compare October 25, 2023 15:49
@GGabriele
Copy link
Collaborator

We should fix the tests as part of the d8de662 commit, but other than that LGTM!

for now we are more interested in reliability of the old-style
(to not break anything).

In a later stage we can revert this commit to switch the tests to
the new cli again.
GGabriele
GGabriele previously approved these changes Oct 31, 2023
@Tieske Tieske merged commit d8b1753 into main Oct 31, 2023
34 of 35 checks passed
@Tieske Tieske deleted the change/kong-subcommand branch October 31, 2023 11:43
Tieske added a commit that referenced this pull request Nov 1, 2023
2 Cobra commands were generated; deprecated, and current. Both
would point to the same golbal variable.
The bug is that Cobra sets the defaults when CREATING the command
not when parsing. This means that the last command created would
set the global defaults, and hence overwrite the ones from the
other command.

Introduced in #962

Jira: DECK-156
Tieske added a commit that referenced this pull request Nov 1, 2023
2 Cobra commands were generated; deprecated, and current. Both
would point to the same golbal variable.
The bug is that Cobra sets the defaults when CREATING the command
not when parsing. This means that the last command created would
set the global defaults, and hence overwrite the ones from the
other command.

Introduced in #962

Jira: DECK-156
Tieske added a commit that referenced this pull request Nov 1, 2023
2 Cobra commands were generated; deprecated, and current. Both
would point to the same golbal variable.
The bug is that Cobra sets the defaults when CREATING the command
not when parsing. This means that the last command created would
set the global defaults, and hence overwrite the ones from the
other command.

Introduced in #962

Jira: DECK-156
Tieske added a commit that referenced this pull request Nov 1, 2023
2 Cobra commands were generated; deprecated, and current. Both would point to the same golbal variable.
The bug is that Cobra sets the defaults when CREATING the command not when parsing. This means that the last command created would set the global defaults, and hence overwrite the ones from the other command.

Introduced in #962

Jira: DECK-156
AntoineJac pushed a commit that referenced this pull request Jan 23, 2024
2 Cobra commands were generated; deprecated, and current. Both would point to the same golbal variable.
The bug is that Cobra sets the defaults when CREATING the command not when parsing. This means that the last command created would set the global defaults, and hence overwrite the ones from the other command.

Introduced in #962

Jira: DECK-156
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.

None yet

4 participants