automaticupgrades

package
v0.0.0-...-5c79d48 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultChannelName      = "default"
	DefaultCloudChannelName = "stable/cloud"
)

Variables

This section is empty.

Functions

func GetChannel

func GetChannel() string

GetChannel returns the TELEPORT_AUTOMATIC_UPGRADES_CHANNEL value. Example of an acceptable value for TELEPORT_AUTOMATIC_UPGRADES_CHANNEL is: https://updates.releases.teleport.dev/v1/stable/cloud

func GetUpgraderVersion

func GetUpgraderVersion(ctx context.Context) string

GetUpgraderVersion returns the teleport upgrader version

func IsEnabled

func IsEnabled() bool

IsEnabled reads the TELEPORT_AUTOMATIC_UPGRADES and returns whether Automatic Upgrades are enabled or disabled. An error is logged (warning) if the variable is present but its value could not be converted into a boolean. Acceptable values for TELEPORT_AUTOMATIC_UPGRADES are: 1, t, T, TRUE, true, True, 0, f, F, FALSE, false, False

Types

type Channel

type Channel struct {
	// ForwardURL is the URL of the upstream version server providing the channel version/criticality.
	ForwardURL string `yaml:"forward_url,omitempty"`
	// StaticVersion is a static version the channel must serve. With or without the leading "v".
	StaticVersion string `yaml:"static_version,omitempty"`
	// Critical is whether the static version channel should be marked as a critical update.
	Critical bool `yaml:"critical"`
	// contains filtered or unexported fields
}

Channel describes an automatic update channel configuration. It can be configured to serve a static version, or forward version requests to an upstream version server. Forwarded results are cached for 1 minute.

func NewDefaultChannel

func NewDefaultChannel() (*Channel, error)

NewDefaultChannel creates a default automatic upgrade channel It looks up the TELEPORT_AUTOMATIC_UPGRADES_CHANNEL environment variable for backward compatibility, and if not found uses the default base URL. This default channel can be used in the proxy (to back its own version server) or in other Teleport processes such as integration services deploying and updating teleport agents.

func (*Channel) CheckAndSetDefaults

func (c *Channel) CheckAndSetDefaults() error

CheckAndSetDefaults checks that the Channel configuration is valid and inits the version getter and maintenance trigger of the Channel based on its configuration. This function must be called before using the channel.

func (*Channel) GetCritical

func (c *Channel) GetCritical(ctx context.Context) (bool, error)

GetCritical returns the current criticality of the channel. If io is involved, this function implements cache and is safe to call frequently.

func (*Channel) GetVersion

func (c *Channel) GetVersion(ctx context.Context) (string, error)

GetVersion returns the current version of the channel. If io is involved, this function implements cache and is safe to call frequently. If the target version major is higher than the Teleport version (the one in the Teleport binary, this is usually the proxy version), this function returns the Teleport version instead. If the version source intentionally did not specify a version, a NoNewVersionError is returned.

type Channels

type Channels map[string]*Channel

Channels is a map of Channel objects.

func (Channels) CheckAndSetDefaults

func (c Channels) CheckAndSetDefaults(features proto.Features) error

CheckAndSetDefaults checks that every Channel is valid and initializes them. It also creates default channels if they are not already present. Cloud must have the `default` and `stable/cloud` channels. Self-hosted with automatic upgrades must have the `default` channel.

func (Channels) DefaultVersion

func (c Channels) DefaultVersion(ctx context.Context) (string, error)

DefaultVersion returns the version served by the default upgrade channel.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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