config

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

If we are providing explicit kubernetes client configuration, this enum will expose the modes of user auth

Index

Constants

This section is empty.

Variables

Functions

This section is empty.

Types

type AccountRouteByNamespaceLabel added in v1.5.0

type AccountRouteByNamespaceLabel struct {
	LabelKey           string `mapstructure:"key" json:"key,omitempty" yaml:"key"`
	DefaultAccount     string `mapstructure:"default-account" json:"default-account,omitempty" yaml:"default-account"`
	IgnoreMissingLabel bool   `mapstructure:"ignore-missing-label" json:"ignore-missing-label,omitempty" yaml:"ignore-missing-label"`
}

type AccountRouteDetails added in v1.5.0

type AccountRouteDetails struct {
	User       string   `mapstructure:"user" json:"user,omitempty" yaml:"user"`
	Password   string   `mapstructure:"password" json:"password,omitempty" yaml:"password"`
	Namespaces []string `mapstructure:"namespaces" json:"namespaces,omitempty" yaml:"namespaces"`
}

func (AccountRouteDetails) MarshalJSON added in v1.6.2

func (aRD AccountRouteDetails) MarshalJSON() ([]byte, error)

func (AccountRouteDetails) MarshalYAML added in v1.6.2

func (aRD AccountRouteDetails) MarshalYAML() (interface{}, error)

type AccountRoutes added in v1.5.0

type AccountRoutes map[string]AccountRouteDetails

type AnchoreInfo

type AnchoreInfo struct {
	URL      string     `mapstructure:"url" json:"url,omitempty" yaml:"url"`
	User     string     `mapstructure:"user" json:"user,omitempty" yaml:"user"`
	Password string     `mapstructure:"password" json:"password,omitempty" yaml:"password"`
	Account  string     `mapstructure:"account" json:"account,omitempty" yaml:"account"`
	HTTP     HTTPConfig `mapstructure:"http" json:"http,omitempty" yaml:"http"`
}

Information for posting in-use image details to Anchore (or any URL for that matter)

func (*AnchoreInfo) IsValid

func (anchore *AnchoreInfo) IsValid() bool

Return whether or not AnchoreDetails are specified

func (AnchoreInfo) MarshalJSON added in v1.6.2

func (anchore AnchoreInfo) MarshalJSON() ([]byte, error)

func (AnchoreInfo) MarshalYAML added in v1.6.2

func (anchore AnchoreInfo) MarshalYAML() (interface{}, error)

type Application

type Application struct {
	ConfigPath                      string
	Quiet                           bool    `mapstructure:"quiet" json:"quiet,omitempty" yaml:"quiet"`
	Log                             Logging `mapstructure:"log" json:"log,omitempty" yaml:"log"`
	CliOptions                      CliOnlyOptions
	Dev                             Development                  `mapstructure:"dev" json:"dev,omitempty" yaml:"dev"`
	KubeConfig                      KubeConf                     `mapstructure:"kubeconfig" json:"kubeconfig,omitempty" yaml:"kubeconfig"`
	Kubernetes                      KubernetesAPI                `mapstructure:"kubernetes" json:"kubernetes,omitempty" yaml:"kubernetes"`
	Namespaces                      []string                     `mapstructure:"namespaces" json:"namespaces,omitempty" yaml:"namespaces"`
	KubernetesRequestTimeoutSeconds int64                        `` /* 143-byte string literal not displayed */
	NamespaceSelectors              NamespaceSelector            `mapstructure:"namespace-selectors" json:"namespace-selectors,omitempty" yaml:"namespace-selectors"`
	AccountRoutes                   AccountRoutes                `mapstructure:"account-routes" json:"account-routes,omitempty" yaml:"account-routes"`
	AccountRouteByNamespaceLabel    AccountRouteByNamespaceLabel `` /* 137-byte string literal not displayed */
	MissingRegistryOverride         string                       `mapstructure:"missing-registry-override" json:"missing-registry-override,omitempty" yaml:"missing-registry-override"`
	MissingTagPolicy                MissingTagConf               `mapstructure:"missing-tag-policy" json:"missing-tag-policy,omitempty" yaml:"missing-tag-policy"`
	RunMode                         mode.Mode
	Mode                            string                `mapstructure:"mode" json:"mode,omitempty" yaml:"mode"`
	IgnoreNotRunning                bool                  `mapstructure:"ignore-not-running" json:"ignore-not-running,omitempty" yaml:"ignore-not-running"`
	PollingIntervalSeconds          int                   `mapstructure:"polling-interval-seconds" json:"polling-interval-seconds,omitempty" yaml:"polling-interval-seconds"`
	InventoryReportLimits           InventoryReportLimits `mapstructure:"inventory-report-limits" json:"inventory-report-limits,omitempty" yaml:"inventory-report-limits"`
	MetadataCollection              MetadataCollection    `mapstructure:"metadata-collection" json:"metadata-collection,omitempty" yaml:"metadata-collection"`
	AnchoreDetails                  AnchoreInfo           `mapstructure:"anchore" json:"anchore,omitempty" yaml:"anchore"`
	VerboseInventoryReports         bool                  `mapstructure:"verbose-inventory-reports" json:"verbose-inventory-reports,omitempty" yaml:"verbose-inventory-reports"`
}

All Application configurations

func LoadConfigFromFile

func LoadConfigFromFile(v *viper.Viper, cliOpts *CliOnlyOptions) (*Application, error)

Load the Application Configuration from the Viper specifications

func (*Application) Build

func (cfg *Application) Build() error

Build the configuration object (to be used as a singleton)

func (Application) String

func (cfg Application) String() string

type CliOnlyOptions

type CliOnlyOptions struct {
	ConfigPath string
	Verbosity  int
}

Configuration options that may only be specified on the command line

