updateconfig

package
v0.0.0-...-6877637 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 25 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterChanges

func FilterChanges(cfg plugins.ConfigUpdater, changes []github.PullRequestChange, defaultNamespace string, bootstrap bool, log *logrus.Entry) map[plugins.ConfigMapID][]ConfigMapUpdate

FilterChanges determines which of the changes are relevant for config updating, returning mapping of config map to key to filename to update that key from.

func GetConfigMapClient

func GetConfigMapClient(kc corev1.ConfigMapsGetter, namespace string, buildClusterCoreV1Clients map[string]corev1.CoreV1Interface, cluster string) (corev1.ConfigMapInterface, error)

GetConfigMapClient returns a configMap interface according to the given cluster and namespace

func Update

func Update(fg FileGetter, kc corev1.ConfigMapInterface, name, namespace string, updates []ConfigMapUpdate, bootstrap bool, metrics *prometheus.GaugeVec, logger *logrus.Entry, sha string) error

Update updates the configmap with the data from the identified files. Existing configmap keys that are not included in the updates are left alone unless bootstrap is true in which case they are deleted.

Types

type ConfigMapUpdate

type ConfigMapUpdate struct {
	Key, Filename string
	GZIP          bool
}

ConfigMapUpdate is populated with information about a config map that should be updated. If the Filename is missing, then this update means that the key should be deleted.

func MarkStaleKeysForDeletion

func MarkStaleKeysForDeletion(
	configMap *coreapi.ConfigMap,
	updates []ConfigMapUpdate,
) []ConfigMapUpdate

MarkStaledKeysForDeletion returns a slice of ConfigMapUpdate entries for keys that were missing from the updates, and which should be deleted. This only makes sense for bootstrap mode (for the config-bootstrapper).

type FileGetter

type FileGetter interface {
	GetFile(filename string) ([]byte, error)
}

FileGetter knows how to get the contents of a file by name

type OSFileGetter

type OSFileGetter struct {
	Root string
}

func (*OSFileGetter) GetFile

func (g *OSFileGetter) GetFile(filename string) ([]byte, error)

Jump to

Keyboard shortcuts

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