pkg

package
v0.0.0-...-7e19821 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const GcloudDefaultFormat = "gke_{{ .Project }}_{{ .Cluster.Location }}_{{ .Cluster.Name }}"

GcloudDefaultFormat is the default context format used by the gcloud get-credentials command.

Variables

This section is empty.

Functions

func DefaultContextName

func DefaultContextName(project string, cluster Cluster) (string, error)

DefaultContextName returns the default context name used by the gcloud get-credentials command.

Types

type Cluster

type Cluster struct {
	Name                     string `json:"name"`
	Server                   string `json:"server"`
	Location                 string `json:"location"`
	CertificateAuthorityData []byte `json:"certificateAuthorityData"`
}

func GetCluster

func GetCluster(
	ctx context.Context,
	project, location, name string,
) (*Cluster, error)

func GetClusters

func GetClusters(
	ctx context.Context,
	selector labels.Selector,
	project, location string,
) ([]Cluster, error)

type ContextNameFactory

type ContextNameFactory interface {
	// For returns the context name for the combined project and cluster properties.
	For(string, Cluster) (string, error)
}

type Credentials

type Credentials struct {
	AccessToken string    `json:"access_token"`
	ExpiryTime  time.Time `json:"token_expiry"`
}

func GetGcpCredentials

func GetGcpCredentials(ctx context.Context) (*Credentials, error)

type TemplateFactory

type TemplateFactory struct {
	Format string
	// contains filtered or unexported fields
}

func NewContextNameFactory

func NewContextNameFactory(fallbackFormat string) (*TemplateFactory, error)

NewContextNameFactory returns a new ContextNameFactory, preferring the format string in `$KUBECTL_GKE_CONTEXT_FORMAT` over the provided string.

func (TemplateFactory) For

func (c TemplateFactory) For(project string, cluster Cluster) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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