Documentation ¶
Index ¶
- Constants
- Variables
- func IsCI() bool
- func SetDefaultValues(c *viper.Viper)
- type BuilderConfig
- type CollectorConfig
- type EdgeBuilderConfig
- type FileCollectorConfig
- type JanusGraphConfig
- type K8SAPICollectorConfig
- type KubehoundConfig
- type MongoDBConfig
- type ProfilerConfig
- type StatsdConfig
- type StorageConfig
- type TelemetryConfig
- type TracerConfig
- type VertexBuilderConfig
Constants ¶
const ( DefaultEdgeWorkerPoolSize = 5 DefaultEdgeWorkerPoolCapacity = 100 DefaultEdgeBatchSize = 500 DefaultEdgeBatchSizeSmall = DefaultEdgeBatchSize / 5 DefaultEdgeBatchSizeClusterImpact = 10 DefaultVertexBatchSize = 500 )
const ( CollectorTypeFile = "file-collector" CollectorTypeK8sAPI = "live-k8s-api-collector" )
const ( DefaultK8sAPIPageSize int64 = 500 DefaultK8sAPIPageBufferSize int32 = 10 DefaultK8sAPIRateLimitPerSecond int = 100 )
const ( DefaultRetry int = 10 // number of tries before failing DefaultRetryDelay time.Duration = 10 * time.Second DefaultConnectionTimeout time.Duration = 30 * time.Second )
const ( DefaultProfilerPeriod time.Duration = 60 * time.Second DefaultProfilerCPUDuration time.Duration = 15 * time.Second )
const (
DefaultConfigType = "yaml"
)
const (
DefaultJanusGraphUrl = "ws://localhost:8182/gremlin"
)
const (
DefaultMongoUrl = "mongodb://localhost:27017"
)
Variables ¶
var (
BuildVersion string // This should be overwritten by the go build -X flags
)
Functions ¶
func SetDefaultValues ¶
SetDefaultValues loads the default value from the different modules
Types ¶
type BuilderConfig ¶
type BuilderConfig struct { Vertex VertexBuilderConfig `mapstructure:"vertex"` // Vertex builder config Edge EdgeBuilderConfig `mapstructure:"edge"` // Edge builder config }
type CollectorConfig ¶
type CollectorConfig struct { Type string `mapstructure:"type"` // Collector type File *FileCollectorConfig `mapstructure:"file"` // File collector specific configuration Live *K8SAPICollectorConfig `mapstructure:"live"` // File collector specific configuration }
CollectorConfig configures collector specific parameters.
type EdgeBuilderConfig ¶
type EdgeBuilderConfig struct { LargeClusterOptimizations bool `mapstructure:"large_cluster_optimizations"` WorkerPoolSize int `mapstructure:"worker_pool_size"` // Number of workers for the edge builder worker pool WorkerPoolCapacity int `mapstructure:"worker_pool_capacity"` // Work item capacity for the edge builder worker pool BatchSize int `mapstructure:"batch_size"` // Batch size for inserts BatchSizeSmall int `mapstructure:"batch_size_small"` // Batch size expensive inserts BatchSizeClusterImpact int `mapstructure:"batch_size_cluster_impact"` // Batch size for inserts impacting entire cluster e.g POD_PATCH }
EdgeBuilderConfig configures edge builder parameters.
type FileCollectorConfig ¶
type FileCollectorConfig struct {
Directory string `mapstructure:"directory"` // Base directory holding the K8s data JSON files
}
FileCollectorConfig configures the file collector.
type JanusGraphConfig ¶
type JanusGraphConfig struct { URL string `mapstructure:"url"` // JanusGraph specific configuration ConnectionTimeout time.Duration `mapstructure:"connection_timeout"` }
JanusGraphConfig configures JanusGraph specific parameters.
type K8SAPICollectorConfig ¶
type K8SAPICollectorConfig struct { PageSize int64 `mapstructure:"page_size"` // Number of entry being retrieving by each call on the API (same for all Kubernetes entry types) PageBufferSize int32 `mapstructure:"page_buffer_size"` // Number of pages to buffer RateLimitPerSecond int `mapstructure:"rate_limit_per_second"` // Rate limiting per second accross all calls (same for all kubernetes entry types) against the Kubernetes API }
K8SAPICollectorConfig configures the K8sAPI collector.
type KubehoundConfig ¶
type KubehoundConfig struct { Collector CollectorConfig `mapstructure:"collector"` // Collector configuration MongoDB MongoDBConfig `mapstructure:"mongodb"` // MongoDB configuration JanusGraph JanusGraphConfig `mapstructure:"janusgraph"` // JanusGraph configuration Storage StorageConfig `mapstructure:"storage"` // Global param for all storage provider Telemetry TelemetryConfig `mapstructure:"telemetry"` // telemetry configuration, contains statsd and other sub structures Builder BuilderConfig `mapstructure:"builder"` // Graph builder configuration }
KubehoundConfig defines the top-level application configuration for KubeHound.
func MustLoadConfig ¶
func MustLoadConfig(configPath string) *KubehoundConfig
MustLoadConfig loads the application configuration from the provided path, treating all errors as fatal.
func MustLoadEmbedConfig ¶
func MustLoadEmbedConfig() *KubehoundConfig
MustLoadEmbedConfig loads the embedded default application configuration, treating all errors as fatal.
func NewConfig ¶
func NewConfig(configPath string) (*KubehoundConfig, error)
NewConfig creates a new config instance from the provided file using viper.
func NewEmbedConfig ¶
func NewEmbedConfig(configPath string) (*KubehoundConfig, error)
NewEmbedConfig creates a new config instance from an embedded config file using viper.
type MongoDBConfig ¶
type MongoDBConfig struct { URL string `mapstructure:"url"` // Mongodb specific configuration ConnectionTimeout time.Duration `mapstructure:"connection_timeout"` }
MongoDBConfig configures mongodb specific parameters.
type ProfilerConfig ¶
type ProfilerConfig struct { Period time.Duration `mapstructure:"period"` CPUDuration time.Duration `mapstructure:"cpu_duration"` }
ProfilerConfig configures profiler specific parameters.
type StatsdConfig ¶
type StatsdConfig struct {
URL string `mapstructure:"url"` // Statsd endpoint URL
}
StatsdConfig configures statsd specific parameters.
type StorageConfig ¶
type TelemetryConfig ¶
type TelemetryConfig struct { Enabled bool `mapstructure:"enabled"` // Whether or not to enable Datadog telemetry Tags map[string]string `mapstructure:"tags"` // Free form tags to be added to all telemetry Statsd StatsdConfig `mapstructure:"statsd"` // Statsd configuration (for metrics) Tracer TracerConfig `mapstructure:"tracer"` // Tracer configuration (for APM) Profiler ProfilerConfig `mapstructure:"profiler"` // Profiler configuration }
type TracerConfig ¶
type TracerConfig struct {
URL string `mapstructure:"url"` // Tracer endpoint URL
}
TracerConfig configures tracer specific parameters.
type VertexBuilderConfig ¶
type VertexBuilderConfig struct {
BatchSize int `mapstructure:"batch_size"` // Batch size for inserts
}
VertexBuilderConfig configures vertex builder parameters.