-
Notifications
You must be signed in to change notification settings - Fork 339
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(kumactl) validate that the control plane is running #309
Conversation
@@ -1,5 +1,13 @@ | |||
package v1alpha1 | |||
|
|||
import ( | |||
"encoding/json" | |||
api_server "github.com/Kong/kuma/pkg/api-server" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
client dependency on the entire api-server
package doesn't look right.
Let's move IndexResponse
into pkg/api-server/types
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved
return nil | ||
} | ||
|
||
func validateCpCoordinates(cp *ControlPlane) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't expect this kind of logic inside pkg/config/...
Let's move it either to app/kumactl/cmd/config/
or to app/kumactl/pkg/config/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to app/kumactl/pkg/config/
} | ||
|
||
func validateCpCoordinates(cp *ControlPlane) error { | ||
resp, err := http.Get(cp.Coordinates.ApiServer.Url) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No connection timeout ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, went with timeout with context, so we fail on connection timeout as well as read/socket timeout. (it was also easier to test)
@@ -56,13 +60,14 @@ func (cfg *Configuration) GetControlPlane(name string) (int, *ControlPlane) { | |||
return -1, nil | |||
} | |||
|
|||
func (cfg *Configuration) AddControlPlane(cp *ControlPlane) bool { | |||
func (cfg *Configuration) AddControlPlane(cp *ControlPlane) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we revert to the original version with bool
return type ?
So that all methods inside config_helpers.go
consistently return bool
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverted
Summary
Validation before the control plane is added that it is valid running API Server of Kuma.
Full changelog
Issues resolved
Fix #181