config

package
v0.0.0-...-100cc6e Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 6 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BugReportConfig

type BugReportConfig struct {
	// KubeConfigPath is the path to kube config file.
	KubeConfigPath string `json:"kubeConfigPath,omitempty"`
	// Context is the cluster Context in the kube config
	Context string `json:"context,omitempty"`

	// IstioNamespace is the namespace where the istio control plane is installed.
	IstioNamespace string `json:"istioNamespace,omitempty"`

	// DryRun controls whether logs are actually captured and saved.
	DryRun bool `json:"dryRun,omitempty"`

	// FullSecrets controls whether secret contents are included.
	FullSecrets bool `json:"fullSecrets,omitempty"`

	// CommandTimeout is the maximum amount of time running the command
	// before giving up, even if not all logs are captured. Upon timeout,
	// the command creates an archive with only the logs captured so far.
	CommandTimeout Duration `json:"commandTimeout,omitempty"`

	// Include is a list of SelectionSpec entries for resources to include.
	Include SelectionSpecs `json:"include,omitempty"`
	// Exclude is a list of SelectionSpec entries for resources t0 exclude.
	Exclude SelectionSpecs `json:"exclude,omitempty"`

	// StartTime is the start time the log capture time range.
	// If set, Since must be unset.
	StartTime time.Time `json:"startTime,omitempty"`
	// EndTime is the end time the log capture time range.
	// Default is now.
	EndTime time.Time `json:"endTime,omitempty"`
	// Since defines the start time the log capture time range.
	// StartTime is set to EndTime - Since.
	// If set, StartTime must be unset.
	Since Duration `json:"since,omitempty"`

	// TimeFilterApplied stores if user has provided any time filtering flags.
	// If Since, StartTime, EndTime are all not applied by the user, set TimeFilterApplied as false; Otherwise set true
	TimeFilterApplied bool `json:"timeFilterApplied,omitempty"`

	// CriticalErrors is a list of glob pattern matches for errors that,
	// if found in a log, set the highest priority for the log to ensure
	// that it is Include in the capture archive.
	CriticalErrors []string `json:"criticalErrors,omitempty"`
	// IgnoredErrors are glob error patterns which are ignored when
	// calculating the error heuristic for a log.
	IgnoredErrors []string `json:"ignoredErrors,omitempty"`

	// RequestConcurrency controls the request concurrency limit to the API server.
	RequestConcurrency int `json:"requestConcurrency,omitempty"`
}

BugReportConfig controls what is captured and Include in the kube-capture tool archive.

func (*BugReportConfig) String

func (b *BugReportConfig) String() string

type Duration

type Duration time.Duration

func (Duration) MarshalJSON

func (d Duration) MarshalJSON() ([]byte, error)

func (*Duration) UnmarshalJSON

func (d *Duration) UnmarshalJSON(b []byte) error

type ResourceType

type ResourceType int
const (
	Namespace ResourceType = iota
	Deployment
	Pod
	Label
	Annotation
	Container
)

type SelectionSpec

type SelectionSpec struct {
	Namespaces  []string          `json:"namespaces,omitempty"`
	Deployments []string          `json:"deployments,omitempty"`
	Daemonsets  []string          `json:"daemonsets,omitempty"`
	Pods        []string          `json:"pods,omitempty"`
	Containers  []string          `json:"containers,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

SelectionSpec is a spec for pods that will be Include in the capture archive. The format is:

Namespace1,Namespace2../Deployments/Pods/Label1,Label2.../Annotation1,Annotation2.../ContainerName1,ContainerName2...

Namespace, pod and container names are pattern matching while labels and annotations may have pattern in the values with exact match for keys. All labels and annotations in the list must match. All fields are optional, if they are not specified, all values match. Pattern matching style is glob. Exclusions have a higher precedence than inclusions. Ordering defines pod priority for cases where the archive exceeds the maximum size and some logs must be dropped.

Examples:

1. All pods in test-namespace with label "test=foo" but without label "private" (with any value):

include:
  test-namespace/*/*/test=foo
exclude:
  test-namespace/*/*/private

2. Pods in all namespaces except "kube-system" with annotation "revision" matching wildcard 1.6*:

exclude:
  kube-system/*/*/*/revision=1.6*

3. Pods with "prometheus" in the name, except those with the annotation "internal=true":

include:
  */*/*prometheus*
exclude:
  */*/*prometheus*/*/internal=true

4. Container logs for all containers called "istio-proxy":

include:
  */*/*/*/*/istio-proxy

func (*SelectionSpec) MarshalJSON

func (s *SelectionSpec) MarshalJSON() ([]byte, error)

func (*SelectionSpec) UnmarshalJSON

func (s *SelectionSpec) UnmarshalJSON(b []byte) error

type SelectionSpecs

type SelectionSpecs []*SelectionSpec

func (SelectionSpecs) String

func (s SelectionSpecs) String() string

Jump to

Keyboard shortcuts

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