WARNING: This repository is published by the Nephio Authors but is
neither endorsed nor maintained by the Nephio Technical Steering Committee (TSC). It is intended
to be used for reference only. The Nephio distribution repositories are located in the
nephio-project
organization. For more information
see this page.
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.
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 is a go module, build EdgeWatcher via:
make build
- import the EdgeWatcher module:
import (
edgewatcher "github.com/nephio-project/edge-watcher"
)
- 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)
}
}()
- Client then can subscribe to a particular event
subscribeReq := edgewatcher.SubscriptionReq{
...
}
To delete the CRDs from the cluster:
make uninstall
UnDeploy the controller to the cluster:
make undeploy
// TODO: Add detailed information on how you would like others to contribute to this project