kubernetes

package
v1.10.3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPolicyReportClient

func NewPolicyReportClient(
	client PolicyReportAdapter,
	store *report.PolicyReportStore,
	startUp time.Time,
	resultCache *cache.Cache,
) report.PolicyResultClient

NewPolicyReportClient creates a new PolicyReportClient based on the kubernetes go-client

Types

type ConfigMapAdapter

type ConfigMapAdapter interface {
	// GetConfig return a single ConfigMap by name if exist
	GetConfig(ctx context.Context, name string) (*apiv1.ConfigMap, error)
	// WatchConfigs calls its ConfigMapCallback whenever a ConfigMap was added, modified or deleted
	WatchConfigs(ctx context.Context, cb ConfigMapCallback) error
}

ConfigMapAdapter provides simplified APIs for ConfigMap Resources

func NewConfigMapAdapter

func NewConfigMapAdapter(api v1.ConfigMapInterface) ConfigMapAdapter

NewConfigMapAdapter creates a new ConfigMapClient

type ConfigMapCallback

type ConfigMapCallback = func(watch.EventType, *apiv1.ConfigMap)

ConfigMapCallback is used by WatchConfigs

type Mapper

type Mapper interface {
	// MapPolicyReport maps a map into a PolicyReport
	MapPolicyReport(reportMap map[string]interface{}) report.PolicyReport
	// SetPriorityMap updates the policy/status to priority mapping
	SetPriorityMap(map[string]string)
	// SyncPriorities when ConfigMap has changed
	SyncPriorities(ctx context.Context) error
	// FetchPriorities from ConfigMap
	FetchPriorities(ctx context.Context) error
}

Mapper converts maps into report structs

func NewMapper

func NewMapper(priorities map[string]string, cmAdapter ConfigMapAdapter) Mapper

NewMapper creates an new Mapper instance

type PolicyReportAdapter

type PolicyReportAdapter interface {
	WatchPolicyReports(ctx context.Context) (chan WatchEvent, error)
	GetFoundResources() map[string]string
}

PolicyReportAdapter translates API responses to an internal struct

func NewPolicyReportAdapter

func NewPolicyReportAdapter(dynamic dynamic.Interface, mapper Mapper) PolicyReportAdapter

NewPolicyReportAdapter new Adapter for Policy Report Kubernetes API

type WatchEvent

type WatchEvent struct {
	Report report.PolicyReport
	Type   watch.EventType
}

WatchEvent of PolicyReports

Jump to

Keyboard shortcuts

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