zedrouter

package
v0.0.0-...-a6598b8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 49 Imported by: 0

Documentation

Index

Constants

View Source
const AppInstMetadataResponseSizeLimitInBytes = 35840 // 35KB

AppInstMetadataResponseSizeLimitInBytes holds the maximum expected size of appInst metadata received in the response. Note: KubeconfigFileSizeLimitInBytes should always be < AppInstMetadataResponseSizeLimitInBytes.

View Source
const DiagMaxSize = 65535

DiagMaxSize is the max returned size for diag

View Source
const KubeconfigFileSizeLimitInBytes = 32768 // 32KB

KubeconfigFileSizeLimitInBytes holds the maximum expected size of Kubeconfig file received from k3s server appInst. Note: KubeconfigFileSizeLimitInBytes should always be < AppInstMetadataResponseSizeLimitInBytes.

View Source
const MetaDataServerIP = "169.254.169.254"

MetaDataServerIP is IP of meta data server

View Source
const PatchEnvelopeURLPath = "/eve/v1/patch/"

PatchEnvelopeURLPath is route used for patch envelopes it is used in URL composing of patch envelopes

View Source
const SignerMaxSize = 65535

SignerMaxSize is how large objects we will sign

Variables

View Source
var Version = "No version specified"

Version is set from Makefile

Functions

func HandlePatchDescription

func HandlePatchDescription(z *zedrouter) func(http.ResponseWriter, *http.Request)

HandlePatchDescription returns Patch Envelopes available for app instance

func HandlePatchDownload

func HandlePatchDownload(z *zedrouter) func(http.ResponseWriter, *http.Request)

HandlePatchDownload serves binary artifacts of specified patch envelope to app instance. Patch envelope id is specified in URL. All artifacts are compressed to a zip archive

func HandlePatchFileDownload

func HandlePatchFileDownload(z *zedrouter) func(http.ResponseWriter, *http.Request)

HandlePatchFileDownload serves binary artifact of specified patch envelope to app instance. Patch envelope id and file name is specified in URL.

func Run

func Run(ps *pubsub.PubSub, logger *logrus.Logger, log *base.LogObject, args []string) int

func WithPatchEnvelopesByIP

func WithPatchEnvelopesByIP(z *zedrouter) func(http.Handler) http.Handler

WithPatchEnvelopesByIP is a middleware for Patch Envelopes which adds to a context patchEnvelope variable containing available patch envelopes for given IP address (it gets resolved to app instance UUID) in case there is no patch envelopes available it returns StatusNoContent

Types

type AppCustomBlobsHandler

type AppCustomBlobsHandler struct {
	// contains filtered or unexported fields
}

AppCustomBlobsHandler serves the AppCustom binary blobs

func (AppCustomBlobsHandler) ServeHTTP

