config

package
v0.2.224 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadClusterConfig

func LoadClusterConfig() (utilsmetadata.ClusterConfig, error)

func ValidateConfig

func ValidateConfig(config IConfig) error

Types

type Capabilities

type Capabilities struct {
	ConfigurationScan    string `json:"configurationScan"`
	ContinuousScan       string `json:"continuousScan"`
	NetworkGenerator     string `json:"networkGenerator"`
	NodeScan             string `json:"nodeScan"`
	Otel                 string `json:"otel"`
	Relevancy            string `json:"relevancy"`
	RuntimeObservability string `json:"runtimeObservability"`
	NodeSbomGeneration   string `json:"nodeSbomGeneration"`
	Seccomp              string `json:"seccomp"`
	VulnerabilityScan    string `json:"vulnerabilityScan"`
	AdmissionController  string `json:"admissionController"`
	RiskAcceptance       string `json:"riskAcceptance"`
	SBOMExport           string `json:"sbomExport"`
}

type CapabilitiesConfig

type CapabilitiesConfig struct {
	Capabilities      Capabilities      `mapstructure:"capabilities"`
	Components        Components        `mapstructure:"components"`
	Configurations    Configurations    `mapstructure:"configurations"`
	ServiceScanConfig ServiceScanConfig `mapstructure:"serviceScanConfig"`
}

func LoadCapabilitiesConfig

func LoadCapabilitiesConfig(path string) (CapabilitiesConfig, error)

type Component

type Component struct {
	Enabled bool `json:"enabled"`
}

type Components

type Components struct {
	HostScanner        Component `mapstructure:"hostScanner"`
	Kubescape          Component `mapstructure:"kubescape"`
	KubescapeScheduler Component `mapstructure:"kubescapeScheduler"`
	Kubevuln           Component `mapstructure:"kubevuln"`
	KubevulnScheduler  Component `mapstructure:"kubevulnScheduler"`
	NodeAgent          Component `mapstructure:"nodeAgent"`
	Operator           Component `mapstructure:"operator"`
	OtelCollector      Component `mapstructure:"otelCollector"`
	Persistence        Component `mapstructure:"persistence"`
	ServiceDiscovery   Component `mapstructure:"serviceDiscovery"`
	Storage            Component `mapstructure:"storage"`
}

type Config

type Config struct {
	ExcludeControls              []string      `mapstructure:"excludeControls"`
	NamespaceFilterConfigMapName string        `mapstructure:"namespaceFilterConfigMapName"`
	Namespace                    string        `mapstructure:"namespace"`
	RestAPIPort                  string        `mapstructure:"port"`
	RestAPIBindAddress           string        `mapstructure:"bindAddress"`
	CleanUpRoutineInterval       time.Duration `mapstructure:"cleanupDelay"`
	ConcurrencyWorkers           int           `mapstructure:"workerConcurrency"`
	TriggerSecurityFramework     bool          `mapstructure:"triggerSecurityFramework"`
	MatchingRulesFilename        string        `mapstructure:"matchingRulesFilename"`
	// EventDeduplicationInterval is the interval during which duplicate events will be silently dropped from processing via continuous scanning
	EventDeduplicationInterval time.Duration                 `mapstructure:"eventDeduplicationInterval"`
	HTTPExporterConfig         *exporters.HTTPExporterConfig `mapstructure:"httpExporterConfig"`
	ExcludeNamespaces          []string                      `mapstructure:"excludeNamespaces"`
	IncludeNamespaces          []string                      `mapstructure:"includeNamespaces"`
	ExcludeNamespacesRegex     []string                      `mapstructure:"excludeNamespacesRegex"`
	IncludeNamespacesRegex     []string                      `mapstructure:"includeNamespacesRegex"`
	// PodScanGuardTime specifies the minimum age a pod without a parent must have before it is scanned
	PodScanGuardTime              time.Duration                  `mapstructure:"podScanGuardTime"`
	RegistryScanningSkipTlsVerify bool                           `mapstructure:"registryScanningSkipTlsVerify"`
	RegistryScanningInsecure      bool                           `mapstructure:"registryScanningInsecure"`
	ExcludeJsonPaths              []string                       `mapstructure:"excludeJsonPaths"`
	RulesUpdateConfig             rulesupdate.RulesUpdaterConfig `mapstructure:"rulesUpdateConfig"`
	SkipProfilesWithoutInstances  bool                           `mapstructure:"skipProfilesWithoutInstances"`
	NodeAgentAutoscaler           NodeAgentAutoscalerConfig      `mapstructure:"nodeAgentAutoscaler"`
	SBOMExport                    SBOMExportConfig               `mapstructure:"sbomExport"`
}

