base

package
v0.0.0-...-ac56535 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UbuntuOS is the special value to be places in OS field of a base to
	// indicate an operating system is an Ubuntu distro
	UbuntuOS = "ubuntu"

	// CentosOS is the special value to be places in OS field of a base to
	// indicate an operating system is a CentOS distro
	CentosOS = "centos"
)
View Source
const (
	// Daily defines if a image-stream is set to this, then you get a different
	// set of logic. In this case if you want to test drive new releases, it's
	// required that the image-stream modelconfig is set from released to
	// daily.
	Daily = "daily"
)

Variables

View Source
var LocalSeriesVersionInfo = series.LocalSeriesVersionInfo

LocalSeriesVersionInfo is patched for tests.

View Source
var Risks = []Risk{
	Stable,
	Candidate,
	Beta,
	Edge,
}

Risks is a list of the available channel risks.

View Source
var UbuntuDistroInfo = series.UbuntuDistroInfo

UbuntuDistroInfo is the path for the Ubuntu distro info file.

Functions

func AllWorkloadOSTypes

func AllWorkloadOSTypes() (set.Strings, error)

AllWorkloadOSTypes returns all the workload os types (supported or not).

func AllWorkloadVersions

func AllWorkloadVersions() (set.Strings, error)

AllWorkloadVersions returns all the workload versions (supported or not).

func DefaultOSTypeNameFromSeries

func DefaultOSTypeNameFromSeries(series string) string

DefaultOSTypeNameFromSeries returns the operating system based on the given series, defaulting to Ubuntu for unknown series.

func ESMSupportedJujuSeries

func ESMSupportedJujuSeries() []string

ESMSupportedJujuSeries returns a slice of just juju extended security maintenance supported ubuntu series.

func GetOSFromSeries

func GetOSFromSeries(series string) (ostype.OSType, error)

GetOSFromSeries will return the operating system based on the series that is passed to it

func GetSeriesFromBase

func GetSeriesFromBase(v Base) (string, error)

GetSeriesFromBase returns the series name for a given Base. This is needed to support legacy series.

func GetSeriesFromChannel

func GetSeriesFromChannel(name string, channel string) (string, error)

GetSeriesFromChannel gets the series from os name and channel.

func IsUnknownOSForSeriesError

func IsUnknownOSForSeriesError(err error) bool

IsUnknownOSForSeriesError returns true if err is of type unknownOSForSeriesError.

func LegacyKubernetesSeries

func LegacyKubernetesSeries() string

LegacyKubernetesSeries is the ubuntu series for legacy k8s charms.

func SeriesVersion

func SeriesVersion(series string) (string, error)

SeriesVersion returns the version for the specified series.

func SupportedJujuWorkloadSeries

func SupportedJujuWorkloadSeries() []string

SupportedJujuWorkloadSeries returns a slice of juju supported series that target a workload (deploying a charm).

func SupportedLts

func SupportedLts() []string

SupportedLts are the current supported LTS series in ascending order.

func UbuntuVersions

func UbuntuVersions(supported, esmSupported *bool) map[string]string

UbuntuVersions returns the ubuntu versions as a map.

func UpdateSeriesVersions

func UpdateSeriesVersions() error

UpdateSeriesVersions forces an update of the series versions by querying distro-info if possible.

Types

type Base

type Base struct {
	OS string
	// Channel is track[/risk/branch].
	// eg "22.04" or "22.04/stable" etc.
	Channel Channel
}

Base represents an OS/Channel. Bases can also be converted to and from a series string.

func ControllerBases

func ControllerBases(now time.Time, requestedBase Base, imageStream string) ([]Base, error)

ControllerBases returns the supported workload bases available to it at the execution time.

func GetBaseFromSeries

func GetBaseFromSeries(series string) (Base, error)

GetBaseFromSeries returns the Base infor for a series.

func LegacyKubernetesBase

func LegacyKubernetesBase() Base

LegacyKubernetesBase is the ubuntu base image for legacy k8s charms.

func MakeDefaultBase

func MakeDefaultBase(os string, channel string) Base

MakeDefaultBase creates a base from an os and simple version string, eg "22.04".

func MustParseBaseFromString

func MustParseBaseFromString(b string) Base

MustParseBaseFromString is like ParseBaseFromString but panics if the string is invalid.

func ParseBase

func ParseBase(os string, channel string) (Base, error)

ParseBase constructs a Base from the os and channel string.

func ParseBaseFromString

func ParseBaseFromString(b string) (Base, error)

ParseBaseFromString takes a string containing os and channel separated by @ and returns a base.

func ParseManifestBases

func ParseManifestBases(manifestBases []charm.Base) ([]Base, error)

ParseManifestBases transforms charm.Bases to Bases. This format comes out of a charm.Manifest and contains architectures which Base does not. Only unique non architecture Bases will be returned.

func ValidateBase