func (hdl AppCustomBlobsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AppInfoHandler

type AppInfoHandler struct {
	// contains filtered or unexported fields
}

AppInfoHandler provides information about available patches for the application

func (AppInfoHandler) ServeHTTP

func (hdl AppInfoHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type PatchEnvelopes

type PatchEnvelopes struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PatchEnvelopes is a structure representing Patch Envelopes exposed to App instances via metadata server for more info check docs/PATCH-ENVELOPES.md Must be created by calling NewPatchEnvelopes()

Internally, PatchEnvelopes structure stores envelopes which come from EdgeDevConfig parsed by zedagent. This envelopes contains both inline binary artifacts which are ready to be downloaded by app instances and volume references, which are handled by volumemgr. So PatchEnvelopes struct has completedVolumes and contentTreeStatus to store information of all volumes and contentTree handled by volumemgr to link them with patch envelope volume references. ContentTreeStatus is used to retrieve SHA of underlying file. App instances are accessing PatchEnvelopes via metadata server handlers, which is calling PatchEnvelopes.Get() method to get list of available PatchEnvelopeInfo to certain App Instance which are stored in currentState. PatchEnvelopes also hasupdateStateNotificationCh channel to receive notification about the need of updating specified PatchEnvelopes. updateStateNotificationCh has length of 1, so update queue will never pile up. When updating state, we iterate through all envelopes, and remove envelopes which are marked in envelopesToDelete boolean map (set). NewPatchEnvelopes() starts goroutine processStateUpdate() which reads from the channel and updates currentState to desired one. In addition, this goroutine publishes status for every PatchEnvelope via pubsub. Note that PatchEnvelopes does not create PubSub, rather used one provided to NewPatchEnvelopes() So it does not have a agentName, but could easily be split into one if needed This way handlers can do work of determining which patch envelopes actually need change (if any) and send back in go routine rest of the update including slow work. Note that this channels are only accessible from the outside by calling a function which returns write-only channel, meaning that updateStateNotificationCh should not be read from anywhere except processStateUpdate() so that there could not be any deadlock.

func NewPatchEnvelopes

func NewPatchEnvelopes(log *base.LogObject, ps *pubsub.PubSub) *PatchEnvelopes

NewPatchEnvelopes returns PatchEnvelopes structure and starts goroutine to process notifications from channel. Note that we create buffered channel to avoid unbounded processing time in writing to channel

func (*PatchEnvelopes) EnvelopesInUsage

func (pes *PatchEnvelopes) EnvelopesInUsage() []string

EnvelopesInUsage returns list of currently patch envelopes currently attached to app instances

func (*PatchEnvelopes) Get

Get returns list of Patch Envelopes available for this app instance

func (*PatchEnvelopes) UpdateContentTree

func (pes *PatchEnvelopes) UpdateContentTree(ct types.ContentTreeStatus, deleteCt bool)

UpdateContentTree adds or removes ContentTreeStatus from PatchEnvelopes structure marks PatchEnvelopes which will require update. Update will happen explicitly after sending notification to updateStateNotificationCh

func (*PatchEnvelopes) UpdateEnvelopes

func (pes *PatchEnvelopes) UpdateEnvelopes(peInfo []types.PatchEnvelopeInfo)

UpdateEnvelopes sets pes.envelopes and marks envelopes that are not present in new peInfo as ones to be deleted and updates the rest of them all of the updates will happen after notification to updateStateNotificationCh will be sent

func (*PatchEnvelopes) UpdateStateNotificationCh

func (pes *PatchEnvelopes) UpdateStateNotificationCh() chan<- struct{}

UpdateStateNotificationCh return update channel to send notifications to update currentState

func (*PatchEnvelopes) UpdateVolumeStatus

func (pes *PatchEnvelopes) UpdateVolumeStatus(vs types.VolumeStatus, deleteVolume bool)

UpdateVolumeStatus adds or removes VolumeStatus from PatchEnvelopes structure

type RPCServer

type RPCServer struct {
	// contains filtered or unexported fields
}

RPCServer receives RPC calls from eve-bridge CNI and dispatches them to the main event loop of zedrouter.

func (*RPCServer) CheckPodConnection

func (h *RPCServer) CheckPodConnection(
	args cnirpc.CheckPodConnectionArgs, retval *cnirpc.CheckPodConnectionRetval) error

CheckPodConnection : check if the given connection between pod and network instance is configured successfully.

func (*RPCServer) ConnectPodAtL2

func (h *RPCServer) ConnectPodAtL2(
	args cnirpc.ConnectPodAtL2Args, retval *cnirpc.ConnectPodAtL2Retval) error

ConnectPodAtL2 : establish L2 connection between pod and network instance.

func (*RPCServer) ConnectPodAtL3

func (h *RPCServer) ConnectPodAtL3(
	args cnirpc.ConnectPodAtL3Args, retval *cnirpc.ConnectPodAtL3Retval) error

ConnectPodAtL3 : establish L3 connection between pod and network instance. Typically, it is used after ConnectPodAtL2 to elevate existing L2 connection into L3 by applying the submitted IP settings.

func (*RPCServer) DisconnectPod

func (h *RPCServer) DisconnectPod(
	args cnirpc.DisconnectPodArgs, retval *cnirpc.DisconnectPodRetval) error

DisconnectPod : un-configure the given connection between pod and network instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL