finder

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortKubectlByVersion

func SortKubectlByVersion(binaries KubectlBinaries, reverse bool)

SortKubectlByVersion sorts a list of KubectlBinary objects using their version attribute. By default objects are sorted ascendantly (from earlier to more recent versions); this can be changed via the `reverse` parameter

Types

type KubectlBinaries

type KubectlBinaries []KubectlBinary

KubectlBinaries is a list of KubectlBinary objects

type KubectlBinary

type KubectlBinary struct {
	Path    string
	Version semver.Version
}

KubectlBinary describes a kubectl binary

type KubectlFinder

type KubectlFinder struct {
	LocalBinaryPath string
	SysBinaryPath   string
}

KubectlFinder holds data about where to look the kubectl binaries

func NewKubectlFinder

func NewKubectlFinder(local, sys string) *KubectlFinder

NewKubectlFinder returns a properly initialized KubectlFinder object

func (*KubectlFinder) AllKubectlBinaries

func (f *KubectlFinder) AllKubectlBinaries(reverseSort bool) KubectlBinaries

AllKubectlBinaries returns all the kubectl binaries available to the user running kuberlr

func (*KubectlFinder) FindCompatibleKubectl

func (f *KubectlFinder) FindCompatibleKubectl(requestedVersion semver.Version) (KubectlBinary, error)

FindCompatibleKubectl returns a kubectl binary compatible with the version given via the `requestedVersion` parameter

func (*KubectlFinder) LocalKubectlBinaries

func (f *KubectlFinder) LocalKubectlBinaries() (KubectlBinaries, error)

LocalKubectlBinaries returns the list of kubectl binaries that are available only to the user currently running kuberlr

func (*KubectlFinder) MostRecentKubectlAvailable

func (f *KubectlFinder) MostRecentKubectlAvailable() (KubectlBinary, error)

MostRecentKubectlAvailable returns the most recent version of kubectl available on the system. It could be something downloaded by kuberlr or something already available on the system

func (*KubectlFinder) SystemKubectlBinaries

func (f *KubectlFinder) SystemKubectlBinaries() (KubectlBinaries, error)

SystemKubectlBinaries returns the list of kubectl binaries that are available to all the users of the system

type Versioner

type Versioner struct {
	// contains filtered or unexported fields
}

Versioner is used to manage the local kubectl binaries used by kuberlr

func NewVersioner

func NewVersioner(f iFinder) *Versioner

NewVersioner is an helper function that creates a new Versioner instance

func (*Versioner) EnsureCompatibleKubectlAvailable

func (v *Versioner) EnsureCompatibleKubectlAvailable(version semver.Version, allowDownload bool) (string, error)

EnsureCompatibleKubectlAvailable ensures the kubectl binary with the specified version is available on the system. It will return the full path to the binary

func (*Versioner) KubectlVersionToUse

func (v *Versioner) KubectlVersionToUse(timeout int64) (semver.Version, error)

KubectlVersionToUse returns the kubectl version to be used to interact with the remote server. The method takes into account different failure scenarios and acts accordingly.

Jump to

Keyboard shortcuts

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