kubecfg

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package kubecfg builds *rest.Config instances using kubeconfig loading rules, honoring an optional kubeconfig context override. It is the shared REST config entry point for crossplane-diff commands so that every command consults the same kubeconfig the user's kubectl context points at, rather than preferring an in-cluster ServiceAccount when run inside a pod.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Provide

func Provide(p Provider) (*rest.Config, error)

Provide builds a *rest.Config using the provider's context.

Resolution order:

  1. Standard clientcmd loading rules ($KUBECONFIG, then $HOME/.kube/config).
  2. If the provider supplies a non-empty context, it overrides the kubeconfig's current-context.
  3. If no kubeconfig is available at all, fall back to the in-cluster ServiceAccount config and emit a warning to stderr.

This differs from controller-runtime's GetConfig, which prefers in-cluster first — that behavior causes `crossplane-diff` running inside a pod to ignore the user's kubeconfig context.

Types

type Context

type Context string

Context is a kubeconfig context name. Kong binds flag values through this type so providers can distinguish it from other plain strings when resolved.

type Provider

type Provider interface {
	GetKubeContext() Context
}

Provider supplies the kubeconfig context the caller wants to use. Commands implement this by exposing a --context flag.

Jump to

Keyboard shortcuts

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