connection

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package connection builds authenticated Kubernetes client configurations from CLI flags, supporting kubeconfig, direct API server, and in-cluster modes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildConfig

func BuildConfig(opts Options) (*rest.Config, error)

BuildConfig assembles a rest.Config from opts, choosing in-cluster, direct, or kubeconfig-based auth.

func NewClientset

func NewClientset(opts Options) (*kubernetes.Clientset, *rest.Config, error)

NewClientset builds a Kubernetes clientset and the underlying rest.Config from opts.

func NewDynamicClient

func NewDynamicClient(cfg *rest.Config) (dynamic.Interface, error)

NewDynamicClient builds a dynamic client for listing CRD-backed resources (Kyverno policies, Gatekeeper constraint templates) that aren't part of the typed kubernetes.Interface. Shares the rest.Config built by BuildConfig so auth and timeout knobs flow through unchanged.

Types

type Options

type Options struct {
	Kubeconfig            string
	Context               string
	APIServer             string
	Token                 string
	TokenFile             string
	CAFile                string
	ClientCertificateFile string
	ClientKeyFile         string
	InsecureSkipTLSVerify bool
	InCluster             bool
	Timeout               time.Duration
}

Options captures the connection-related CLI flags used to build a rest.Config.

Jump to

Keyboard shortcuts

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