type Development

type Development struct {
	ProfileCPU bool `mapstructure:"profile-cpu" json:"profile-cpu,omitempty" yaml:"profile-cpu"`
}

Development Configuration (only profile-cpu at the moment)

type HTTPConfig

type HTTPConfig struct {
	Insecure       bool `mapstructure:"insecure" json:"insecure,omitempty" yaml:"insecure"`
	TimeoutSeconds int  `mapstructure:"timeout-seconds" json:"timeout-seconds,omitempty" yaml:"timeout-seconds"`
}

Configurations for the HTTP Client itself (net/http)

type InventoryReportLimits added in v1.6.0

type InventoryReportLimits struct {
	Namespaces int `mapstructure:"namespaces" json:"namespaces,omitempty" yaml:"namespaces"`
}

Details upper limits for the inventory report contents before splitting into batches

type KubeConf

type KubeConf struct {
	Path        string       `mapstructure:"path" json:"path,omitempty" yaml:"path"`
	Cluster     string       `mapstructure:"cluster" json:"cluster,omitempty" yaml:"cluster"`
	ClusterCert string       `mapstructure:"cluster-cert" json:"cluster-cert,omitempty" yaml:"cluster-cert"`
	Server      string       `mapstructure:"server" json:"server,omitempty" yaml:"server"`
	User        KubeConfUser `mapstructure:"user" json:"user,omitempty" yaml:"user"`
}

Defines how the Kubernetes Client should be configured. Note: Doesn't seem to work well with Env vars

func (*KubeConf) GetKubeConfigFromConf

func (kubeConf *KubeConf) GetKubeConfigFromConf() (*rest.Config, error)

func (*KubeConf) IsKubeConfigFromFile

func (kubeConf *KubeConf) IsKubeConfigFromFile() bool

func (*KubeConf) IsNonFileKubeConfigValid

func (kubeConf *KubeConf) IsNonFileKubeConfigValid() bool

type KubeConfUser

type KubeConfUser struct {
	UserConfType UserConf
	UserConf     string `mapstructure:"type" json:"type,omitempty" yaml:"type"`
	ClientCert   string `mapstructure:"client-cert" json:"client-cert,omitempty" yaml:"client-cert"`
	PrivateKey   string `mapstructure:"private-key" json:"private-key,omitempty" yaml:"private-key"`
	Token        string `mapstructure:"token" json:"token,omitempty" yaml:"token"`
}

If we are explicitly providing authentication information (not from a kubeconfig file), we need this info

func (KubeConfUser) MarshalJSON added in v1.6.2

func (user KubeConfUser) MarshalJSON() ([]byte, error)

func (KubeConfUser) MarshalYAML added in v1.6.2

func (user KubeConfUser) MarshalYAML() (interface{}, error)

type KubernetesAPI

type KubernetesAPI struct {
	RequestTimeoutSeconds int64 `mapstructure:"request-timeout-seconds" json:"request-timeout-second,omitempty" yaml:"request-timeout-seconds"`
	RequestBatchSize      int64 `mapstructure:"request-batch-size" json:"request-batch-size,omitempty" yaml:"request-batch-size"`
	WorkerPoolSize        int   `mapstructure:"worker-pool-size" json:"worker-pool-size,omitempty" yaml:"worker-pool-size"`
}

KubernetesAPI details the configuration for interacting with the k8s api server

type Logging

type Logging struct {
	Structured   bool `mapstructure:"structured" json:"structured,omitempty" yaml:"structured"`
	LevelOpt     logrus.Level
	Level        string `mapstructure:"level" json:"level,omitempty" yaml:"level"`
	FileLocation string `mapstructure:"file" json:"file,omitempty" yaml:"file"`
}

Logging Configuration

type MetadataCollection added in v1.6.0

type MetadataCollection struct {
	Nodes     ResourceMetadata `mapstructure:"nodes" json:"nodes,omitempty" yaml:"nodes"`
	Namespace ResourceMetadata `mapstructure:"namespaces" json:"namespace,omitempty" yaml:"namespaces"`
	Pods      ResourceMetadata `mapstructure:"pods" json:"pods,omitempty" yaml:"pods"`
}

type MissingTagConf

type MissingTagConf struct {
	Policy string `mapstructure:"policy" json:"policy,omitempty" yaml:"policy"`
	Tag    string `mapstructure:"tag,omitempty" json:"tag,omitempty" yaml:"tag"`
}

MissingTagConf details the policy for handling missing tags when reporting images

type NamespaceSelector

type NamespaceSelector struct {
	Include     []string `mapstructure:"include" json:"include,omitempty" yaml:"include"`
	Exclude     []string `mapstructure:"exclude" json:"exclude,omitempty" yaml:"exclude"`
	IgnoreEmpty bool     `mapstructure:"ignore-empty" json:"ignore-empty,omitempty" yaml:"ignore-empty"`
}

NamespaceSelector details the inclusion/exclusion rules for namespaces

type ResourceMetadata added in v1.6.0

type ResourceMetadata struct {
	Annotations []string `mapstructure:"include-annotations" json:"include-annotations,omitempty" yaml:"include-annotations"`
	Labels      []string `mapstructure:"include-labels" json:"include-labels,omitempty" yaml:"include-labels"`
	Disable     bool     `mapstructure:"disable" json:"disable,omitempty" yaml:"disable"`
}

type UserConf

type UserConf int
const (
	PrivateKey UserConf = iota
	ServiceAccountToken
)

func ParseUserConf

func ParseUserConf(userStr string) UserConf

Parse the Mode from the user specified string (should match one of userConfStr - see above). If no matches, we fallback to adhoc

func (UserConf) String

func (o UserConf) String() string

Convert the mode object to a string

Jump to

Keyboard shortcuts

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