edgectl

package
v1.13.4 Latest Latest
Warning

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

Go to latest
Published: May 11, 2021 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AESInstall

func AESInstall(cmd *cobra.Command, args []string) error

func AOSSUpgrade

func AOSSUpgrade(cmd *cobra.Command, args []string) error

func NewClusterInfo

func NewClusterInfo(kubectl Kubectl) clusterInfo

func NewLoggingWriter added in v1.8.0

func NewLoggingWriter(l *log.Logger) io.Writer

NewLoggingWriter returns an io.Writer that logs each write line-by-line blindly passing through non-UTF-8 and over-long lines.

Types

type AdditionalDatum

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

AdditionalDatum represents a key-value pair that may be used in template expansion

type Installer

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

Installer represents the state of the installation process

func NewInstaller

func NewInstaller(verbose bool) *Installer

NewInstaller returns an Installer object after setting up logging.

func (*Installer) AskEmail

func (i *Installer) AskEmail() (string, Result)

func (*Installer) Capture

func (i *Installer) Capture(name string, logToStdout bool, input string, args ...string) (res string, err error)

Capture calls a command and returns its stdout

func (*Installer) CheckACMEIsDone

func (i *Installer) CheckACMEIsDone() error

CheckACMEIsDone queries the Host object and succeeds if its state is Ready.

func (*Installer) CheckAESHealth

func (i *Installer) CheckAESHealth() error

CheckAESHealth retrieves AES's idea of whether it is healthy, i.e. ready.

func (*Installer) CheckAESServesACME

func (i *Installer) CheckAESServesACME() (err error)

CheckAESServesACME performs the same checks that the edgestack.me name service performs against the AES load balancer host

func (*Installer) CheckHostnameFound

func (i *Installer) CheckHostnameFound() error

CheckHostnameFound tries to connect to check-blah.hostname to see whether DNS has propagated. Each connect talks to a different hostname to try to avoid NXDOMAIN caching.

func (*Installer) ConfigureTLS

func (i *Installer) ConfigureTLS(emailAddress string) (string, string, *http.Response, Result)

ConfigureTLS configures TLS for a valid email address

func (*Installer) CreateNamespace

func (i *Installer) CreateNamespace() error

CreateNamespace creates the namespace for installing AES

func (*Installer) FindMatchingHostResource

func (i *Installer) FindMatchingHostResource() (*k8s.Resource, error)

FindMatchingHostResource returns a Host resource from the cluster that matches the load balancer's address. The Host resource must refer to a *.edgestack.me domain and be in the Ready state.

func (*Installer) FindingRepositoriesAndVersions

func (i *Installer) FindingRepositoriesAndVersions()

func (*Installer) GrabAESInstallID

func (i *Installer) GrabAESInstallID() error

GrabAESInstallID uses "kubectl exec" to ask the AES pod for the cluster's ID, which we uses as the AES install ID. This has the side effect of making sure the Pod is Running (though not necessarily Ready). This should be good enough to report the "deploy" status to metrics.

func (*Installer) GrabLoadBalancerAddress

func (i *Installer) GrabLoadBalancerAddress() error

GrabLoadBalancerAddress retrieves the AES service load balancer's address (IP address or hostname)

func (*Installer) HostnameMatchesLBAddress

func (i *Installer) HostnameMatchesLBAddress(hostname string) bool

HostnameMatchesLBAddress returns whether a *.edgestack.me hostname matches a load balancer address, which may be a name or an IP.

func (*Installer) NewSimpleKubectl

func (i *Installer) NewSimpleKubectl() (res SimpleKubectl, err error)

NewSimpleKubectl creates a new, simple kubectl runner

func (*Installer) Perform

func (i *Installer) Perform(kcontext, cloudConnectToken string) Result

Perform is the main function for the installer

func (*Installer) Quit

func (i *Installer) Quit()

func (*Installer) Report

func (i *Installer) Report(eventName string, meta ...client.ScoutMeta)

Report sends an event to Metriton

func (*Installer) SetMetadatum

func (i *Installer) SetMetadatum(name, key string, value interface{})

SetMetadatum adds a key-value pair to the metrics extra traits field. All collected metadata is passed with every subsequent report to Metriton.

func (*Installer) ShowACMEFailed

func (i *Installer) ShowACMEFailed(reason string)

func (*Installer) ShowAESAlreadyInstalled

func (i *Installer) ShowAESAlreadyInstalled()

AES already installed

func (*Installer) ShowAESCRDsButNoAESInstallation

func (i *Installer) ShowAESCRDsButNoAESInstallation()

func (*Installer) ShowAESConfiguringTLS

func (i *Installer) ShowAESConfiguringTLS()

func (*Installer) ShowAESExistingVersion

func (i *Installer) ShowAESExistingVersion(versionName string, method string)

func (*Installer) ShowAESInstallAddress

func (i *Installer) ShowAESInstallAddress(address string)

func (*Installer) ShowAESInstallationComplete

func (i *Installer) ShowAESInstallationComplete()

AES installation complete!

