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

kuma-cp: use Controller to create default Mesh on k8s #298

Merged
merged 3 commits into from
Oct 1, 2019

Conversation

yskopets
Copy link
Contributor

@yskopets yskopets commented Sep 27, 2019

changes:

  • refactor default Mesh creation to make the logic re-usable from a k8s Controller
  • introduce a Controller to create default Mesh on k8s

motivation:

  • Control Plane now implements Admission Web Hook that mutates Mesh resource
  • as a result, when Control Plane creates/updates Mesh, k8s will call back Admission Web Hook to mutate given Mesh
  • however, k8s will fail to call Admission Web Hook until Control Plane finally becomes "ready"
  • we cannot make any assumptions about the delay between bootstrap is complete and k8s decides that Control Plane becomes "ready"
  • that's why we should create default Mesh from a reconciliation loop

@yskopets yskopets added this to the 0.2.0 milestone Sep 27, 2019
return errors.Errorf("unknown environment type %s", env)
}
// schedule a one-off create default Mesh operation
return runtime.Add(core_runtime.ComponentFunc(func(stop <-chan struct{}) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be simplified. We were doing default mesh via Component just because on K8S we had to wait for the cache. Now we can just call CreateDefaultMesh directly.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

func (d *Defaults) MeshProto() (v1alpha1.Mesh, error) {
func (d *Defaults) MeshProto() v1alpha1.Mesh {
mesh, err := d.parseMesh()
util_error.MustNot(err)
Copy link
Contributor

Choose a reason for hiding this comment

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

When it is ok to use this? I thought the whole point of golang error handling is to always pass error and log it at app root level.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's acceptable when an error indicates a programming mistake.

In this particular case, configuration must be validated once on application start up.

If there will be ever an error at this point, it's definitely a programming mistake.

}),
}).
Complete(r)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we planning to introduce high level integration tests?
Given the things described in Motivation I feel like it would be beneficial.

Not requiring it right now, but maybe create a github issue for it?

@yskopets yskopets merged commit eebe085 into master Oct 1, 2019
@yskopets yskopets deleted the feature/default-mesh-on-k8s branch October 23, 2019 09:54
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

2 participants