api

package
v0.1.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ProgramName = "kcpcl"
	DefaultGVRs = []string{
		"namespaces",
		"scheduling.k8s.io/v1/priorityclasses",
		"storage.k8s.io/v1/csidrivers",
		"storage.k8s.io/v1/csistoragecapacities",
		"storage.k8s.io/v1/storageclasses",
		"serviceaccounts",
		"configmaps",
		"persistentvolumes",
		"persistentvolumeclaims",
		"storage.k8s.io/v1/volumeattachments",

		"nodes",
		"storage.k8s.io/v1/csinodes",
		"pods"}
)
View Source
var (
	ErrMissingKubeConfig        = errors.New("missing kubeconfig")
	ErrMissingShootKubeConfig   = errors.New("missing shoot kubeconfig")
	ErrMissingControlKubeConfig = errors.New("missing shoot control-plane kubeconfig")
	ErrObjDirNotExist           = errors.New("obj dir not exist")
	ErrCantReadObjDir           = errors.New("cant read obj dir")
	ErrMissingObjDir            = errors.New("missing obj dir")

	ErrMissingGVRs      = errors.New("missing GVRs")
	ErrMissingLandscape = errors.New("missing gardener landscape")
	ErrMissingProject   = errors.New("missing gardener project")
	ErrMissingShoot     = errors.New("missing gardener shoot")

	ErrInvalidGVR                = errors.New("invalid GVR format")
	ErrNotFoundGVR               = errors.New("not found GVR")
	ErrGardenNameNotFound        = errors.New("garden name not found")
	ErrGardenCtlConfigLoadFailed = errors.New("failed to load gardenctl config")
	ErrCreateKubeClient          = errors.New("failed create kube client")
	ErrCreateGardenClient        = errors.New("failed create garden client")

	ErrDiscovery = errors.New("cannot discover resources")

	ErrLoadObj      = errors.New("cannot load object")
	ErrLoadTemplate = errors.New("cannot load template")
	ErrExecTemplate = errors.New("cannot execute template")
	ErrUploadFailed = errors.New("upload failed")

	ErrSaveObj        = errors.New("cannot save object")
	ErrDownloadFailed = errors.New("download failed")
)

Functions

func ParseGVR

func ParseGVR(arg string) (gvr schema.GroupVersionResource, err error)

ParseGVR parses strings like: "pods" "apps/v1/deployments" "scheduling.k8s.io/v1/priorityclasses"

func ParseGVRs

func ParseGVRs(args []string) (gvrList []schema.GroupVersionResource, err error)

Types

type CopierConfig

type CopierConfig struct {
	// KubeConfigPath represents path to source or Target kubeconfig
	KubeConfigPath string

	// ControlKubeConfigPath represents path to shoot control cluster kubeconfig.
	ControlKubeConfigPath string

	// GVRStrings represent list of GVR to download/upload int the form: '[group/][version/]resource. Ex: pods nodes
	GVRStrings []string

	PoolSize   int
	OrderKinds bool
}

CopierConfig represents input configuration for creating and initializing a ShootCopier

type ShootCoords

type ShootCoords struct {
	Landscape string
	Project   string
	Name      string
}

ShootCoords represents the coordinates of a gardner shoot cluster. It can be used to represent both the shoot and seed.

func (ShootCoords) String

func (s ShootCoords) String() string

type ShootCopier

type ShootCopier interface {
	GetConfig() CopierConfig

	GetClient() dynamic.Interface

	DownloadObjects(ctx context.Context, baseObjDir string, gvrList []schema.GroupVersionResource) error

	UploadObjects(ctx context.Context, baseObjDir string) error
}

ShootCopier offers methods to copy k8s objects from gardener shoot data and control planes (seed) to a target cluster. TODO: also offer way to copy from one shoot to another shoot later

type ShootInfo

type ShootInfo struct {
	Coords    ShootCoords
	Namespace string
}

Jump to

Keyboard shortcuts

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