Giter Site home page Giter Site logo

radoslawc / edge-watcher Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nephio-experimental/edge-watcher

0.0 0.0 0.0 161 KB

A library containing gRPC server to watch over specific resources on workload clusters

License: Apache License 2.0

Go 99.00% Makefile 1.00%

edge-watcher's Introduction

EdgeWatcher

EdgeWatcher is a gRPC server which receives the current serialized state of Kubernetes objects from the WatcherAgent. It also exposes events for client (an example of a client is the deployment entity of NFDeploy Controller to subscribe to in getting status updates.

Description

EdgeWatcher

EdgeWatcher is a library which consists of a gRPC server to receive statuses from WatcherAgent from each of the workload clusters. It is currently utilized by the NFDeployment controller, where upon processing the NFDeployment CR, the deployment entity would create a gRPC server instance, and EdgeWatcher would be running to wait for a creation of a workload cluster (or just go through a list of currently running workload cluster), and sends a WatcherAgent CR to WatcherAgent running on the workload cluster. This CR will inform the resources which EdgeWatcher is requesting this WatcherAgent to watch, and the gRPC endpoint where that WatcherAgent will send status update to. EdgeWatcher also exposes a List/Watch Interface for client to subscribe to such that the client would be able to watch XXXDeployment objects on workload cluster. The following diagram depicts the relationship between EdgeWatcher and its client, and the WatcherAgents running on workload cluster:

EdgeWatcher and its relationship with client and WatcherAgents

Getting Started

EdgeWatcher is a go module, build EdgeWatcher via:

make build

from the client

  1. import the EdgeWatcher module:
import (
  edgewatcher "github.com/nephio-project/edge-watcher"
)
  1. instantiate the EdgeWatcher instance (as an example):
var edgeWatcherConfig edgewatcher.Params
edgeWatcherConfig.K8sDynamicClient, err = dynamic.NewForConfig(mgr.GetConfig())
edgeWatcherConfig.PorchClient = porch.NewClient(ctrl.Log.WithName("PorchClient"),
        porchclient, k8sRestClient)
edgeWatcherConfig.GRPCServer = grpc.NewServer(grpcOpts...)
ep, err := edgewatcher.New(ctx, edgewatcherLogger, edgeWatcherConfig,)

NOTE: client does have to manually run the gRPC server:

   go func() {
        err := edgeWatcherConfig.GRPCServer.Serve(lis)
        if err != nil {
            setupLog.Error(err, "starting grpc server failed")
            os.Exit(1)
        }
    }()
  1. Client then can subscribe to a particular event
subscribeReq := edgewatcher.SubscriptionReq{
...
}

Uninstall CRDs

To delete the CRDs from the cluster:

make uninstall

Undeploy controller

UnDeploy the controller to the cluster:

make undeploy

Contributing

// TODO: Add detailed information on how you would like others to contribute to this project

edge-watcher's People

Contributors

aravind254 avatar nephio-prow[bot] avatar s3wong avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.