func LoadConfig

func LoadConfig(path string) (Config, error)

LoadConfig reads config.json from path over the defaults set here.

type Configurations

type Configurations struct {
	Persistence string `json:"persistence"`
	Server      Server `json:"server"`
}

type DTCollectionConfig added in v0.2.220

type DTCollectionConfig struct {
	Name    string `mapstructure:"name"`
	Version string `mapstructure:"version"`
	// Create lets the exporter create the project when it is missing. Without
	// it the project must exist, and the exporter never changes it.
	Create bool `mapstructure:"create"`
}

DTCollectionConfig is a collection project: the root, or an image's parent.

type DTProjectConfig added in v0.2.220

type DTProjectConfig struct {
	Name    string             `mapstructure:"name"`
	Version string             `mapstructure:"version"`
	Parent  DTCollectionConfig `mapstructure:"parent"`
}

DTProjectConfig is the project an image is uploaded to, and its parent.

type DependencyTrackConfig added in v0.2.220

type DependencyTrackConfig struct {
	// URL is the base URL of the Dependency-Track API server.
	URL string `mapstructure:"url"`
	// APIKeyFile is the file the API key is read from, on every request, so a
	// rotated Secret needs no restart.
	APIKeyFile string `mapstructure:"apiKeyFile"`
	// RootProject is where the exporter creates the parents it creates.
	RootProject DTCollectionConfig `mapstructure:"rootProject"`
	// Project is the project of one image in one namespace.
	Project DTProjectConfig `mapstructure:"project"`
}

DependencyTrackConfig is where the exporter sends the SBOMs, and where in Dependency-Track's project tree they go. Names and versions are Go templates over the cluster, the namespace, its labels, and the image's repository and tag; Namespace annotations can override them.

type IConfig

type IConfig interface {
	Namespace() string
	AccountID() string
	AccessKey() string
	ClusterName() string
	ConcurrencyWorkers() int
	Components() Components
	AdmissionControllerEnabled() bool
	ContinuousScanEnabled() bool
	NodeSbomGenerationEnabled() bool
	RiskAcceptanceEnabled() bool
	SBOMExportEnabled() bool
	SBOMExportConfig() SBOMExportConfig
	CleanUpRoutineInterval() time.Duration
	MatchingRulesFilename() string
	TriggerSecurityFramework() bool
	KubescapeURL() string
	KubevulnURL() string
	SkipNamespace(ns string) bool
	GuardTime() time.Duration
	RegistryScanningSkipTlsVerify() bool
	RegistryScanningInsecure() bool
	ExcludeJsonPaths() []string
	SkipProfilesWithoutInstances() bool
	RulesUpdateEnabled() bool
	NodeAgentAutoscalerConfig() NodeAgentAutoscalerConfig
	// DefaultFrameworks returns install-time posture frameworks from clusterData.
	// Empty means callers should keep their legacy fallback (e.g. "all" or the native trio).
	DefaultFrameworks() []string
	ExcludeControls() []string
}

IConfig is an interface for all config types used in the operator

type NodeAgentAutoscalerConfig added in v0.2.121

