configmap

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Field path constants that are specific to the internal API
	// representation.
	// https://github.com/kubernetes/apimachinery/blob/v0.21.0-beta.1/pkg/apis/meta/v1/types.go#L105
	ObjectNameField = "metadata.name"
)

Variables

This section is empty.

Functions

func Run

func Run(ctx context.Context, wg *sync.WaitGroup, c Config, log logger.Logger) error

Run starts kubernetes ConfigMap event watch and local config update inside container.

func Watch

func Watch(ctx context.Context, wg *sync.WaitGroup, log logger.Logger, namespace, cmName string, interval time.Duration) (<-chan *Object, error)

Types

type Config

type Config interface {
	GetK8sBaseDirectory() string
	GetK8sNamespace() string
	GetK8sObjectName() string
	GetPauseChannel() chan bool
	GetWatchInterval() time.Duration
}

Config defines package configuration interface.

type Object

type Object struct {
	*corev1.ConfigMap
	// contains filtered or unexported fields
}

func (*Object) IsAdded

func (obj *Object) IsAdded() bool

func (*Object) IsDeleted

func (obj *Object) IsDeleted() bool

func (*Object) IsModified

func (obj *Object) IsModified() bool

func (*Object) RemoveFilesFromDir

func (obj *Object) RemoveFilesFromDir(path string, except ...string) error

RemoveFilesFromDir removes regular files from directory path, without recursion. Function can be provided with a list of file name exception, this files will not be removed.

func (*Object) String

func (obj *Object) String() string

func (*Object) Write

func (obj *Object) Write(basePath string) error

Write syncs files content from kubernetes config map to container local directory. No check is preformed on destination file vs source file, content is overwritten. Files that are absent in object data key are also removed.

Jump to

Keyboard shortcuts

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