config

package
v0.0.0-...-b25b198 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package config provides functions for the tanzu cli configuration

Package config contains useful functionality for config updates

Index

Constants

View Source
const (
	// FeatureContextAwareCLIForPlugins determines whether to use legacy way of discovering plugins or
	// to use the new context-aware Plugin API based plugin discovery mechanism
	// Users can should not update this featureflag. This featureflag will be removed in the future version
	// and the feature will be always enabled
	FeatureContextAwareCLIForPlugins = "features.global.context-aware-cli-for-plugins"
	// FeatureContextCommand determines whether to surface the context command. This is disabled by default.
	FeatureContextCommand = "features.global.context-target-v2"
)

This block is for global feature constants, to allow them to be used more broadly

View Source
const (
	// PackageBasedCC feature flag determines whether to use package based lifecycle management of management component
	// or legacy way of managing management components. This is also used for clusterclass based management cluster provisioning
	FeatureFlagPackageBasedCC = "features.management-cluster.package-based-cc"
	// FeatureFlagAllowLegacyCluster is used to decide the workload cluster is clusterclass based or legayc based.
	// By default, it's false. If it's true, then workload cluster is legacy based.
	FeatureFlagAllowLegacyCluster = "features.cluster.allow-legacy-cluster"
)

This block is used to set the default value for management-cluster and workload-cluster

View Source
const (
	// NameHeader used by every client making an API call
	NameHeader = "x-client-name"

	// VersionHeader is the client version header.
	VersionHeader = "x-client-version"
)
View Source
const AdvancedRepositoryName = "advanced"

AdvancedRepositoryName is the advanced repository name.

View Source
const CoreRepositoryName = "core"

CoreRepositoryName is the core repository name.

View Source
const DefaultEdition = "tkg"

DefaultEdition is the edition assumed when there is no value in the local config file

View Source
const DefaultTMCPluginsArtifactRepository = "https://tmc-cli.s3-us-west-2.amazonaws.com/plugins/artifacts"

DefaultTMCPluginsArtifactRepository is the S3 bucket repository for TMC plugins.

View Source
const DefaultVersionSelector = configapi.NoUnstableVersions

DefaultVersionSelector is to only use stable versions of plugins

Variables

View Source
var (
	// DefaultAllowedPluginRepositories this can be comma separated list of allowed registries
	DefaultAllowedPluginRepositories     = ""
	DefaultStandaloneDiscoveryRepository = ""
	DefaultStandaloneDiscoveryImagePath  = ""
	DefaultStandaloneDiscoveryImageTag   = ""
	DefaultStandaloneDiscoveryName       = "default"
	// DefaultStandaloneDiscoveryNameLocal Used for local discovery of sources.
	// Changing the default-local discovery source label to default and default will be used as a local discovery source
	// default and default-local will co-exist in the config.yaml i.e. If local discovery source is used and is now assigned the default name, the discovery source named default-local will still exist.
	// And recommend that it be manually removed from the config file.
	DefaultStandaloneDiscoveryNameLocal = "default"
	DefaultStandaloneDiscoveryType      = common.DistributionTypeOCI
	DefaultStandaloneDiscoveryLocalPath = ""
)

Default Standalone Discovery configuration Value of this variables gets assigned during build time

View Source
var AdvancedGCPBucketRepository = configapi.GCPPluginRepository{
	BucketName: "tanzu-cli-advanced-plugins",
	Name:       AdvancedRepositoryName,
}

AdvancedGCPBucketRepository is the GCP bucket repository for advanced plugins.

View Source
var CoreBucketName = "tanzu-cli-framework"

CoreBucketName is the name of the core plugin repository bucket to use.

View Source
var CoreGCPBucketRepository = configapi.GCPPluginRepository{
	BucketName: CoreBucketName,
	Name:       CoreRepositoryName,
}

CoreGCPBucketRepository is the default GCP bucket repository.

DefaultCliFeatureFlags is used to populate an initially empty config file with default values for feature flags. The keys MUST be in the format "features.global.<feature>" or initialization will fail

If a developer expects that their feature will be ready to release, they should create an entry here with a true value. If a developer has a beta feature they want to expose, but leave turned off by default, they should create an entry here with a false value. WE HIGHLY RECOMMEND the use of a SEPARATE flag for beta use; one that ends in "-beta". Thus, if you plan to eventually release a feature with a flag named "features.global.foo-bar", you should consider releasing the beta version with "features.global.foo-bar-beta". This will make it much easier when it comes time for mainstreaming the feature (with a default true value) under the flag name "features.global.foo-bar", as there will be no conflict with previous installs (that have a false value for the entry "features.global.foo-bar-beta").

View Source
var DefaultRepositories = []configapi.PluginRepository{
	{
		GCPPluginRepository: &CoreGCPBucketRepository,
	},
}

DefaultRepositories are the default repositories for the CLI.

View Source
var (
	// IsContextAwareDiscoveryEnabled defines default to use when the user has not configured a value
	// This variable is configured at the build time of the CLI
	IsContextAwareDiscoveryEnabled = ""
)

Functions

func AddBomRepoIfMissing

func AddBomRepoIfMissing(config *configapi.ClientConfig) bool

AddBomRepoIfMissing adds the bomRepository to the client configuration if it is not already present

func AddCompatibilityFileIfMissing

func AddCompatibilityFileIfMissing(config *configapi.ClientConfig) bool

AddCompatibilityFileIfMissing adds the compatibility file to the client configuration to ensure it can be downloaded

func AddDefaultFeatureFlagsIfMissing

func AddDefaultFeatureFlagsIfMissing(config *configapi.ClientConfig, defaultFeatureFlags map[string]bool) bool

AddDefaultFeatureFlagsIfMissing augments the given configuration object with any default feature flags that do not already have a value and returns TRUE if any were added (so the config can be written out to disk, if the caller wants to)

func ConfigureDefaultFeatureFlagsIfMissing

func ConfigureDefaultFeatureFlagsIfMissing(defaultFeatureFlags map[string]bool) error

ConfigureDefaultFeatureFlagsIfMissing configures default feature-flags to ClientConfig if missing

func ConfigureEnvVariables

func ConfigureEnvVariables()

ConfigureEnvVariables reads and configures provided environment variables as part of tanzu configuration file

func GetDefaultStandaloneDiscoveryImage

func GetDefaultStandaloneDiscoveryImage() string

GetDefaultStandaloneDiscoveryImage returns the default Standalone Discovery image from the configured build time variables

func GetDefaultStandaloneDiscoveryLocalPath

func GetDefaultStandaloneDiscoveryLocalPath() string

GetDefaultStandaloneDiscoveryLocalPath returns default standalone discovery local path

func GetDefaultStandaloneDiscoveryType

func GetDefaultStandaloneDiscoveryType() string

GetDefaultStandaloneDiscoveryType returns the default standalone discovery type

func GetTrustedArtifactLocations

func GetTrustedArtifactLocations() []string

GetTrustedArtifactLocations returns the list of trusted URI prefixes that can be trusted for downloading the CLIPlugins. Currently, this includes only the "tanzu-cli-advanced-plugins" GCP bucket where TMC plugins are stored. Other exceptions can be added as and when necessary.

func GetTrustedRegistries

func GetTrustedRegistries() []string

GetTrustedRegistries returns the list of trusted registries that can be used for downloading the CLIPlugins

Types

This section is empty.

Jump to

Keyboard shortcuts

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