func (*Installer) ShowAESInstallationCompleteNoDNS

func (i *Installer) ShowAESInstallationCompleteNoDNS()

AES installation complete, but no DNS.

func (*Installer) ShowAESInstallationPartiallyComplete

func (i *Installer) ShowAESInstallationPartiallyComplete()

AES installation partially complete -- other instructions follow.

func (*Installer) ShowAESRespondingToACME

func (i *Installer) ShowAESRespondingToACME()

func (*Installer) ShowAESVersionBeingInstalled

func (i *Installer) ShowAESVersionBeingInstalled()

func (*Installer) ShowAOSSExistingVersion

func (i *Installer) ShowAOSSExistingVersion(versionName string, method string)

func (*Installer) ShowAcquiringDNSName

func (i *Installer) ShowAcquiringDNSName(hostname string)

func (*Installer) ShowBeginAESInstallation

func (i *Installer) ShowBeginAESInstallation()

func (*Installer) ShowBeginAOSSUpgrade

func (i *Installer) ShowBeginAOSSUpgrade()

func (*Installer) ShowCheckingAESPodDeployment

func (i *Installer) ShowCheckingAESPodDeployment()

func (*Installer) ShowDownloadingImages

func (i *Installer) ShowDownloadingImages()

func (*Installer) ShowExistingHostFound

func (i *Installer) ShowExistingHostFound(name, namespace string)

func (*Installer) ShowFailedToCreateDNSName

func (i *Installer) ShowFailedToCreateDNSName(message string)

func (*Installer) ShowFailedWhenLookingForExistingVersion

func (i *Installer) ShowFailedWhenLookingForExistingVersion()

func (*Installer) ShowFirstInstalling

func (i *Installer) ShowFirstInstalling()

First message when beginning the AES Installation process

func (*Installer) ShowFirstUpgrading

func (i *Installer) ShowFirstUpgrading()

func (*Installer) ShowInstalling

func (i *Installer) ShowInstalling(version string)

func (*Installer) ShowLocalClusterDetected

func (i *Installer) ShowLocalClusterDetected()

func (*Installer) ShowLookingForExistingHost

func (i *Installer) ShowLookingForExistingHost()

func (*Installer) ShowObtainingTLSCertificate

func (i *Installer) ShowObtainingTLSCertificate()

func (*Installer) ShowOverridingChartVersion

func (i *Installer) ShowOverridingChartVersion(aesChartVersion string, version string)

func (*Installer) ShowOverridingHelmRepo

func (i *Installer) ShowOverridingHelmRepo(aesHelmRepo string, repo string)

func (*Installer) ShowOverridingImageRepo

func (i *Installer) ShowOverridingImageRepo(aesImageRepo string, repo string)

func (*Installer) ShowOverridingImageTag

func (i *Installer) ShowOverridingImageTag(aesImageTag string, tag string)

func (*Installer) ShowOverridingInstallOption

func (i *Installer) ShowOverridingInstallOption(optionTag string, tagValue string)

func (*Installer) ShowProvisioningLoadBalancer

func (i *Installer) ShowProvisioningLoadBalancer()

func (*Installer) ShowRequestEmail

func (i *Installer) ShowRequestEmail()

func (*Installer) ShowResult

func (i *Installer) ShowResult(r Result)

func (*Installer) ShowScoutDisabled

func (i *Installer) ShowScoutDisabled()

func (*Installer) ShowTLSConfiguredSuccessfully

func (i *Installer) ShowTLSConfiguredSuccessfully()

func (*Installer) ShowTemplated

func (i *Installer) ShowTemplated(text string, more ...AdditionalDatum)

ShowTemplated displays a string to the user (using ShowWrapped) after rendering the supplied text as a template using values from the installer object and the additional parameters. It also processes color tags. TODO: Fix color tag processing so it is effective on Windows.

func (*Installer) ShowTimedOut

func (i *Installer) ShowTimedOut(what string)

func (*Installer) ShowUpgrading

func (i *Installer) ShowUpgrading(version string)

func (*Installer) ShowWaiting

func (i *Installer) ShowWaiting(what string)

func (*Installer) ShowWrapped

func (i *Installer) ShowWrapped(texts ...string)

ShowWrapped displays to the user (via the show logger) the text items passed in with word wrapping applied. Leading and trailing newlines are dropped in each text item (to make it easier to use multiline constants), but newlines within each item are preserved. Use an empty string item to include a blank line in the output between other items.

type Kubectl

type Kubectl interface {
	Runner

	Create(what, name, namespace string) error
	Apply(content, namespace string) error
	Get(what, name, namespace string) (*unstructured.Unstructured, error)
	List(what, namespace string, labels []string) (*unstructured.Unstructured, error)
	Exec(pod, cont, namespace string, args ...string) (string, error)
	Describe(what, namespace string) (string, error)
	Logs(what, namespace string, args ...string) (string, error)
	Version() (KubernetesVersion, error)
	ClusterInfo() (string, error)

	WithStdin(io.Reader) Kubectl
	WithStdout(io.Writer) Kubectl
	WithStderr(io.Writer) Kubectl
}

