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(*) add Zone resource to register Remotes to Global #895

Merged
merged 22 commits into from
Jul 16, 2020

Conversation

nickolaev
Copy link
Contributor

Summary

Adding a zone resource.

Full changelog

  • [Implement ...]
  • [Fix ...]

Issues resolved

Fix #XXX

Documentation

Nikolay Nikolaev added 19 commits July 10, 2020 12:22
Signed-off-by: Nikolay Nikolaev <[email protected]>
tbd
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
Signed-off-by: Nikolay Nikolaev <[email protected]>
@nickolaev nickolaev marked this pull request as ready for review July 14, 2020 09:25
@nickolaev nickolaev requested a review from a team as a code owner July 14, 2020 09:25
if store.IsResourceNotFound(err) {
return errors.Errorf("No resources found in %s mesh", currentMesh)
}
return errors.Wrapf(err, "failed to get mesh %s", currentMesh)
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably meant failed to get zone?

// Configure the Remote Control Plane
message RemoteControlPlane {
// The public load balancer address of the Remote Control Plane KDS
string publicAddress = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't it clear that the address should be "public"? Maybe just "address" is enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, that was the name we agreed in the spec. I don't have any particular attachment to publicAddress, so we can go either way. @jakubdyszkiewicz what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I like just address

@@ -0,0 +1,82 @@
package system
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that we don't have validators for system API, but every entity in mesh API has it. I think it is useful to have zone_validator.go and check that all IP addresses have correct format

PublicAddress: "grpc://192.168.0.1",
},
Ingress: &system_proto.Zone_Ingress{
PublicAddress: "192.168.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

This is the test, so not really important, but this is an argument for validation. Ingress address should look like host:port


return []string{
zone.GetMeta().GetName(), // NAME
table.TimeSince(zone.GetMeta().GetModificationTime(), rootTime), // AGE
Copy link
Contributor

Choose a reason for hiding this comment

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

can we print remoteCP and ingress address?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remote CP will be removed in the next PR. Adding the Ingress address only.

// Configure the Remote Control Plane
message RemoteControlPlane {
// The public load balancer address of the Remote Control Plane KDS
string publicAddress = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

I like just address

pkg/config/app/kuma-cp/kuma-cp.defaults.yaml Show resolved Hide resolved
pkg/kds/global/components.go Show resolved Hide resolved
@@ -13,7 +13,7 @@ import (
. "github.com/kumahq/kuma/test/framework"
)

var _ = Describe("Test Kubernetes/Universal deployment", func() {
var _ = XDescribe("Test Kubernetes/Universal deployment", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

why X?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one will break, we need the bi-directional KDS to make this work.
Simply - put, Universal is run from memory so resources do not persist during restarts, and we have no way to use the Zone resources unless we restart (which will erase the resource from memory)

@@ -13,7 +14,7 @@ import (
. "github.com/kumahq/kuma/test/framework"
)

var _ = Describe("Test Universal deployment", func() {
var _ = XDescribe("Test Universal deployment", func() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why X?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See my response for the other one.

Signed-off-by: Nikolay Nikolaev <[email protected]>
@jakubdyszkiewicz
Copy link
Contributor

One more thing to be aware of. This resource seems to be bound to default mesh. When default mesh is deleted it will be deleted. We cannot create it without default Mesh.
I think it's more of a Admin's resource (like Secret) that belongs to Admin Server. IMHO we need a concept of Resource which is not Mesh bound (recently introduced Config is a second example).

But let's keep it this way for now. I think we might get a more clear picture when joining the Admin server with the API Server and introducing RBAC.

@nickolaev
Copy link
Contributor Author

@jakubdyszkiewicz completely agree. Having a Zone resource belonging to a Mesh sounds wrong. I have not found a way to remove it. It is kind of hidden, because kumactl apply will omit the check, but still behind the scenes, the mesh is set to "default".

if err != nil {
verr.AddViolation("address", "invalid address")
} else {
if host == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Kuma validates resources in a way that it tries to find as many errors as possible. So we don't need else here:

if host == "" {
    verr.AddViolation("address", "host has to be explicitly specified")
}
if port == "" {
    verr.AddViolation("address", "port has to be explicitly specified")
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, but then if there is an error, host and port will be empty for sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but I'm talking about if-branch where err == nil

Nikolay Nikolaev added 2 commits July 16, 2020 09:33
# Conflicts:
#	app/kumactl/pkg/install/k8s/control-plane/templates_vfsdata.go
Signed-off-by: Nikolay Nikolaev <[email protected]>
@nickolaev nickolaev merged commit 3682f7a into master Jul 16, 2020
@nickolaev nickolaev deleted the feat/zone_resource branch July 31, 2020 11:46
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