func ValidateBase(supportedBases []Base, base, fallbackPreferredBase Base) (Base, error)

ValidateBase attempts to validate a base if one is found, otherwise it uses the fallback base and validates that one. Returns the base it validated against or an error if one is found. Note: the selected base will be returned if there is an error to help use that for a fallback during error scenarios.

func WorkloadBases

func WorkloadBases(now time.Time, requestedBase Base, imageStream string) ([]Base, error)

WorkloadBases returns the supported workload bases available to it at the execution time.

func (Base) DisplayString

func (b Base) DisplayString() string

DisplayString returns the base string ignoring risk.

func (Base) Empty

func (b Base) Empty() bool

Empty returns true if the base is empty.

func (Base) IsCompatible

func (b Base) IsCompatible(other Base) bool

IsCompatible returns true if base other is the same underlying OS version, ignoring risk.

func (Base) String

func (b Base) String() string

type Channel

type Channel struct {
	Track string `json:"track,omitempty"`
	Risk  Risk   `json:"risk,omitempty"`
}

Channel identifies and describes completely an os channel.

A channel consists of, and is subdivided by, tracks and risk-levels:

  • Tracks represents the version of the os, eg "22.04".
  • Risk-levels represent a progressive potential trade-off between stability and new features.

The complete channel name can be structured as three distinct parts separated by slashes:

<track>/<risk>

func MakeDefaultChannel

func MakeDefaultChannel(track string) Channel

MakeDefaultChannel creates a normalized channel for the specified track with a default risk of "stable".

func ParseChannel

func ParseChannel(s string) (Channel, error)

ParseChannel parses a string representing a channel.

func ParseChannelNormalize

func ParseChannelNormalize(s string) (Channel, error)

ParseChannelNormalize parses a string representing a store channel. The returned channel's track, risk and name are normalized.

func (Channel) DisplayString

func (ch Channel) DisplayString() string

func (Channel) Empty

func (ch Channel) Empty() bool

Empty returns true if all it's components are empty.

func (Channel) Normalize

func (ch Channel) Normalize() Channel

Normalize the channel with normalized track, risk and names.

func (Channel) String

func (ch Channel) String() string

type DistroSource

type DistroSource interface {
	// Refresh will attempt to update the information it has about each distro
	// and if the distro is supported or not.
	Refresh() error

	// SeriesInfo returns the DistroInfoSerie for the series name.
	SeriesInfo(seriesName string) (series.DistroInfoSerie, bool)
}

DistroSource is the source of the underlying distro source for supported series.

type Risk

type Risk string

Risk describes the type of risk in a current channel.

const (
	Stable    Risk = "stable"
	Candidate Risk = "candidate"
	Beta      Risk = "beta"
	Edge      Risk = "edge"
)

type SeriesName

type SeriesName string

SeriesName represents a series name for distros

const (
	Precise SeriesName = "precise"
	Quantal SeriesName = "quantal"
	Raring  SeriesName = "raring"
	Saucy   SeriesName = "saucy"
	Trusty  SeriesName = "trusty"
	Utopic  SeriesName = "utopic"
	Vivid   SeriesName = "vivid"
	Wily    SeriesName = "wily"
	Xenial  SeriesName = "xenial"
	Yakkety SeriesName = "yakkety"
	Zesty   SeriesName = "zesty"
	Artful  SeriesName = "artful"
	Bionic  SeriesName = "bionic"
	Cosmic  SeriesName = "cosmic"
	Disco   SeriesName = "disco"
	Eoan    SeriesName = "eoan"
	Focal   SeriesName = "focal"
	Groovy  SeriesName = "groovy"
	Hirsute SeriesName = "hirsute"
	Impish  SeriesName = "impish"
	Jammy   SeriesName = "jammy"
	Kinetic SeriesName = "kinetic"
	Lunar   SeriesName = "lunar"
	Mantic  SeriesName = "mantic"
	Noble   SeriesName = "noble"
)
const (
	Centos7    SeriesName = "centos7"
	Centos9    SeriesName = "centos9"
	Kubernetes SeriesName = "kubernetes"
)

func (SeriesName) String

func (s SeriesName) String() string

type SupportedSeriesFunc

type SupportedSeriesFunc = func(time.Time, string, string) (set.Strings, error)

SupportedSeriesFunc describes a function that has commonality between controller and workload types.

type WorkloadType

type WorkloadType int

WorkloadType defines what type of workload the series is aimed at. Controllers only support Ubuntu systems.

const (
	// ControllerWorkloadType defines a workload type that is for controllers
	// only.
	ControllerWorkloadType WorkloadType = iota

	// OtherWorkloadType workload type is for everything else.
	// In the future we might want to differentiate this.
	OtherWorkloadType

	// UnsupportedWorkloadType is used where the series does not support
	// running Juju agents.
	UnsupportedWorkloadType
)

Jump to

Keyboard shortcuts

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