Documentation ¶
Overview ¶
Package tkgconfigupdater provides utilities to update tkg configs
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultConfigMap = map[string]string{ constants.KeyCertManagerTimeout: constants.DefaultCertmanagerDeploymentTimeout.String(), }
DefaultConfigMap default configuration map
var KeysToEncode = []string{ constants.ConfigVariableVspherePassword, constants.ConfigVariableAWSAccessKeyID, constants.ConfigVariableAWSSecretAccessKey, constants.ConfigVariableAzureClientID, constants.ConfigVariableAzureClientSecret, constants.ConfigVariableNsxtPassword, constants.ConfigVariableAviPassword, constants.ConfigVariableLDAPBindPassword, constants.ConfigVariableOIDCIdentiryProviderClientSecret, }
KeysToEncode all keys to encode
var KeysToNeverPersist = []string{ constants.ConfigVariableAWSAccessKeyID, constants.ConfigVariableAWSSecretAccessKey, constants.ConfigVariableAWSSessionToken, constants.ConfigVariableAWSB64Credentials, }
KeysToNeverPersist are all keys that should never be persisted NOTE: AWS users should persist credentials by creating named profiles using AWS CLI: aws configure --profile <name>, and then use the AWS_PROFILE variable. Temporary static credentials last at most 12 hours, and AWS red-flags partner products that save static credentials, so we do not save them. This is different than vSphere and Azure where static credentials are the norm.
Functions ¶
func CreateConfigMap ¶ added in v0.9.0
CreateConfigMap transforms a configuration object into a map
func GetNodeIndex ¶
GetNodeIndex returns index of the node
func SaveConfig ¶
func SaveConfig(clusterConfigPath string, tkgConfigReaderWriter tkgconfigreaderwriter.TKGConfigReaderWriter, configObj interface{}) error
SaveConfig saves configuration to ReaderWriter and/or to File allows clusterConfigPath to be empty, in which case no file is written allows TKGConfigReaderWriter to be empty, in which case no update is made to that writer (allows both to be empty, in which case the method does nothing)
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