config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 14 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 Application

type Application struct {
	ConfigPath                      string
	Quiet                           bool    `mapstructure:"quiet"`
	Log                             Logging `mapstructure:"log"`
	CliOptions                      CliOnlyOptions
	Dev                             Development       `mapstructure:"dev"`
	KubeConfig                      KubeConf          `mapstructure:"kubeconfig"`
	Kubernetes                      KubernetesAPI     `mapstructure:"kubernetes"`
	Namespaces                      []string          `mapstructure:"namespaces"`
	KubernetesRequestTimeoutSeconds int64             `mapstructure:"kubernetes-request-timeout-seconds"`
	NamespaceSelectors              NamespaceSelector `mapstructure:"namespace-selectors"`
	MissingTagPolicy                MissingTagConf    `mapstructure:"missing-tag-policy"`
	RunMode                         mode.Mode
	Mode                            string        `mapstructure:"mode"`
	IgnoreNotRunning                bool          `mapstructure:"ignore-not-running"`
	PollingIntervalSeconds          int           `mapstructure:"polling-interval-seconds"`
	NextlinuxDetails                NextlinuxInfo `mapstructure:"nextlinux"`
	VerboseInventoryReports         bool          `mapstructure:"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"`
}

Development Configuration (only profile-cpu at the moment)

type HTTPConfig

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

Configurations for the HTTP Client itself (net/http)

type KubeConf

type KubeConf struct {
	Path        string       `mapstructure:"path"`
	Cluster     string       `mapstructure:"cluster"`
	ClusterCert string       `mapstructure:"cluster-cert"`
	Server      string       `mapstructure:"server"`
	User        KubeConfUser `mapstructure:"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"`
	ClientCert   string `mapstructure:"client-cert"`
	PrivateKey   string `mapstructure:"private-key"`
	Token        string `mapstructure:"token"`
}

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

type KubernetesAPI

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

KubernetesAPI details the configuration for interacting with the k8s api server

type Logging

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

Logging Configuration

type MissingTagConf

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

MissingTagConf details the policy for handling missing tags when reporting images

type NamespaceSelector

type NamespaceSelector struct {
	Include []string `mapstructure:"include"`
	Exclude []string `mapstructure:"exclude"`
}

NamespaceSelector details the inclusion/exclusion rules for namespaces

type NextlinuxInfo

type NextlinuxInfo struct {
	URL      string     `mapstructure:"url"`
	User     string     `mapstructure:"user"`
	Password string     `mapstructure:"password"`
	Account  string     `mapstructure:"account"`
	HTTP     HTTPConfig `mapstructure:"http"`
}

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

func (*NextlinuxInfo) IsValid

func (nextlinux *NextlinuxInfo) IsValid() bool

Return whether or not NextlinuxDetails are specified

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