type NodeAgentAutoscalerConfig struct {
	Enabled        bool   `json:"enabled" mapstructure:"enabled"`
	NodeGroupLabel string `json:"nodeGroupLabel" mapstructure:"nodeGroupLabel"`
	// DefaultNodeGroup is the group value assigned to nodes that do not carry the
	// NodeGroupLabel. This ensures a node-agent DaemonSet is still deployed on such
	// nodes (e.g. on-prem or custom clusters that do not populate the label).
	// If set to an empty string, nodes without the label are skipped.
	DefaultNodeGroup       string                                 `json:"defaultNodeGroup" mapstructure:"defaultNodeGroup"`
	ResourcePercentages    NodeAgentAutoscalerResourcePercentages `json:"resourcePercentages" mapstructure:"resourcePercentages"`
	MinResources           NodeAgentAutoscalerResourceBounds      `json:"minResources" mapstructure:"minResources"`
	MaxResources           NodeAgentAutoscalerResourceBounds      `json:"maxResources" mapstructure:"maxResources"`
	ReconcileInterval      time.Duration                          `json:"reconcileInterval" mapstructure:"reconcileInterval"`
	TemplatePath           string                                 `json:"templatePath" mapstructure:"templatePath"`
	OperatorDeploymentName string                                 `json:"operatorDeploymentName" mapstructure:"operatorDeploymentName"`
	GoMemLimitPercentage   float64                                `json:"goMemLimitPercentage" mapstructure:"goMemLimitPercentage"`
	// SELinuxType is the SELinux type applied to node-agent DaemonSets the
	// autoscaler renders for node groups that are NOT Bottlerocket. Sourced from
	// the chart's nodeAgent.seLinuxType (default "spc_t"). Bottlerocket groups
	// always override this with "super_t" when BottlerocketAutoDetect is enabled.
	SELinuxType string `json:"seLinuxType" mapstructure:"seLinuxType"`
	// BottlerocketAutoDetect, when true, makes the autoscaler detect AWS
	// Bottlerocket nodes and render their node group's DaemonSet with the
	// "super_t" SELinux type automatically. Set false to disable detection.
	BottlerocketAutoDetect bool `json:"bottlerocketAutoDetect" mapstructure:"bottlerocketAutoDetect"`
}

NodeAgentAutoscalerConfig defines the configuration for node agent autoscaling

type NodeAgentAutoscalerResourceBounds added in v0.2.121

type NodeAgentAutoscalerResourceBounds struct {
	CPU    string `json:"cpu" mapstructure:"cpu"`
	Memory string `json:"memory" mapstructure:"memory"`
}

NodeAgentAutoscalerResourceBounds defines min/max resource bounds

type NodeAgentAutoscalerResourcePercentages added in v0.2.121

type NodeAgentAutoscalerResourcePercentages struct {
	RequestCPU    int `json:"requestCPU" mapstructure:"requestCPU"`
	RequestMemory int `json:"requestMemory" mapstructure:"requestMemory"`
	LimitCPU      int `json:"limitCPU" mapstructure:"limitCPU"`
	LimitMemory   int `json:"limitMemory" mapstructure:"limitMemory"`
}

NodeAgentAutoscalerResourcePercentages defines the resource percentages for autoscaling

type OperatorConfig

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

OperatorConfig implements IConfig

func NewOperatorConfig

func NewOperatorConfig(components CapabilitiesConfig, clusterConfig utilsmetadata.ClusterConfig, creds *utils.Credentials, serviceConfig Config) (*OperatorConfig, error)

func (*OperatorConfig) AccessKey

func (c *OperatorConfig) AccessKey() string

func (*OperatorConfig) AccountID

func (c *OperatorConfig) AccountID() string

func (*OperatorConfig) AdmissionControllerEnabled added in v0.2.31

func (c *OperatorConfig) AdmissionControllerEnabled() bool

func (*OperatorConfig) CleanUpRoutineInterval

func (c *OperatorConfig) CleanUpRoutineInterval() time.Duration

func (*OperatorConfig) ClusterName

func (c *OperatorConfig) ClusterName() string

func (*OperatorConfig) Components

func (c *OperatorConfig) Components() Components

func (*OperatorConfig) ConcurrencyWorkers

func (c *OperatorConfig) ConcurrencyWorkers() int

func (*OperatorConfig) ContinuousScanEnabled

func (c *OperatorConfig) ContinuousScanEnabled() bool

func (*OperatorConfig) DefaultFrameworks added in v0.2.161

func (c *OperatorConfig) DefaultFrameworks() []string

func (*OperatorConfig) ExcludeControls added in v0.2.186

func (c *OperatorConfig) ExcludeControls() []string

func (*OperatorConfig) ExcludeJsonPaths added in v0.2.88

func (c *OperatorConfig) ExcludeJsonPaths() []string

func (*OperatorConfig) ExcludeNamespaces added in v0.2.181

func (c *OperatorConfig) ExcludeNamespaces() []string

func (*OperatorConfig) ExcludeNamespacesRegex added in v0.2.181

func (c *OperatorConfig) ExcludeNamespacesRegex() []string

func (*OperatorConfig) GuardTime added in v0.2.31

func (c *OperatorConfig) GuardTime() time.Duration

