util

package
v1.110.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 27 Imported by: 155

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ApplyClientConnectionConfigurationToRESTConfig = kubernetes.ApplyClientConnectionConfigurationToRESTConfig

ApplyClientConnectionConfigurationToRESTConfig applies the given client connection configurations to the given REST config.

Functions

func ApplyRESTOptions added in v1.50.0

func ApplyRESTOptions(restConfig *rest.Config, restOptions extensionsconfig.RESTOptions) *rest.Config

ApplyRESTOptions applies RESTOptions to the given rest.Config

func Decode

func Decode(decoder runtime.Decoder, data []byte, into runtime.Object) error

Decode takes a `decoder` and decodes the provided `data` into the provided object. The underlying `into` address is used to assign the decoded object.

func DetermineError added in v1.59.0

func DetermineError(err error, knownCodes map[gardencorev1beta1.ErrorCode]func(string) bool) error

DetermineError determines the Gardener error codes for the given error and returns an ErrorWithCodes with the error and codes.

func DetermineErrorCodes added in v1.59.0

func DetermineErrorCodes(err error, knownCodes map[gardencorev1beta1.ErrorCode]func(string) bool) []gardencorev1beta1.ErrorCode

DetermineErrorCodes determines error codes based on the given error.

func NewChartRendererForShoot

func NewChartRendererForShoot(version string) (chartrenderer.Interface, error)

NewChartRendererForShoot creates a new chartrenderer.Interface for the shoot cluster.

func NewClientForShoot

func NewClientForShoot(ctx context.Context, c client.Client, namespace string, opts client.Options, restOptions extensionsconfig.RESTOptions) (*rest.Config, client.Client, error)

NewClientForShoot returns the rest config and the client for the given shoot namespace. It first looks to use the "internal" kubeconfig (the one with in-cluster address) as in-cluster traffic is free of charge. If it cannot find that, then it fallbacks to the "external" kubeconfig (the one with external DNS name or load balancer address) and this usually translates to egress traffic costs. However, if the environment variable GARDENER_SHOOT_CLIENT=external, then it *only* checks for the external endpoint, i.e. v1beta1constants.SecretNameGardener. This is useful when connecting from outside the seed cluster on which the shoot kube-apiserver is running.

func NewRESTConfigFromKubeconfig

func NewRESTConfigFromKubeconfig(kubeconfig []byte) (*rest.Config, error)

NewRESTConfigFromKubeconfig creates a new REST config from a given Kubeconfig and returns it.

func VersionInfo

func VersionInfo(vs string) (*version.Info, error)

VersionInfo converts the given version string to version.Info (input must be a semantic version).

func VersionMajorMinor

func VersionMajorMinor(version string) (string, error)

VersionMajorMinor extracts and returns the major and the minor part of the given version (input must be a semantic version).

Types

type ImagesContext added in v1.108.0

type ImagesContext[A any, B any] struct {
	Images map[string]A
	// contains filtered or unexported fields
}

ImagesContext is a helper struct to consume cloud profile images and their versions.

func NewCoreImagesContext added in v1.108.0

func NewCoreImagesContext(profileImages []core.MachineImage) *ImagesContext[core.MachineImage, core.MachineImageVersion]

NewCoreImagesContext creates a new ImagesContext for core.MachineImage.

func NewImagesContext added in v1.108.0

func NewImagesContext[A any, B any](images map[string]A, createVersionsMap func(A) map[string]B) *ImagesContext[A, B]

NewImagesContext creates a new generic ImagesContext.

func NewV1beta1ImagesContext added in v1.108.0

NewV1beta1ImagesContext creates a new ImagesContext for gardencorev1beta1.MachineImage.

func (*ImagesContext[A, B]) GetImage added in v1.108.0

func (vc *ImagesContext[A, B]) GetImage(imageName string) (A, bool)

GetImage returns the image with the given name.

func (*ImagesContext[A, B]) GetImageVersion added in v1.108.0

func (vc *ImagesContext[A, B]) GetImageVersion(imageName string, version string) (B, bool)

GetImageVersion returns the image version with the given name and version.

type ShootClients

type ShootClients interface {
	Client() client.Client
	Clientset() kubernetes.Interface
	GardenerClientset() kubernetesclient.Interface
	ChartApplier() kubernetesclient.ChartApplier
	Version() *version.Info
}

ShootClients bundles together several clients for the shoot cluster.

func NewClientsForShoot

func NewClientsForShoot(ctx context.Context, c client.Client, namespace string, opts client.Options, restOptions extensionsconfig.RESTOptions) (ShootClients, error)

NewClientsForShoot is a utility function that creates a new clientset and a chart applier for the shoot cluster. It uses the 'gardener' secret in the given shoot namespace. It also returns the Kubernetes version of the cluster.

func NewShootClients

func NewShootClients(c client.Client, clientset kubernetes.Interface, gardenerClientset kubernetesclient.Interface, chartApplier kubernetesclient.ChartApplier, version *version.Info) ShootClients

NewShootClients creates a new shoot client interface based on the given clients.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.
secret

Jump to

Keyboard shortcuts

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