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

feat: deploy konnect via main deck command #645

Merged
merged 2 commits into from
Apr 20, 2022
Merged

feat: deploy konnect via main deck command #645

merged 2 commits into from
Apr 20, 2022

Conversation

GGabriele
Copy link
Collaborator

No description provided.

@GGabriele GGabriele requested a review from a team as a code owner April 15, 2022 08:48
@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2022

Codecov Report

Attention: Patch coverage is 0.74074% with 268 lines in your changes missing coverage. Please review.

Project coverage is 44.57%. Comparing base (e33a6a8) to head (f6633b3).
Report is 528 commits behind head on main.

Files with missing lines Patch % Lines
cmd/common_konnect.go 0.00% 94 Missing ⚠️
cmd/common.go 0.00% 63 Missing ⚠️
cmd/ping.go 0.00% 38 Missing ⚠️
cmd/root.go 0.00% 28 Missing ⚠️
cmd/dump.go 0.00% 10 Missing ⚠️
utils/analytics.go 0.00% 7 Missing ⚠️
cmd/reset.go 0.00% 6 Missing ⚠️
cmd/konnect.go 0.00% 5 Missing ⚠️
cmd/validate.go 0.00% 5 Missing ⚠️
file/writer.go 0.00% 4 Missing and 1 partial ⚠️
... and 5 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #645      +/-   ##
==========================================
- Coverage   45.61%   44.57%   -1.05%     
==========================================
  Files          74       74              
  Lines        8536     8738     +202     
==========================================
+ Hits         3894     3895       +1     
- Misses       4283     4482     +199     
- Partials      359      361       +2     

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

Copy link
Member

@hbagdi hbagdi left a comment

Choose a reason for hiding this comment

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

Looks good. Please merge after the changes.

if mode == konnectMode {
result["mode"] = mode
}
if kongVersion != "" || mode != konnectMode {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if kongVersion != "" || mode != konnectMode {
if kongVersion != "" && mode != konnectMode {

-----END CERTIFICATE-----
cert_digest: b865971cecadd7bac9487901c9269c1fa903b3a3b521a927c5e2513f692ac61e
cert_digest: 34e0f1f3d83faefcc8514b6295bc822eab1110dc120140ddf342c017baee8c0f
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated change, please send another PR.

}
req, err := s.client.NewRequest(http.MethodPost, authEndpointV2, nil, body)
if err != nil {
return AuthResponse{}, err
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return AuthResponse{}, err
return AuthResponse{}, fmt.Errorf("build http request: %v", err)

var authResponse AuthResponse
resp, err := s.client.Do(ctx, req, &authResponse)
if err != nil {
return AuthResponse{}, err
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return AuthResponse{}, err
return AuthResponse{}, fmt.Errorf("authenticate http request: %v", err)

if err != nil {
return AuthResponse{}, err
}
url, _ := url.Parse(s.client.baseURL)
Copy link
Member

Choose a reason for hiding this comment

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

Please handle error.


info, err := s.UserInfo(ctx)
if err != nil {
return AuthResponse{}, err
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return AuthResponse{}, err
return AuthResponse{}, fmt.Errorf("fetch user-info: %v", err)

@@ -78,6 +78,9 @@ func Get(ctx context.Context, fileContent *Content, opt RenderConfig, dumpConfig
builder.client = wsClient
builder.ctx = ctx
builder.skipCACerts = dumpConfig.SkipCACerts
if dumpConfig.KonnectRuntimeGroup != "" {
builder.disableDynamicDefaults = true
Copy link
Member

Choose a reason for hiding this comment

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

Add a comment explaining why

cmd/ping.go Outdated
return fmt.Errorf("reading Kong version: %w", err)
}
fmt.Println("Successfully connected to Kong!")
fmt.Println("Kong version: ", version)
Copy link
Member

Choose a reason for hiding this comment

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

Can you break into two functions? pingKonnect and pingKong?
Please avoid long functions.

@GGabriele GGabriele merged commit 48abe5f into main Apr 20, 2022
@GGabriele GGabriele deleted the deck_konnect branch April 20, 2022 07:40
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