agent

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: Apache-2.0 Imports: 32 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitAgentCmdFlags added in v1.0.0

func InitAgentCmdFlags(c *cobra.Command, cfg *AgentCmdFlags)

func Run

func Run(cmd *cobra.Command, args []string)

Run starts the agent process

Types

type AgentCmdFlags added in v1.0.0

type AgentCmdFlags struct {
	// ConfigFilePath (--config-file, -c) is the path to the agent configuration
	// YAML file.
	ConfigFilePath string

	// Period (--period, -p) is the time waited between scans.
	Period time.Duration

	// OneShot (--one-shot) flag causes agent to run once.
	OneShot bool

	// VenafiCloudMode (--venafi-cloud) determines which format to load for
	// config and credential type.
	VenafiCloudMode bool

	// ClientID (--client-id) is the clientID in case of Venafi Cloud mode.
	ClientID string

	// PrivateKeyPath (--private-key-path) is the path for the service account
	// private key in case of Venafi Cloud mode.
	PrivateKeyPath string

	// CredentialsPath (--credentials-file, -k) is the path to the credentials )
	// is where the agent will try to loads the credentials (Experimental).
	CredentialsPath string

	// OutputPath (--output-path) is where the agent will write data to instead
	// of uploading to server.
	OutputPath string

	// InputPath (--input-path) is where the agent will read data from instead
	// of gathering data from clusters.
	InputPath string

	// BackoffMaxTime (--backoff-max-time) is the maximum time for which data
	// gatherers will retry after a failure.
	BackoffMaxTime time.Duration

	// StrictMode (--strict) causes the agent to fail at the first attempt.
	StrictMode bool

	// APIToken (--api-token) is an authentication token used for the backend
	// API as an alternative to OAuth flows.
	APIToken string

	// VenConnName (--venafi-connection) is the name of the VenafiConnection
	// resource to use. Using this flag will enable Venafi Connection mode.
	VenConnName string

	// VenConnNS (--venafi-connection-namespace) is the namespace of the
	// VenafiConnection resource to use. It is only useful when the
	// VenafiConnection isn't in the same namespace as the agent.
	//
	// May be left empty to use the same namespace as the agent.
	VenConnNS string

	// InstallNS (--install-namespace) is the namespace in which the agent is
	// running in. Only needed when running the agent outside of Kubernetes.
	//
	// May be left empty when running in Kubernetes. In this case, the namespace
	// is read from the file
	// /var/run/secrets/kubernetes.io/serviceaccount/namespace.
	InstallNS string

	// Profiling (--enable-pprof) enables the pprof server.
	Profiling bool

	// Prometheus (--enable-metrics) enables the Prometheus metrics server.
	Prometheus bool
}
var Flags AgentCmdFlags

type Config

type Config struct {
	Schedule string        `yaml:"schedule"`
	Period   time.Duration `yaml:"period"`
	// Deprecated: Endpoint is being replaced with Server.
	Endpoint Endpoint `yaml:"endpoint"`
	// Server is the base url for the Preflight server.
	// It defaults to https://preflight.jetstack.io.
	Server string `yaml:"server"`
	// OrganizationID within Preflight that will receive the data.
	OrganizationID string `yaml:"organization_id"`
	// ClusterID is the cluster that the agent is scanning.
	ClusterID          string         `yaml:"cluster_id"`
	ClusterDescription string         `yaml:"cluster_description"`
	DataGatherers      []DataGatherer `yaml:"data-gatherers"`
	// InputPath replaces DataGatherers with input data file
	InputPath string `yaml:"input-path"`
	// OutputPath replaces Server with output data file
	OutputPath  string             `yaml:"output-path"`
	VenafiCloud *VenafiCloudConfig `yaml:"venafi-cloud,omitempty"`
}

Config wraps the options for a run of the agent.

func ParseConfig

func ParseConfig(data []byte, isVenafiCloudMode bool) (Config, error)

ParseConfig reads config into a struct used to configure running agents

func (*Config) Dump

func (c *Config) Dump() (string, error)

Dump generates a YAML string of the Config object

type DataGatherer added in v0.1.32

type DataGatherer struct {
	Kind     string `yaml:"kind"`
	Name     string `yaml:"name"`
	DataPath string `yaml:"data_path"`
	Config   datagatherer.Config
}

func (*DataGatherer) UnmarshalYAML added in v0.1.32

func (dg *DataGatherer) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML unmarshals a dataGatherer resolving the type according to Kind.

type Endpoint

type Endpoint struct {
	Protocol string `yaml:"protocol"`
	Host     string `yaml:"host"`
	Path     string `yaml:"path"`
}

type VenafiCloudConfig added in v0.1.40

type VenafiCloudConfig struct {
	// UploaderID is the upload ID that will be used when
	// creating a cluster connection
	UploaderID string `yaml:"uploader_id,omitempty"`
	// UploadPath is the endpoint path for the upload API.
	UploadPath string `yaml:"upload_path,omitempty"`
}

Jump to

Keyboard shortcuts

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