watch

package
Version: v0.4.13 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2020 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.4.1

type Config struct {
	// Label name that when applied to namespace with `true` will trigger application of manifests (e.g. enable-role).
	Label string `yaml:"label" json:"label"`
	// ConfigFile is the path to Kube config (e.g. ~/.kube/config). When left empty, it assumes in-cluster configuration.
	ConfigFile string `yaml:"configFile" json:"config-file"`
	// Manifests is the list of YAML snippets that will applied when matching namespace label is found. When nil, ManifestDir is used to read and populate the YAML manifests. Either Manifests or ManifestDir must be set.
	Manifests []string `yaml:"-" json:"-"`
	// ManifestDir is an optional path to directory with YAML documents. When set, it will append to the list of Manifests. Either Manifests or ManifestDir must be set.
	ManifestDir string `yaml:"manifestDir" json:"manifest-dir"`
	// Logger is an optional preconfigured logger. When nil, it will be configured for os.Stdout with logrus.InfoLevel.
	Logger *logrus.Logger `yaml:"-" json:"-"`
}

Config defines NewNsWatch creation configuration.

type NsWatch

type NsWatch struct {
	// contains filtered or unexported fields
}

NsWatch creates a namespace watch and executes provided YAML in that namespace is labeled with a specific label=true.

func NewNsWatch

func NewNsWatch(c Config) (*NsWatch, error)

NewNsWatch creates a new instance of NsWatch

func (*NsWatch) GetFileManager added in v0.4.9

func (w *NsWatch) GetFileManager() string

GetFileManager returns the active file manager used by this watch. All objects created by NsWatch are associated with this file manager.

func (*NsWatch) GetLabel added in v0.4.11

func (w *NsWatch) GetLabel() string

GetLabel returns the configured label for which the watch is monitoring

func (*NsWatch) Start added in v0.4.9

func (w *NsWatch) Start() error

Start starts NsWatch by attaching namespace event handler. This method blocks until either an internal error or the Stop() method is invoked.

func (*NsWatch) Stop

func (w *NsWatch) Stop()

Stop stops the watcher by closing the internal stop channel.

Jump to

Keyboard shortcuts

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