kubeconfig

package
v1.13.13 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MPL-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package kubeconfig provides Kubernetes config file generation.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidKubeconfig = errors.New("kubeconfig doesn't match the structure generated by Talos")

ErrInvalidKubeconfig is returned when the kubeconfig doesn't match the structure Talos generates.

Functions

func Generate

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 LoadAndValidate added in v1.13.10

func LoadAndValidate(data []byte) (*clientcmdapi.Config, error)

LoadAndValidate parses the kubeconfig and validates it with Validate.

This should be used for any kubeconfig which comes back over the Talos API before it is used to build a Kubernetes client or written to the operator's filesystem.

func Validate added in v1.13.10

func Validate(config *clientcmdapi.Config) error

Validate checks that the kubeconfig matches exactly the structure Generate produces: a single cluster with the server URL and the server CA, a single user with a client certificate and key, and a single context tying them together.

Types

type GenerateAdminInput

type GenerateAdminInput interface {
	Name() string
	Endpoint() *url.URL
	IssuingCA() *x509.PEMEncodedCertificateAndKey
	AcceptedCAs() []*x509.PEMEncodedCertificate
	AdminKubeconfig() config.AdminKubeconfig
}

GenerateAdminInput is the interface for the GenerateAdmin function.

This interface is implemented by config.Cluster().

type GenerateInput

type GenerateInput struct {
	ClusterName string

	IssuingCA           *x509.PEMEncodedCertificateAndKey
	AcceptedCAs         []*x509.PEMEncodedCertificate
	CertificateLifetime time.Duration

	CommonName   string
	Organization string

	Endpoint    string
	Username    string
	ContextName string
}

GenerateInput are input parameters for Generate.

Jump to

Keyboard shortcuts

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