func (*OperatorConfig) HttpExporterConfig added in v0.2.31

func (c *OperatorConfig) HttpExporterConfig() *exporters.HTTPExporterConfig

func (*OperatorConfig) IncludeNamespaces added in v0.2.181

func (c *OperatorConfig) IncludeNamespaces() []string

func (*OperatorConfig) IncludeNamespacesRegex added in v0.2.181

func (c *OperatorConfig) IncludeNamespacesRegex() []string

func (*OperatorConfig) KubescapeURL

func (c *OperatorConfig) KubescapeURL() string

func (*OperatorConfig) KubevulnURL

func (c *OperatorConfig) KubevulnURL() string

func (*OperatorConfig) MatchingRulesFilename

func (c *OperatorConfig) MatchingRulesFilename() string

func (*OperatorConfig) Namespace

func (c *OperatorConfig) Namespace() string

func (*OperatorConfig) NodeAgentAutoscalerConfig added in v0.2.121

func (c *OperatorConfig) NodeAgentAutoscalerConfig() NodeAgentAutoscalerConfig

func (*OperatorConfig) NodeSbomGenerationEnabled added in v0.2.50

func (c *OperatorConfig) NodeSbomGenerationEnabled() bool

func (*OperatorConfig) RegistryScanningInsecure added in v0.2.82

func (c *OperatorConfig) RegistryScanningInsecure() bool

func (*OperatorConfig) RegistryScanningSkipTlsVerify added in v0.2.82

func (c *OperatorConfig) RegistryScanningSkipTlsVerify() bool

func (*OperatorConfig) RiskAcceptanceEnabled added in v0.2.158

func (c *OperatorConfig) RiskAcceptanceEnabled() bool

RiskAcceptanceEnabled reports whether the riskAcceptance capability is on. The SecurityException watcher must gate on this because the operator's RBAC for securityexceptions/clustersecurityexceptions is only granted by the Helm chart when riskAcceptance is enabled — starting the watcher otherwise yields a permission-denied watch loop with no rescans.

func (*OperatorConfig) RulesUpdateEnabled added in v0.2.119

func (c *OperatorConfig) RulesUpdateEnabled() bool

func (*OperatorConfig) SBOMExportConfig added in v0.2.220

func (c *OperatorConfig) SBOMExportConfig() SBOMExportConfig

SBOMExportConfig returns where and how often to export SBOMs.

func (*OperatorConfig) SBOMExportEnabled added in v0.2.220

func (c *OperatorConfig) SBOMExportEnabled() bool

SBOMExportEnabled reports whether the sbomExport capability is on.

func (*OperatorConfig) SkipNamespace added in v0.2.31

func (c *OperatorConfig) SkipNamespace(ns string) bool

func (*OperatorConfig) SkipProfilesWithoutInstances added in v0.2.108

func (c *OperatorConfig) SkipProfilesWithoutInstances() bool

func (*OperatorConfig) TriggerSecurityFramework

func (c *OperatorConfig) TriggerSecurityFramework() bool

func (*OperatorConfig) UpdateNamespaceFilters added in v0.2.181

func (c *OperatorConfig) UpdateNamespaceFilters(data []byte) (bool, error)

UpdateNamespaceFilters validates a complete document before atomically replacing the active filters. It returns whether the filter content changed.

type SBOMExportConfig added in v0.2.220

type SBOMExportConfig struct {
	// ResyncInterval is how often the exporter compares what runs in the
	// cluster with what Dependency-Track holds.
	ResyncInterval time.Duration `mapstructure:"resyncInterval"`
	// MaxSBOMSize is the largest SBOM, in bytes, the exporter converts; larger
	// ones are skipped, which bounds the operator's memory.
	MaxSBOMSize     int64                 `mapstructure:"maxSBOMSize"`
	DependencyTrack DependencyTrackConfig `mapstructure:"dependencyTrack"`
}

SBOMExportConfig configures the export of node SBOMs to Dependency-Track, turned on by the sbomExport capability.

type Server

type Server struct {
	Account      string `json:"account"`
	DiscoveryURL string `json:"discoveryUrl"`
	OtelURL      string `json:"otelUrl"`
}

type ServiceScanConfig added in v0.2.31

type ServiceScanConfig struct {
	Enabled  bool          `json:"enabled"`
	Interval time.Duration `json:"interval"`
}

Jump to

Keyboard shortcuts

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