kubeconfig

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package internal provides function to update kubeconfigs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDefaultKubeconfigPath

func GetDefaultKubeconfigPath() string

GetDefaultKubeconfigPath Returns the default path for the kubeconfig file based on the system

Types

type ClusterExporter

type ClusterExporter interface {
	GetConfigCluster() *clientcmdapi.Cluster
	GetConfigAuthInfo() *clientcmdapi.AuthInfo
	GetUniqueID() string
}

type Endpointer

type Endpointer interface {
	GetEndpoint() string
}

type Kubeconfig

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

func LoadKubeconfig

func LoadKubeconfig(kubeconfigpath string) (*Kubeconfig, error)

func New added in v0.1.0

func New() *Kubeconfig

func (*Kubeconfig) AddCluster

func (k *Kubeconfig) AddCluster(cls ClusterExporter, ctxName string)

func (*Kubeconfig) GetClusters

func (k *Kubeconfig) GetClusters() (map[string]cluster.Cluster, error)

Return all the clusters from a kubeconfig file the data

func (*Kubeconfig) IsExported

func (k *Kubeconfig) IsExported(cls Endpointer) bool

IsExported will check if the cluster is already exporter in the kubeconfig file We consider a cluster "exported" if we have: * a `cluster` with the same Endpoint * a context for the cluster

func (*Kubeconfig) Persist

func (k *Kubeconfig) Persist(path string) error

Persist the kubeconfig to the disk

Jump to

Keyboard shortcuts

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