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

Improve Kubernetes events to be CloudEvents 1.0 compatible #85544

Open
tomkerkhove opened this issue Nov 22, 2019 · 52 comments
Open

Improve Kubernetes events to be CloudEvents 1.0 compatible #85544

tomkerkhove opened this issue Nov 22, 2019 · 52 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation.

Comments

@tomkerkhove
Copy link
Contributor

tomkerkhove commented Nov 22, 2019

As of today, Kubernetes already provides extension points by emitting events by different SIGs - This is great!

However, there are a few hurdles:

  • The event contract is specific to Kubernetes which makes it harder to integrate with
  • Events do not have a unique subjects which consumers can use to subscribe to and have to figure it out themselves
  • There is poor documentation on what event is being emitted when

What would you like to be added: Now that CloudEvents has reached the 1.0 milestone it would be good if Kubernetes could start emitting events in that format.

As part of that transition, I would love to use this change to build a centralized list with all the events and their subjects to make it easier to consume htem.

Why is this needed: Emitting events according to the CloudEvent specification would make it easier for external tools and vendors to plug in and extend Kubernetes where they have to.

/cc @clemensv

@tomkerkhove tomkerkhove added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 22, 2019
@k8s-ci-robot k8s-ci-robot added the needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. label Nov 22, 2019
@tomkerkhove
Copy link
Contributor Author

This one would be for @kubernetes/sig-instrumentation-feature-requests I think

@k8s-ci-robot k8s-ci-robot added sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Nov 22, 2019
@k8s-ci-robot
Copy link
Contributor

@tomkerkhove: Reiterating the mentions to trigger a notification:
@kubernetes/sig-instrumentation-feature-requests

In response to this:

This one would be for @kubernetes/sig-instrumentation-feature-requests I think

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@brancz
Copy link
Member

brancz commented Nov 22, 2019

This is fairly vague what this would mean in terms of changes. I would suggest that you join the sig instrumentation meetings and we start discussing this there. If there is some amount of interest, then I'd say we flesh out a KEP and understand what this would really mean for the project. The existing events API is replied upon by a lot of people so we can't just go and break it, it's literally an API with stability guarantees.

@tomkerkhove
Copy link
Contributor Author

I'm happy to join the bi-weekly call but the https://github.com/kubernetes/community/tree/master/sig-instrumentation points me to a temporary page due to a move. When is the next one?

The current approach is a good start but there are a few things that can be improved:

  • Custom format that we have to parse which makes it harder to integrate with
  • No type field which uniquely identify the nature of the event, think DeploymentCreated, DeploymentScaled, etc. These allow us to subscribe to only one event type rather than having to subscribe to them all and see if it's interesting for us. (filtering would be nice to have in Kube, but doesn't have to be the case as other systems like Azure Event Grid can do that based on CloudEvents)
Kubernetes Event Sample
{
    "action": null,
    "apiVersion": "v1",
    "count": 1,
    "eventTime": null,
    "firstTimestamp": "2019-11-25T09:34:16Z",
    "involvedObject": {
        "apiVersion": "v1",
        "fieldPath": null,
        "kind": "Pod",
        "name": "order-processor-85ccb86f6-qfccj",
        "namespace": "k8s-issue",
        "resourceVersion": "165777",
        "uid": "bf93d0c6-0f66-11ea-b446-00155d83711f"
    },
    "kind": "Event",
    "lastTimestamp": "2019-11-25T09:34:16Z",
    "message": "Successfully assigned k8s-issue/order-processor-85ccb86f6-qfccj to docker-desktop",
    "metadata": {
        "annotations": null,
        "clusterName": null,
        "creationTimestamp": "2019-11-25T09:34:16Z",
        "deletionGracePeriodSeconds": null,
        "deletionTimestamp": null,
        "finalizers": null,
        "generateName": null,
        "generation": null,
        "initializers": null,
        "labels": null,
        "managedFields": null,
        "name": "order-processor-85ccb86f6-qfccj.15da5e1339c58574",
        "namespace": "k8s-issue",
        "ownerReferences": null,
        "resourceVersion": "165783",
        "selfLink": "/api/v1/namespaces/k8s-issue/events/order-processor-85ccb86f6-qfccj.15da5e1339c58574",
        "uid": "bf9aaf5c-0f66-11ea-b446-00155d83711f"
    },
    "reason": "Scheduled",
    "related": null,
    "reportingComponent": "",
    "reportingInstance": "",
    "series": null,
    "source": {
        "component": "default-scheduler",
        "host": null
    },
    "type": "Normal"
}

Just to be clear - I am not saying the current approach sucks, I'm just suggesting to use a CNCF-supported standard instead, please don't get me wrong!

I fully understand that there are a lot of customers on the current eventing API and I'm not suggesting to just kill this but merely have them side-by-side or provide a migration to CloudEvents.

@duglin
Copy link

duglin commented Nov 25, 2019

Please don't forget about "binary" vs "structured" CloudEvents. CloudEvents supports the idea of not changing an existing event/message to become a CloudEvent. You just add a few extra bits of metadata (e.g. http headers). You could also use the CloudEvents defined structure too if you want, but it's not required.

@tomkerkhove
Copy link
Contributor Author

Oh that's right - So if we add the additional (HTTP) headers we can get the metadata without changing the effective event payload we have today - Is that correct?

@duglin
Copy link

duglin commented Nov 25, 2019

correct - as long as the receiver can handle "binary" CloudEvents

