Help us shape the future of Go! Take the 2026 Go Developer Survey

preference

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GlobalConfigEnvName = "GLOBALODOCONFIG"

	//DefaultTimeout for openshift server connection check (in seconds)
	DefaultTimeout = 1

	// DefaultPushTimeout is the default timeout for pods (in seconds)
	DefaultPushTimeout = 240

	// DefaultBuildTimeout is the default build timeout for pods (in seconds)
	DefaultBuildTimeout = 300

	// UpdateNotificationSetting is the name of the setting controlling update notification
	UpdateNotificationSetting = "UpdateNotification"

	// UpdateNotificationSettingDescription is human-readable description for the update notification setting
	UpdateNotificationSettingDescription = "Flag to control if an update notification is shown or not (Default: true)"

	// NamePrefixSetting is the name of the setting controlling name prefix
	NamePrefixSetting = "NamePrefix"

	// NamePrefixSettingDescription is human-readable description for the name prefix setting
	NamePrefixSettingDescription = "Use this value to set a default name prefix (Default: current directory name)"

	// TimeoutSetting is the name of the setting controlling timeout for connection check
	TimeoutSetting = "Timeout"

	// BuildTimeoutSetting is the name of the setting controlling BuildTimeout
	BuildTimeoutSetting = "BuildTimeout"

	// PushTimeoutSetting is the name of the setting controlling PushTimeout
	PushTimeoutSetting = "PushTimeout"

	// ExperimentalSetting is the name of the setting confrolling exposure of features in development/experimental mode
	ExperimentalSetting = "Experimental"

	// ExperimentalDescription is human-readable description for the experimental setting
	ExperimentalDescription = "Set this value to true to expose features in development/experimental mode"

	// PushTargetSetting is the name of the setting confrolling the push target for odo (docker or kube)
	PushTargetSetting = "PushTarget"

	// PushTargetDescription is human-readable description for the pushtarget setting
	PushTargetDescription = "Set this value to 'kube' or 'docker' to tell odo where to push applications to. (Default: kube)"

	// RegistryCacheTimeSetting is human-readable description for the registrycachetime setting
	RegistryCacheTimeSetting = "RegistryCacheTime"

	// DockerPushTarget represents the value of the push target when it's set to Docker
	DockerPushTarget = "docker"

	// KubePushTarget represents the value of the push target when it's set to Kube
	KubePushTarget = "kube"

	// DefaultDevfileRegistryName is the name of default devfile registry
	DefaultDevfileRegistryName = "DefaultDevfileRegistry"

	// DefaultDevfileRegistryURL is the URL of default devfile registry
	DefaultDevfileRegistryURL = "https://github.com/odo-devfiles/registry"

	// DefaultRegistryCacheTime is time (in minutes) for how long odo will cache information from Devfile registry
	DefaultRegistryCacheTime = 15
)

Variables

View Source
var BuildTimeoutSettingDescription = fmt.Sprintf("BuildTimeout (in seconds) for waiting for a build of the git component to complete (Default: %d)", DefaultBuildTimeout)

BuildTimeoutSettingDescription adds a description for BuildTimeout

View Source
var PushTimeoutSettingDescription = fmt.Sprintf("PushTimeout (in seconds) for waiting for a Pod to come up (Default: %d)", DefaultPushTimeout)

PushTimeoutSettingDescription adds a description for PushTimeout

View Source
var RegistryCacheTimeDescription = fmt.Sprintf("For how long (in minutes) odo will cache information from Devfile registry (Default: %d)", DefaultRegistryCacheTime)

RegistryCacheTimeDescription adds a description for RegistryCacheTime

View Source
var TimeoutSettingDescription = fmt.Sprintf("Timeout (in seconds) for OpenShift server connection check (Default: %d)", DefaultTimeout)

TimeoutSettingDescription is human-readable description for the timeout setting

Functions

func FormatSupportedParameters

func FormatSupportedParameters() (result string)

FormatSupportedParameters outputs supported parameters and their description

func GetSupportedParameters

func GetSupportedParameters() []string

GetSupportedParameters returns the name of the supported parameters

Types

type OdoSettings

type OdoSettings struct {
	// Controls if an update notification is shown or not
	UpdateNotification *bool `yaml:"UpdateNotification,omitempty"`

	// Holds the prefix part of generated random application name
	NamePrefix *string `yaml:"NamePrefix,omitempty"`

	// Timeout for OpenShift server connection check
	Timeout *int `yaml:"Timeout,omitempty"`

	// BuildTimeout for OpenShift build timeout check
	BuildTimeout *int `yaml:"BuildTimeout,omitempty"`

	// PushTimeout for OpenShift pod timeout check
	PushTimeout *int `yaml:"PushTimeout,omitempty"`

	// Experimental for exposing features in development/experimental mode
	Experimental *bool `yaml:"Experimental,omitempty"`

	// PushTarget for telling odo which platform to push to (either kube or docker)
	PushTarget *string `yaml:"PushTarget,omitempty"`

	// RegistryList for telling odo to connect to all the registries in the registry list
	RegistryList *[]Registry `yaml:"RegistryList,omitempty"`

	// RegistryCacheTime how long odo should cache information from registry
	RegistryCacheTime *int `yaml:"RegistryCacheTime,omitempty"`
}

