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

add support for watch APIs #38

Merged
merged 1 commit into from
Oct 20, 2021
Merged

add support for watch APIs #38

merged 1 commit into from
Oct 20, 2021

Conversation

tanmaykm
Copy link
Member

This adds support for watch APIs.

Kubernetes provides efficient change notifications on resources via "watches". Certain entities have the special watch APIs defined for them and that can be invoked with the watch verb. The watch API accepts a Channel through which it streams events.

watch(ctx::KuberContext, T::Symbol, outstream::Channel, args...; kwargs...)

In addition, verbs like get and list also support watches, and those can be invoked as:

watch(ctx, verb, args...; kwargs...) do stream
    for event in stream
        # process event
    end
end

E.g.:

watch(ctx, list, :Pod; resourceVersion=19451) do stream
    for event in stream
        @info("got event", event)
    end
end

This adds support for `watch` APIs.

Kubernetes provides efficient change notifications on resources via "watches". Certain entities have the special `watch` APIs defined for them and that can be invoked with the `watch` verb. The `watch` API accepts a `Channel` through which it streams events.

```julia
watch(ctx::KuberContext, T::Symbol, outstream::Channel, args...; kwargs...)
```

In addition, verbs like `get` and `list` also support watches, and those can be invoked as:

```julia
watch(ctx, verb, args...; kwargs...) do stream
    for event in stream
        # process event
    end
end
```

E.g.:

```julia
watch(ctx, list, :Pod; resourceVersion=19451) do stream
    for event in stream
        @info("got event", event)
    end
end
```
@tanmaykm tanmaykm merged commit bc67930 into master Oct 20, 2021
@delete-merged-branch delete-merged-branch bot deleted the tan/misc branch October 20, 2021 04:50
@tanmaykm tanmaykm mentioned this pull request Oct 20, 2021
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.

1 participant