@tomkerkhove
Copy link
Contributor Author

tomkerkhove commented Nov 25, 2019

Here's the spec on that - HTTP Protocol Binding for CloudEvents - Version 1.0

That would be the perfect middle ground I think!

@RainbowMango
Copy link
Member

I'm happy to join the bi-weekly call but the https://github.com/kubernetes/community/tree/master/sig-instrumentation points me to a temporary page due to a move. When is the next one?

Next meeting on Nov 28th. Welcome.
Join the google group to get auto-invited to meetings and google docs: https://groups.google.com/forum/#!forum/kubernetes-sig-instrumentation

Meeting notes: https://docs.google.com/document/d/17emKiwJeqfrCsv0NZ2FtyDbenXGtTNCsDEiLbPa7x7Y

@tomkerkhove
Copy link
Contributor Author

tomkerkhove commented Nov 26, 2019

I'll try to join day after tomorrow, or is it cancelled due to Thanksgiving?

@ehashman
Copy link
Member

I pinged @piosz to confirm; both SIG chairs aren't based in the US but much of the SIG is and @brancz is currently out on vacation. I don't see any agenda items so I suspect it will be cancelled.

@tomkerkhove
Copy link
Contributor Author

Thanks for checking - I'll join but if nobody shows up join later on instead.

@rektide
Copy link

rektide commented Nov 27, 2019

some discussion in this thread about structured logging- just want to create a link here to kubernetes/enhancements#1367 , which is an enhancement for structured logging.

@brancz
Copy link
Member

brancz commented Dec 3, 2019

I think we're on the same page.

I fully understand that there are a lot of customers on the current eventing API and I'm not suggesting to just kill this but merely have them side-by-side or provide a migration to CloudEvents.

This is the possibility I see for something like this as well. It would need to be fleshed out in detail though.

@tomkerkhove
Copy link
Contributor Author

Awesome, happy to help where I can.

@tomkerkhove tomkerkhove changed the title Change Kubernetes events to use CloudEvents 1.0 Improve Kubernetes events to support CloudEvents 1.0 Dec 3, 2019
@tomkerkhove tomkerkhove changed the title Improve Kubernetes events to support CloudEvents 1.0 Improve Kubernetes events to be CloudEvents 1.0 compatible Dec 3, 2019
@tomkerkhove
Copy link
Contributor Author

I've updated the title to indicate that it's more about compatibility rather than change/impact current approach drastically.

@tomkerkhove
Copy link
Contributor Author

Adding @kubernetes/sig-api-machinery-feature-requests as discussed in the SIG instrumentation standup.

I will provide a sample based on Kubernetes event in next couple of days.

@k8s-ci-robot k8s-ci-robot added the sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. label Dec 12, 2019
@k8s-ci-robot
Copy link
Contributor

@tomkerkhove: Reiterating the mentions to trigger a notification:
@kubernetes/sig-api-machinery-feature-requests

In response to this:

Adding @kubernetes/sig-api-machinery-feature-requests as discussed in the SIG instrumentation standup.

I will provide a sample based on Kubernetes event in next couple of days.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@tomkerkhove
Copy link
Contributor Author

I've had a quick sync with @duglin who would be able to give an introduction to CloudEvents (@clemensv might also join). Given the fact that the timing of the standup on 9th is not ideal and I don't want to hijack the whole meeting it might be good to do it in a separate call?

@brancz
Copy link
Member

brancz commented Dec 17, 2019

There are people involved in sig instrumentation spread all over the world, it's never ideal for everyone, I'd prefer not to deviate from normal meetings. As this isn't too pressing, what do you think about dedicating the meeting after that to this topic?

@tomkerkhove
Copy link
Contributor Author

That would be 23rd of January then? Fine for me, does that work for you @duglin?

@brancz
Copy link
Member

brancz commented Dec 17, 2019

Yes exactly the 23rd of January. If that works for you feel free to put it into the meeting notes already.

@tomkerkhove
Copy link
Contributor Author

Fine for me, will add if @duglin agrees as well.

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 27, 2020
@tomkerkhove
Copy link
Contributor Author

This won't work I guess, but can only try:

/remove-lifecycle stale

Eventually we'll get there, just need to have time to work out a POC.

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Apr 28, 2020
@duglin
Copy link

duglin commented Apr 28, 2020

https://www.youtube.com/watch?v=9uKm5pD7GWM :-)

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 27, 2020
@tomkerkhove
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jul 27, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 25, 2020
@ehashman
Copy link
Member

@tomkerkhove this needs a KEP, it can't be implemented in the scope of an issue so we can ensure this gets the necessarily visibility.

@tomkerkhove
Copy link
Contributor Author

Please ignore my ignorance but how does one write a KEP and do I need to understand the Kubernetes codebase?

@dims
Copy link
Member

dims commented Oct 27, 2020

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Nov 26, 2020
@tomkerkhove
Copy link
Contributor Author

/remove-lifecycle rotten

I'll write a KEP at some point

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Nov 26, 2020
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 24, 2021
@tomkerkhove
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 24, 2021
@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2021
@tomkerkhove
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 25, 2021
@serathius
Copy link
Contributor

/lifecycle frozen
That should help

@k8s-ci-robot k8s-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label May 25, 2021
@tomkerkhove
Copy link
Contributor Author

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/instrumentation Categorizes an issue or PR as relevant to SIG Instrumentation.
Projects
None yet
Development

No branches or pull requests