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 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: Patch coverage is 0% with 550 lines in your changes missing coverage. Please review.

Project coverage is 32.75%. Comparing base (94c197b) to head (6a1e80e).
Report is 210 commits behind head on main.

Files with missing lines Patch % Lines
cmd/gateway_dump.go 0.00% 149 Missing ⚠️
cmd/gateway_reset.go 0.00% 121 Missing ⚠️
cmd/gateway_validate.go 0.00% 105 Missing ⚠️
cmd/gateway_diff.go 0.00% 44 Missing ⚠️
cmd/gateway_sync.go 0.00% 42 Missing ⚠️
cmd/root.go 0.00% 42 Missing ⚠️
cmd/gateway_ping.go 0.00% 19 Missing ⚠️
cmd/file_convert.go 0.00% 14 Missing ⚠️
cmd/gateway.go 0.00% 8 Missing ⚠️
cmd/file.go 0.00% 5 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #962      +/-   ##
==========================================
- Coverage   33.18%   32.75%   -0.43%     
==========================================
  Files         102      103       +1     
  Lines       12582    12747     +165     
==========================================
  Hits         4175     4175              
- Misses       8000     8165     +165     
  Partials      407      407              

☔ 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

@Tieske Tieske force-pushed the change/kong-subcommand branch from 339140e to 4c87068 Compare July 15, 2023 16:21
@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 from 4e37600 to a4deec5 Compare July 25, 2023 10:49
@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 force-pushed the change/kong-subcommand branch from 525f850 to 55a779b Compare October 16, 2023 14:00
@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
@Tieske Tieske force-pushed the change/kong-subcommand branch from f6edfa1 to 693c99e Compare October 24, 2023 18:37
cmd/root.go Outdated Show resolved Hide resolved
@Tieske Tieske force-pushed the change/kong-subcommand branch from d59992d to 5dcc32a Compare October 25, 2023 14:10
@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!

@GGabriele GGabriele force-pushed the change/kong-subcommand branch from aa19342 to 33abcc8 Compare October 31, 2023 10:29
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.
@Tieske Tieske force-pushed the change/kong-subcommand branch from 33abcc8 to 40f69eb Compare October 31, 2023 10:45
GGabriele
GGabriele previously approved these changes Oct 31, 2023
@Tieske Tieske merged commit d8b1753 into main Oct 31, 2023
33 of 34 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.

4 participants