updateconfig

package
v0.0.0-...-97238d6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

README

updateconfig allows prow to update configmaps when files in a repo change.

updateconfig also supports glob match, or multi-key updates.

Usage

Update your plugins.yaml file to something along the following lines:

plugins:
  my-github/repo:
  - config-updater

config_updater:
  maps:
    # Update the thing-config configmap whenever thing changes
    path/to/some/other/thing:
      name: thing-config
      # Using ProwJobNamespace by default.
    path/to/some/other/thing2:
      name: thing2-config
      namespace: otherNamespace
    # Update the config configmap whenever config.yaml changes
    prow/config.yaml:
      name: config
    # Update the plugin configmap whenever plugins.yaml changes
    prow/plugins.yaml:
      name: plugin
    # Update the `this` or/and `that` key in the `data` configmap whenever `data.yaml` or/and `other-data.yaml` changes
    some/data.yaml:
      name: data
      key: this
    some/other-data.yaml
      name: data
      key: that
    # Update the fejtaverse configmap whenever any `.yaml` file under `fejtaverse` changes
    fejtaverse/**/*.yaml
      name: fejtaverse

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterChanges

func FilterChanges(configMaps map[string]plugins.ConfigMapSpec, changes []github.PullRequestChange, log *logrus.Entry) map[ConfigMapID]map[string]string

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 Update

func Update(fg FileGetter, kc KubeClient, name, namespace string, updates map[string]string, logger *logrus.Entry) error

Update updates the configmap with the data from the identified files

Types

type ConfigMapID

type ConfigMapID struct {
	Name, Namespace string
}

ConfigMapID is a name/namespace combination that identifies a config map

type FileGetter

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

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

type KubeClient

type KubeClient interface {
	GetConfigMap(name, namespace string) (kube.ConfigMap, error)
	ReplaceConfigMap(name string, config kube.ConfigMap) (kube.ConfigMap, error)
	CreateConfigMap(content kube.ConfigMap) (kube.ConfigMap, error)
}

KubeClient knows how to interact with ConfigMaps on a cluster

Jump to

Keyboard shortcuts

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