OdoSettings holds all odo specific configurations

type Preference

type Preference struct {
	metav1.TypeMeta `yaml:",inline"`

	// Odo settings holds the odo specific global settings
	OdoSettings OdoSettings `yaml:"OdoSettings,omitempty"`
}

Preference stores all the preferences related to odo

func NewPreference

func NewPreference() Preference

NewPreference creates an empty Preference struct with type meta information

type PreferenceInfo

type PreferenceInfo struct {
	Filename   string `yaml:"FileName,omitempty"`
	Preference `yaml:",omitempty"`
}

PreferenceInfo wraps the preference and provides helpers to serialize it.

func New

func New() (*PreferenceInfo, error)

New returns the PreferenceInfo to retain the expected behavior

func NewPreferenceInfo

func NewPreferenceInfo() (*PreferenceInfo, error)

NewPreferenceInfo gets the PreferenceInfo from preference file and creates the preference file in case it's not present

func (*PreferenceInfo) DeleteConfiguration

func (c *PreferenceInfo) DeleteConfiguration(parameter string) error

DeleteConfiguration delete Odo configurations in the global config file as of now being used for nameprefix, timeout, updatenotification

func (*PreferenceInfo) GetBuildTimeout

func (c *PreferenceInfo) GetBuildTimeout() int

GetBuildTimeout gets the value set by BuildTimeout

func (*PreferenceInfo) GetExperimental

func (c *PreferenceInfo) GetExperimental() bool

GetExperimental returns the value of Experimental from preferences and if absent then returns default default value: false, experimental mode is disabled by default

func (*PreferenceInfo) GetNamePrefix

func (c *PreferenceInfo) GetNamePrefix() string

GetNamePrefix returns the value of Prefix from preferences and if absent then returns default

func (*PreferenceInfo) GetPushTarget

func (c *PreferenceInfo) GetPushTarget() string

GetPushTarget returns the value of PushTarget from preferences and if absent then returns defualt default value: kube, docker push target needs to be manually enabled

func (*PreferenceInfo) GetPushTimeout

func (c *PreferenceInfo) GetPushTimeout() int

GetPushTimeout gets the value set by PushTimeout

func (*PreferenceInfo) GetRegistryCacheTime

func (c *PreferenceInfo) GetRegistryCacheTime() int

GetRegistryCacheTime gets the value set by RegistryCacheTime

func (*PreferenceInfo) GetTimeout

func (c *PreferenceInfo) GetTimeout() int

GetTimeout returns the value of Timeout from config and if absent then returns default

func (*PreferenceInfo) GetUpdateNotification

func (c *PreferenceInfo) GetUpdateNotification() bool

GetUpdateNotification returns the value of UpdateNotification from preferences and if absent then returns default

func (*PreferenceInfo) IsSet

func (c *PreferenceInfo) IsSet(parameter string) bool

IsSet checks if the value is set in the preference

func (*PreferenceInfo) RegistryHandler

func (c *PreferenceInfo) RegistryHandler(operation string, registryName string, registryURL string, forceFlag bool, isSecure bool) error

RegistryHandler handles registry add, update and delete operations

func (*PreferenceInfo) SetConfiguration

func (c *PreferenceInfo) SetConfiguration(parameter string, value string) error

SetConfiguration modifies Odo configurations in the config file as of now being used for nameprefix, timeout, updatenotification TODO: Use reflect to set parameters

type PreferenceItem

type PreferenceItem struct {
	Name        string
	Value       interface{} // The value set by the user, this will be nil if the user hasn't set it
	Default     interface{} // default value of the preference if the user hasn't set the value
	Type        string      // the type of the preference, possible values int, string, bool
	Description string      // The description of the preference
}

type PreferenceList

type PreferenceList struct {
	metav1.TypeMeta `json:",inline"`
	Items           []PreferenceItem `json:"items,omitempty"`
}

func NewPreferenceList

func NewPreferenceList(prefInfo PreferenceInfo) PreferenceList

type Registry

type Registry struct {
	Name   string `yaml:"Name,omitempty"`
	URL    string `yaml:"URL,omitempty"`
	Secure bool
}

Registry includes the registry metadata

Jump to

Keyboard shortcuts

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