clusterflag

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0, MIT Imports: 6 Imported by: 0

Documentation

Overview

Package clusterflag implements a flag.Value which can be used in commands to represent a Kubernetes cluster.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Flag

type Flag struct {
	StringVal string
	Provider  Provider
	Info      string
}

Flag contains the necessary information to connect to a Kubernetes cluster. Flag implements flag.Value.

func (*Flag) Cluster

func (f *Flag) Cluster(ctx context.Context) (*cluster.Cluster, error)

Cluster creates a cluster client.

func (*Flag) Get

func (f *Flag) Get() any

Get implements flag.Value.Get.

func (*Flag) Set

func (f *Flag) Set(s string) error

Set implements flag.Value.Set. Set(String()) should be idempotent.

func (*Flag) String

func (f *Flag) String() string

String implements flag.Value.String.

func (*Flag) Valid

func (f *Flag) Valid() error

Valid checks if the flag values are valid.

type Provider

type Provider string

Provider is a cluster provider.

const (
	// Kubectl is a provider using a local kubectl config.
	Kubectl Provider = "kube"

	// GKE is a provider using GKE.
	GKE Provider = "gke"
)

func (Provider) String

func (p Provider) String() string

String returns the provider name.

func (Provider) Valid

func (p Provider) Valid() bool

Valid returns whether the Provider is valid.

func (Provider) ValidInfo

func (p Provider) ValidInfo(info string) error

ValidInfo validates whether the given info is valid for this provider.

Jump to

Keyboard shortcuts

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