Kubectl is a simple interface for an abstract kubectl

type KubernetesVersion

type KubernetesVersion struct {
	Client k8sVersion.Info `json:"clientVersion"`
	Server k8sVersion.Info `json:"serverVersion"`
}

type LoopFailedError

type LoopFailedError string

LoopFailedError is a fatal error for loopUntil(...)

func (LoopFailedError) Error

func (s LoopFailedError) Error() string

Error implements error

type Result

type Result struct {
	Report       string // Action to report to Metriton
	ShortMessage string // Short human-readable error message
	Message      string // Message to show to the user
	TryAgain     bool   // Whether to show the "try again" message (TODO: Is this necessary?)
	URL          string // Docs URL to show and open
	Err          error  // Error condition (nil -> successful installation)
}

Result represents the result of an installation attempt

func UnhandledErrResult

func UnhandledErrResult(err error) Result

UnhandledErrResult returns a minimal Result that passes along an error but otherwise does not do anything. It is intended for transitional use, until *every* error is handled explicitly to yield a meaningful Result.

type Runner

type Runner interface {
	Run(args ...string) error
}

type SimpleKubectl

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

SimpleKubectl is a simple `kubectl` wrapper

func (SimpleKubectl) Apply

func (k SimpleKubectl) Apply(content, namespace string) error

func (SimpleKubectl) ClusterInfo

func (k SimpleKubectl) ClusterInfo() (string, error)

func (SimpleKubectl) Create

func (k SimpleKubectl) Create(what, name, namespace string) error

func (SimpleKubectl) Describe

func (k SimpleKubectl) Describe(what, namespace string) (string, error)

func (SimpleKubectl) Exec

func (k SimpleKubectl) Exec(pod, cont, namespace string, args ...string) (string, error)

func (SimpleKubectl) Get

func (k SimpleKubectl) Get(what, name, namespace string) (*unstructured.Unstructured, error)

func (SimpleKubectl) List

func (k SimpleKubectl) List(what, namespace string, labels []string) (*unstructured.Unstructured, error)

func (SimpleKubectl) Logs

func (k SimpleKubectl) Logs(what, namespace string, args ...string) (string, error)

func (SimpleKubectl) Run

func (k SimpleKubectl) Run(args ...string) error

func (SimpleKubectl) RunAsBytes

func (k SimpleKubectl) RunAsBytes(args ...string) ([]byte, error)

func (SimpleKubectl) RunAsUnstructured

func (k SimpleKubectl) RunAsUnstructured(args ...string) (*unstructured.Unstructured, error)

func (SimpleKubectl) Version

func (k SimpleKubectl) Version() (KubernetesVersion, error)

func (SimpleKubectl) WithStderr

func (k SimpleKubectl) WithStderr(writer io.Writer) Kubectl

func (SimpleKubectl) WithStdin

func (k SimpleKubectl) WithStdin(reader io.Reader) Kubectl

func (SimpleKubectl) WithStdout

func (k SimpleKubectl) WithStdout(writer io.Writer) Kubectl

type UnstructuredAmbassadorInstallation

type UnstructuredAmbassadorInstallation struct {
	unstructured.Unstructured
}

UnstructuredAmbassadorInstallation is an unstructured version of the AmbassadorInstallation CRD. Instead of importing the AmbassadorInstallation from the Operator, we keep it as an Unstructured, so we remove this problematic dependency...

func (UnstructuredAmbassadorInstallation) GetConditions

func (u UnstructuredAmbassadorInstallation) GetConditions() []map[string]interface{}

func (UnstructuredAmbassadorInstallation) GetFlavor

func (UnstructuredAmbassadorInstallation) GetInstallOSS

func (u UnstructuredAmbassadorInstallation) GetInstallOSS() bool

func (UnstructuredAmbassadorInstallation) GetInstalledVersion

func (u UnstructuredAmbassadorInstallation) GetInstalledVersion() (string, error)

func (UnstructuredAmbassadorInstallation) IsEmpty

func (UnstructuredAmbassadorInstallation) IsInstalled

func (u UnstructuredAmbassadorInstallation) IsInstalled() bool

func (UnstructuredAmbassadorInstallation) LastCondition

func (u UnstructuredAmbassadorInstallation) LastCondition() map[string]interface{}

LastCondition returns the last condition

func (UnstructuredAmbassadorInstallation) LastConditionExplain

func (u UnstructuredAmbassadorInstallation) LastConditionExplain() (string, string)

func (UnstructuredAmbassadorInstallation) SetInstallOSS

func (u UnstructuredAmbassadorInstallation) SetInstallOSS(installOSS bool) error

type Upgrader

type Upgrader struct {
	Installer
}

func NewUpgrader

func NewUpgrader(verbose bool) *Upgrader

NewUpgrader returns an Installer object after setting up logging.

func (*Upgrader) Perform

func (i *Upgrader) Perform(kcontext string) Result

Perform is the main function for the upgrader

Jump to

Keyboard shortcuts

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