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

Recording Events in a Provider #443

Open
Smithx10 opened this issue Dec 6, 2018 · 4 comments
Open

Recording Events in a Provider #443

Smithx10 opened this issue Dec 6, 2018 · 4 comments
Assignees

Comments

@Smithx10
Copy link

Smithx10 commented Dec 6, 2018


Environment summary

Provider (Triton)
Version (0...0..0.000..1)
K8s Master Info (minikube)
Install Method (go build)

Issue Details

While developing the Triton Provider I ran into a scenario where I would like to pass Events to the user. So they would appear in kubectl get events.

I looked how the regular Kubelet was doing so, and they used a recorder.

https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/kubelet_pods.go#L594

In order for your recorder to sink events you need a *kubernetesClientset
https://github.com/virtual-kubelet/virtual-kubelet/blob/master/vkubelet/podcontroller.go#L69

I was able to create the desired behavior by passing the k8sclient that VK was using into the provider by adding the kubernetes clientset to register.
https://github.com/virtual-kubelet/virtual-kubelet/blob/master/providers/register/register.go#L13

@pires expressed concern about using the same Client as VK, and that the provider should init their own kubernetes client. I am completely fine with that, and am now wondering if we should pass kubeConfig from https://github.com/virtual-kubelet/virtual-kubelet/blob/master/cmd/root.go#L267 into register so that Providers can easily init a new client, or have them reach out themselves via the provider config https://github.com/virtual-kubelet/virtual-kubelet/blob/master/providers/mock/mock.go#L76

@pires
Copy link
Member

pires commented Jan 29, 2021

I still share concerns about using the same Kubernetes client the VK uses to do its thing (track Pods, Secrets, ConfigMaps, the Node, send events). This means an option is for the VK to instantiate a second client and share listers + an event recorder the provider can use.

This aligns with what I did in systemk because VK didn't expose nothing I could use. That said, I think it's safe to say I may have all the info needed to evolve the Provider API to support this.

@cpuguy83 I think this is something that should be done soon. WDYT?

@pires pires self-assigned this Jan 29, 2021
@cpuguy83
Copy link
Contributor

It seems pretty tricky to do much here, because no matter what the provider is going to have to tell something that an event occurred. Why wouldn't that be a literal event recorder?

@pires
Copy link
Member

pires commented Jan 29, 2021

My idea really is to provide an event recorder while making sure it's a client instance that is not used by VK, to avoid bad providers spamming events to mess w/ VK performance.

@pires pires reopened this Jan 31, 2021
@pires
Copy link
Member

pires commented Jan 31, 2021

Feel free to unsubscribe @Smithx10 but I'll keep the issue open. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants