kubeconfig

package
v1.1.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package kubeconfig provides Kubernetes config file handling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath added in v0.7.0

func DefaultPath() (string, error)

DefaultPath returns path to ~/.kube/config.

func Generate added in v0.11.0

func Generate(in *GenerateInput, out io.Writer) error

Generate a kubeconfig for the cluster from the given Input.

func GenerateAdmin

func GenerateAdmin(config GenerateAdminInput, out io.Writer) error

GenerateAdmin generates admin kubeconfig for the cluster.

func SinglePath added in v1.1.0

func SinglePath() (string, error)

SinglePath parses KUBECONFIG and the default kubeconfig file location and ensures there is only one to return.

Types

type ConfigComponent added in v0.7.0

type ConfigComponent string

ConfigComponent identifies part of kubeconfig.

const (
	Cluster  ConfigComponent = "cluster"
	AuthInfo ConfigComponent = "auth"
	Context  ConfigComponent = "context"
)

Kubeconfig components.

type ConflictDecision added in v0.7.0

type ConflictDecision string

ConflictDecision is returned from ConflictHandler.

const (
	OverwriteDecision ConflictDecision = "overwrite"
	RenameDecision    ConflictDecision = "rename"
)

Conflict decisions.

type GenerateAdminInput added in v0.9.0

type GenerateAdminInput interface {
	Name() string
	Endpoint() *url.URL
	CA() *x509.PEMEncodedCertificateAndKey
	AdminKubeconfig() config.AdminKubeconfig
}

GenerateAdminInput is the interface for the GenerateAdmin function.

This interface is implemented by config.Cluster().

type GenerateInput added in v0.11.0

type GenerateInput struct {
	ClusterName string

	CA                  *x509.PEMEncodedCertificateAndKey
	CertificateLifetime time.Duration

	CommonName   string
	Organization string

	Endpoint    string
	Username    string
	ContextName string
}

GenerateInput are input parameters for Generate.

type MergeOptions added in v0.7.0

type MergeOptions struct {
	ForceContextName string
	ActivateContext  bool
	ConflictHandler  func(ConfigComponent, string) (ConflictDecision, error)
	OutputWriter     io.Writer
}

MergeOptions controls Merge process.

type Merger added in v0.7.0

type Merger clientcmdapi.Config

Merger handles merging of Kubernetes client config files.

func Load added in v0.7.0

func Load(path string) (*Merger, error)

Load the kubeconfig from file.

func (*Merger) Merge added in v0.7.0

func (merger *Merger) Merge(config *clientcmdapi.Config, options MergeOptions) error

Merge the provided kubernetes config in.

func (*Merger) Write added in v0.7.0

func (merger *Merger) Write(path string) error

Write the kubeconfig back to the file.

Jump to

Keyboard shortcuts

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