Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

[WIP] Make KPNG more like a library and decouple from the GRPC API #389

Closed

Conversation

astoycos
Copy link
Contributor

@astoycos astoycos commented Oct 21, 2022

This is an attempt to make KPNG a bit more streamline and align with the following diagram

image

i.e It stops KPNG from ever encoding into protobuf and allows it to be used more like a library.

Specifically this PR adds a new job store2localinterface which passes services/Endpoints exprected node local state to a backend/consumer via a simple go interface.

The Existing flow (for a single process deployment looked like):

K8s API ---> kpng.ProxyStore ---> kpng.store2localdiff (uses the kpng.watchState package) -------[Data encoded to protobuff]-----> kpng.client.sink ------> backend

With the new job it looks something like this:

K8s API ---> kpng.ProxyStore ---> kpng.store2localinterface ----> backend interface

Please see the included example for more details :)

Also @mcluseau Please feel free to tell me if this makes no sense!!!!

Signed-off-by: Andrew Stoycos <[email protected]>
Add first attempt at exposing
a simple interface rather than
using GRPC and an API.

This new job analyzes the proxystore and returns
ENLS for the specified node via a golang
interface rather than the API.

It removes the extra protobuff marshelling that
happens as part of the store2localdiff job
and allows KPNG to be used as a true library
(see example) rather than a daemon.

Signed-off-by: Andrew Stoycos <[email protected]>
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 21, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: astoycos

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 21, 2022
@astoycos astoycos changed the title [WIP] Refactor sink interface [WIP] Become more like a library Oct 21, 2022
@astoycos
Copy link
Contributor Author

/assign @mcluseau @jayunit100

@astoycos astoycos changed the title [WIP] Become more like a library [WIP] Make KPNG more like a library and decouple from the GRPC API Oct 21, 2022
@@ -21,14 +21,14 @@ import (
proxystore "sigs.k8s.io/kpng/server/proxystore"
)

type eventHandler struct {
type kpngEventHandler struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

why prefix an internal type with the project's name, or any part of the package path btw?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed :)

}

type NodeLocalStateConsumer interface {
UpdateServices(services <-chan *localnetv1.Service)
Copy link
Contributor

Choose a reason for hiding this comment

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

what about just 1 stream with the Op object but made for internal use, like:

type Op struct {
  Sync bool // when it's a sync signal
  
  Set localnetv1.Set
  Path string
  Delete bool
  
  // 1st option:
  Value any
  // 2nd option
  Service *localnetv1.Service
  Endpoint *localnetv1.EndpointInfo
}

Copy link
Contributor

Choose a reason for hiding this comment

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

also, if we're speaking internal / same memory space, is forcing a diff the way? We could nearly give the lightdiffstore instances, or maybe just a fullstate-like primary interface that could then be fed to the lightdiffstore in watchstate / the Local gRPC API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

1 stream with the Op object

Are you referring to an unidirectional GRPC stream here or just the golang struct? Sorry getting overloaded with terms :)

I'm fine with anything on the design of the transfer interface (struct interface etc) and just took the inspiration from Tim's Slides and this ancient comment from the KEP lol

My end goal here is that it's super simple for folks to write backends, with or without any GRPC knowledge/familiarity.

also, if we're speaking internal / same memory space, is forcing a diff the way?

I'm not sure :) from an ease of use if we force the diff, or add the option to, then it takes the overhead of having to learn how to use a new library off of the user which IMO is a good thing?

and if we're diffing ENLS I don't think it matters whether we do it before or after passing data to the user, from a scale concern at least.

We could nearly give the lightdiffstore instances, or maybe just a fullstate-like primary interface that could then be fed to the lightdiffstore in watchstate / the Local gRPC API

Totally... I'm not against that either, however I think collapsing some of the modules(watchstate/fullstate) into a single one wouldn't be the worse thing? It took me quite some time to dig in and understand all the various pieces modules (and where they live)

@mcluseau
Copy link
Contributor

mcluseau commented Oct 24, 2022 via email

@astoycos
Copy link
Contributor Author

Awesome thanks for all the feedback, sorry my bandwidth has been limited while at kubecon, Let me take a stab at this and I'll keep asking questions here.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 4, 2022
@k8s-ci-robot
Copy link
Contributor

@astoycos: PR needs rebase.

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.

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please 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 2, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 Mar 4, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants