Documentation
¶
Index ¶
- Constants
- func AgentCacheKey(agentID string) string
- func AgentSubjectVersionListCacheKey(agentID string) string
- func HeadersMiddleware() gin.HandlerFunc
- func PrometheusHandler() gin.HandlerFunc
- func SubjectVersionCacheKey(agentID, versionID string) string
- func SubjectVersionInfoCacheKey(agentID, versionID string) string
- type Config
- type ControlPlane
- func (cp *ControlPlane) AgentCacheReconcile()
- func (cp *ControlPlane) AgentGet() gin.HandlerFunc
- func (cp *ControlPlane) AgentListCacheReconcile()
- func (cp *ControlPlane) AgentsGet() gin.HandlerFunc
- func (cp *ControlPlane) AgentsPost() gin.HandlerFunc
- func (cp *ControlPlane) AgentsSubjectVersionGet() gin.HandlerFunc
- func (cp *ControlPlane) AgentsSubjectVersionsInfoGet() gin.HandlerFunc
- func (cp *ControlPlane) AuthMiddleware() gin.HandlerFunc
- func (cp *ControlPlane) CacheReconcile()
- func (cp *ControlPlane) Collect(ch chan<- prometheus.Metric)
- func (cp *ControlPlane) Describe(ch chan<- *prometheus.Desc)
- func (cp *ControlPlane) GetAgentCache(agentID string) (api.SubjectVersions, bool)
- func (cp *ControlPlane) GetAgentListCache() api.Agents
- func (cp *ControlPlane) GetAgentOverallVersionInfos(agentID string) ([]string, api.AgentVersionInfos)
- func (cp *ControlPlane) GetAgentSubjectVersionListCache(agentID string) []string
- func (cp *ControlPlane) GetOverallVersionInfos() []api.OverallVersionInfos
- func (cp *ControlPlane) GetSubjectVersionCache(agent, versionID string) (api.SubjectVersion, bool)
- func (cp *ControlPlane) GetSubjectVersionInfoCache(agentID, versionID string) (api.VersionInfos, bool)
- func (cp *ControlPlane) GetSubjectVersionInfos(agentID string, ver *api.SubjectVersion) (api.VersionInfos, error)
- func (cp *ControlPlane) LoggerMiddleware() gin.HandlerFunc
- func (cp *ControlPlane) MetricsMiddleware() gin.HandlerFunc
- func (cp *ControlPlane) OverviewGet() gin.HandlerFunc
- func (cp *ControlPlane) RecoveryWithLogger(stack bool) gin.HandlerFunc
- func (cp *ControlPlane) SetAgentCache(agentID string, subjectVersions api.SubjectVersions)
- func (cp *ControlPlane) SetAgentListCache(agents api.Agents)
- func (cp *ControlPlane) SetAgentSubjectVersionListCache(agentID string, list []string)
- func (cp *ControlPlane) SetSubjectVersionCache(agentID, versionID string, subjectVersion api.SubjectVersion)
- func (cp *ControlPlane) SetSubjectVersionInfoCache(agentID, versionID string, versionInfo api.VersionInfos)
- func (cp *ControlPlane) SetupRouter() *gin.Engine
- func (cp *ControlPlane) Start()
- func (cp *ControlPlane) SubjectVersionInfoCacheReconcile()
- func (cp *ControlPlane) UpdateAgentListCache(agentId string, agentTags map[string]string)
- func (cp *ControlPlane) UpdateAgentSubjectVersionsList(agentId, versionId string)
Constants ¶
const (
// holds the list of all the agents that have been registered with the control plane
AgentListCacheKey = "agents/list"
)
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 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) 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) 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)