config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventAction

type EventAction struct {
	// save the full resource object when the event happens
	SaveFullObject bool `json:"saveFullObject,omitempty"`

	// save the google cmp string or not
	SaveCmp bool `json:"saveCmp,omitempty"`

	// save the json patch result of the diff or not
	SaveJsonPatch bool `json:"saveJsonPatch,omitempty"`
}

type EventRule

type EventRule struct {
	Namespaces []string `json:"namespaces,omitempty"`

	ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`
}

func (EventRule) Match

func (er EventRule) Match(unstr *unstructured.Unstructured) bool

type Field

type Field struct {
	Name string    `json:"name"`
	Type FieldType `json:"type,omitempty"`
	Expr string    `json:"expr,omitempty"`
}

type FieldType

type FieldType string
const (
	FieldTypeJsonPath   FieldType = "jsonpath"
	FieldTypeGoTemplate FieldType = "gotemplate"
	FieldTypeBuiltIn    FieldType = "builtin"
)

type KubeTrackConfiguration

type KubeTrackConfiguration struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

	// +optional
	Rules []Rule `json:"rules,omitempty" protobuf:"bytes,2,opt,name=rules"`

	Events EventRule `json:"events,omitempty"`

	// +optional
	Output []Output `json:"output"`
}

func LoadFromFile

func LoadFromFile(path string) (KubeTrackConfiguration, error)

todo reloader

type ObjectSelector

type ObjectSelector struct {
	metav1.TypeMeta

	Namespaces []string `json:"namespaces,omitempty"`

	ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`

	Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

func (ObjectSelector) Match

func (osel ObjectSelector) Match(obj runtime.Object) bool

type Output

type Output struct {
	Log      *OutputLog
	Mysql    *OutputMysql
	Postgres *OutputPostgres
}

type OutputLog

type OutputLog struct {
	PrintDiff bool `json:"printDiff"`
}

type OutputMysql

type OutputMysql struct {
	DSN     string `json:"dsn"`
	TTLDays int    `json:"ttlDays"`
}

type OutputPostgres

type OutputPostgres struct {
	DSN     string `json:"dsn"`
	TTLDays int    `json:"ttlDays"`
}

type Rule

type Rule struct {
	ObjectSelector

	// the fields you cares about
	CareFields []Field `json:"careFields,omitempty"`

	OnCreate EventAction `json:"onCreate,omitempty"`

	OnDelete EventAction `json:"onDelete,omitempty"`

	OnUpdate EventAction `json:"onUpdate,omitempty"`
}

Jump to

Keyboard shortcuts

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