controlplane

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2022 License: BSD-3-Clause Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// holds the list of all the agents that have been registered with the control plane
	AgentListCacheKey = "agents/list"
)
View Source
const (
	MissingLatest = "missing"
)

Variables

This section is empty.

Functions

func AgentCacheKey

func AgentCacheKey(agentID string) string

Cach key for storing all the versions recieved from an agent in format: agents/:agentID

func AgentSubjectVersionListCacheKey

func AgentSubjectVersionListCacheKey(agentID string) string

Cach key that holds list IDs of all the subjects that an agent has sent to the control plane :agentID/list

func HeadersMiddleware

func HeadersMiddleware() gin.HandlerFunc

func PrometheusHandler

func PrometheusHandler() gin.HandlerFunc

Metrics handler

func SubjectVersionCacheKey

func SubjectVersionCacheKey(agentID, versionID string) string

Cach key for each SubjectVersion recieved from an agent in format: :agentID/:versionID

func SubjectVersionInfoCacheKey

func SubjectVersionInfoCacheKey(agentID, versionID string) string

Cach key for versions information of a SubjectVersion after getting the remote versions :agentID/:versionID/versions

Types

type Config

type Config struct {
	BindAddr                string
	Token                   *string
	GithubConfig            *github.Config
	CacheExpiration         time.Duration
	CacheReconcilerInterval time.Duration
	LogHttpRequests         bool
	Logger                  logr.Logger
}

func (*Config) NewControlPlane

func (conf *Config) NewControlPlane() (*ControlPlane, error)

type ControlPlane

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

func (*ControlPlane) AgentCacheReconcile

func (cp *ControlPlane) AgentCacheReconcile()

func (*ControlPlane) AgentGet

func (cp *ControlPlane) AgentGet() gin.HandlerFunc

AgentGet handles GET requests to /agents/:id

func (*ControlPlane) AgentListCacheReconcile

func (cp *ControlPlane) AgentListCacheReconcile()

func (*ControlPlane) AgentsGet

func (cp *ControlPlane) AgentsGet() gin.HandlerFunc

AgentsGet handles GET requests to /agents

func (*ControlPlane) AgentsPost

func (cp *ControlPlane) AgentsPost() gin.HandlerFunc

AgentsPost handles POST requests to /agents

func (*ControlPlane) AgentsSubjectVersionGet

func (cp *ControlPlane) AgentsSubjectVersionGet() gin.HandlerFunc

AgentsSubjectVersionGet handles GET requests to /agents/:id/versionId:

func (*ControlPlane) AgentsSubjectVersionsInfoGet

func (cp *ControlPlane) AgentsSubjectVersionsInfoGet() gin.HandlerFunc

AgentsSubjectVersionGet handles GET requests to /agents/:id/versionId:/versions

func (*ControlPlane) AuthMiddleware

func (cp *ControlPlane) AuthMiddleware() gin.HandlerFunc

func (*ControlPlane) CacheReconcile

func (cp *ControlPlane) CacheReconcile()

func (*ControlPlane) Collect

func (cp *ControlPlane) Collect(ch chan<- prometheus.Metric)

func (*ControlPlane) Describe

func (cp *ControlPlane) Describe(ch chan<- *prometheus.Desc)

func (*ControlPlane) GetAgentCache

func (cp *ControlPlane) GetAgentCache(agentID string) (api.SubjectVersions, bool)

GetAgentCache gets the SubjectVersions for an agent from the AgentCacheKey path cache

func (*ControlPlane) GetAgentListCache

func (cp *ControlPlane) GetAgentListCache() api.Agents

func (*ControlPlane) GetAgentOverallVersionInfos

func (cp *ControlPlane) GetAgentOverallVersionInfos(agentID string) ([]string, api.AgentVersionInfos)

func (*ControlPlane) GetAgentSubjectVersionListCache

func (cp *ControlPlane) GetAgentSubjectVersionListCache(agentID string) []string

func (*ControlPlane) GetOverallVersionInfos

func (cp *ControlPlane) GetOverallVersionInfos() []api.OverallVersionInfos

func (*ControlPlane) GetSubjectVersionCache

func (cp *ControlPlane) GetSubjectVersionCache(agent, versionID string) (api.SubjectVersion, bool)

func (*ControlPlane) GetSubjectVersionInfoCache

func (cp *ControlPlane) GetSubjectVersionInfoCache(agentID, versionID string) (api.VersionInfos, bool)

func (*ControlPlane) GetSubjectVersionInfos

func (cp *ControlPlane) GetSubjectVersionInfos(agentID string, ver *api.SubjectVersion) (api.VersionInfos, error)

func (*ControlPlane) LoggerMiddleware

func (cp *ControlPlane) LoggerMiddleware() gin.HandlerFunc

func (*ControlPlane) MetricsMiddleware

func (cp *ControlPlane) MetricsMiddleware() gin.HandlerFunc

func (*ControlPlane) OverviewGet

func (cp *ControlPlane) OverviewGet() gin.HandlerFunc

OverviewGet handles GET requests to /overview

func (*ControlPlane) RecoveryWithLogger

func (cp *ControlPlane) RecoveryWithLogger(stack bool) gin.HandlerFunc

func (*ControlPlane) SetAgentCache

func (cp *ControlPlane) SetAgentCache(agentID string, subjectVersions api.SubjectVersions)

SetAgentCache put the subjectVersions in the cache in the AgentCacheKey path

func (*ControlPlane) SetAgentListCache

func (cp *ControlPlane) SetAgentListCache(agents api.Agents)

func (*ControlPlane) SetAgentSubjectVersionListCache

func (cp *ControlPlane) SetAgentSubjectVersionListCache(agentID string, list []string)

func (*ControlPlane) SetSubjectVersionCache

func (cp *ControlPlane) SetSubjectVersionCache(agentID, versionID string, subjectVersion api.SubjectVersion)

SetAgentCache sets the version in the agent payload in the cache

func (*ControlPlane) SetSubjectVersionInfoCache

func (cp *ControlPlane) SetSubjectVersionInfoCache(agentID, versionID string, versionInfo api.VersionInfos)

func (*ControlPlane) SetupRouter

func (cp *ControlPlane) SetupRouter() *gin.Engine

func (*ControlPlane) Start

func (cp *ControlPlane) Start()

func (*ControlPlane) SubjectVersionInfoCacheReconcile

func (cp *ControlPlane) SubjectVersionInfoCacheReconcile()

func (*ControlPlane) UpdateAgentListCache

func (cp *ControlPlane) UpdateAgentListCache(agentId string, agentTags map[string]string)

Check cache and update if necessary

func (*ControlPlane) UpdateAgentSubjectVersionsList

func (cp *ControlPlane) UpdateAgentSubjectVersionsList(agentId, versionId string)

Directories

Path Synopsis
api

Jump to

Keyboard shortcuts

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