-
Notifications
You must be signed in to change notification settings - Fork 327
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
control-plane: automatically create Dataplane resource on k8s and use to generate inbound Envoy listeners #104
Conversation
9d64503
to
6176f99
Compare
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.
Overall - good job on this PR! 🥇
}, | ||
Entry("dataplane IP address is missing", testCase{ | ||
input: ":80:8080", | ||
expectedErr: `invalid format: expected ^(?P<workload_ip>(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)):(?P<service_port>[0-9]{1,5}):(?P<workload_port>[0-9]{1,5})$, got ":80:8080"`, |
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.
in whole file: can we extract this regex to const or reuse one from production code?
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.
fixed (by relaxing error matcher)
components/konvoy-control-plane/pkg/plugins/discovery/k8s/controllers/dataplane_controller.go
Show resolved
Hide resolved
Spec: kube_core.ServiceSpec{ | ||
Ports: []kube_core.ServicePort{ | ||
{ | ||
Port: 80, |
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.
is the protocol implicit here?
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.
fixed
Spec: kube_core.ServiceSpec{ | ||
Ports: []kube_core.ServicePort{ | ||
{ | ||
Protocol: "UDP", |
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.
It's nice to give comments why those are mismatching so:
Protocol: "UDP", // only TCP is supported
Protocol: "SCTP", // only TCP is supported
IntVal: 7071, // no container with such port
StrVal: "diagnostics", // no port with that name
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.
fixed
) | ||
}) | ||
|
||
var _ = Describe("DataplaneFor(..)", func() { |
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.
Those cases for this are already fully covered in Describe("PodToDataplane(..)")
do we need second tests for this?
When we will have to change of the DataplaneFor
we would have to change tests for both cases.
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.
removed separate test for DataplaneFor(..)
|
||
func MatchServiceThatSelectsPod(pod *kube_core.Pod) ServicePredicate { | ||
return func(svc *kube_core.Service) bool { | ||
selector := kube_labels.SelectorFromSet(kube_labels.Set(svc.Spec.Selector)) |
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.
It seems that kube_labels.Set()
is redundant conversion.
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.
removed explicit type conversion
components/konvoy-control-plane/pkg/plugins/discovery/k8s/controllers/pod_controller.go
Show resolved
Hide resolved
Name: pod.Name, | ||
}, | ||
} | ||
op, err := kube_controllerutil.CreateOrUpdate(ctx, r.Client, dataplane, func() 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 had to go to editor to see what op
is. Can we give it a bit more descriptive name like operationResult
or operationRes
. I would be also confused to see op
in logs.
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.
fixed
components/konvoy-control-plane/pkg/plugins/discovery/k8s/controllers/pod_converter.go
Show resolved
Hide resolved
) | ||
|
||
var _ DiscoverySource = &DiscoverySink{} | ||
var _ DiscoveryConsumer = &DiscoverySink{} | ||
|
||
// DiscoverySink is both a source and a consumer of discovery information. | ||
type DiscoverySink struct { | ||
Consumer DiscoveryConsumer | ||
ServiceConsumer ServiceDiscoveryConsumer | ||
WorkloadConsumer WorkloadDiscoveryConsumer |
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.
What do you think about removing ServiceConsumer and WorkloadConsumer?
There is no usage of this - no source of those events and no consumer.
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.
removed
…d with Konvoy sidecar injected
8f38d45
to
6b71548
Compare
changes: