tkgconfigupdater

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package tkgconfigupdater provides utilities to update tkg configs

Index

Constants

This section is empty.

Variables

DefaultConfigMap default configuration map

KeysToEncode all keys to encode

KeysToNeverPersist are all keys that should never be persisted

Functions

func GetNodeIndex

func GetNodeIndex(node []*yaml.Node, key string) int

GetNodeIndex returns index of the node

func SaveConfig

func SaveConfig(clusterConfigPath string, rw tkgconfigreaderwriter.TKGConfigReaderWriter, configObj interface{}) error

SaveConfig saves and updates key-value pairs in existing config file

func SetVariableInConfig

func SetVariableInConfig(key, value, comment, clusterConfigPath string) error

SetVariableInConfig allows to explicit override of config value with updating the value in provided tkg-config file i.e. it will add the "key: value" in the tkg-config file if key is not present if key is present it will update the value of the key in the file

Types

type Client

type Client interface {
	// EnsureTKGConfigFile ensures creating settings file
	EnsureTKGConfigFile() (string, error)
	// EnsureConfigImages ensures that `images:“ config exists and is up-to-date in tkg settings file
	// images:
	//   all:
	//      repository: projects-stg.registry.vmware.com/tkg/cluster-api
	//   cert-manager:
	//      repository: projects-stg.registry.vmware.com/tkg
	//      tag: v0.16.1_vmware.1
	EnsureConfigImages() error

	// DecodeCredentialsInViper decode the credentials stored in viper
	DecodeCredentialsInViper() error

	CheckInfrastructureVersion(providerName string) (string, error)

	GetDefaultInfrastructureVersion(providerName string) (string, error)

	EnsureProviderTemplates() error

	SetDefaultConfiguration()

	// CheckProviderTemplatesNeedUpdate checks if .tkg/providers is up-to-date.
	CheckProviderTemplatesNeedUpdate() (bool, error)
	// CheckBOMsNeedUpdate checks if bom files are up-to-date.
	// returns true if $HOME/.tkg/bom directory exists, not empty and doesn't contain the defaultBoM file
	CheckBOMsNeedUpdate() (bool, error)
	// EnsureBOMFiles ensures the local BOM files. If forceUpdate option is set, TKG compatibility file would fetched
	// from the registry and would update BOM files if the latest TKG compatibility file version points to new BOM files
	EnsureBOMFiles(forceUpdate bool) error
	// EnsureTKGCompatibilityFile ensures the TKG compatibility file. If forceUpdate option is set,TKG compatibility would fetched
	// TKG compatibility file would fetched from the registry though local copy exists
	EnsureTKGCompatibilityFile(forceUpdate bool) error

	// EnsureCredEncoding ensures the credentials encoding
	EnsureCredEncoding(tkgConfigNode *yaml.Node)
	EnsureImages(needUpdate bool, tkgConfigNode *yaml.Node) error
	// EnsureProvidersInConfig ensures the providers section in tkgconfig exisits and it is synchronized with the latest providers
	EnsureProvidersInConfig(needUpdate bool, tkgConfigNode *yaml.Node) error
	// EnsureTemplateFiles ensures that $HOME/.tkg/providers exists and it is up-to-date
	EnsureTemplateFiles() (bool, error)
}

Client implements TKG configuration updater functions

func New

func New(configDir string, providerGetter providerinterface.ProviderInterface,
	tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter) Client

New creates new tkgconfig updater client

Jump to

Keyboard shortcuts

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