cluster

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cluster provides function to interact with Kubernetes clusters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseKubeConfigClients

func ParseKubeConfigClients(value io.Reader) (map[string]Context, string, error)

ParseKubeConfigClients parses the kubeconfig file and returns a map of context names with their respective Context. It also returns the current context name.

Types

type Context

type Context struct {
	Name      string
	Namespace string
	CS        *kubernetes.Clientset
}

func NewInClusterContext

func NewInClusterContext(namespace string) (Context, error)

NewInClusterContext creates a new Context for the in-cluster configuration. An "in-cluster" configuration means that the API server will assume its running inside a pod in a Kubernetes cluster and will configure the REST client from the pod's service account token and CA certificate.

type ContextManager

type ContextManager interface {
	HasContext(string) bool
	GetContext(string) (Context, bool)
	DefaultContext() (Context, bool)
}

func NewContextManager

func NewContextManager(
	ctx context.Context,
	kubeConfig io.Reader,
	opts ContextManagerOpts,
) (ContextManager, error)

type ContextManagerOpts

type ContextManagerOpts struct {
	DisableInClusterContext bool
	CheckValidity           bool
	InClusterNamespace      string
}

Jump to

Keyboard shortcuts

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