util

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2020 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 29 Imported by: 155

Documentation

Index

Constants

View Source
const CAChecksumAnnotation = "checksum/ca"

CAChecksumAnnotation is a resource annotation used to store the checksum of a certificate authority.

Variables

This section is empty.

Functions

func ApplyClientConnectionConfigurationToRESTConfig

func ApplyClientConnectionConfigurationToRESTConfig(clientConnection *componentbaseconfig.ClientConnectionConfiguration, rest *rest.Config)

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

func BoolPtr

func BoolPtr(b bool) *bool

BoolPtr returns a bool pointer to its argument.

func ComputeChecksum

func ComputeChecksum(data interface{}) string

ComputeChecksum computes a SHA256 checksum for the give map.

func ContextFromStopChannel

func ContextFromStopChannel(stopCh <-chan struct{}) context.Context

ContextFromStopChannel creates a new context from a given stop channel.

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 GetOrCreateShootKubeconfig

func GetOrCreateShootKubeconfig(ctx context.Context, c client.Client, certificateConfig secrets.CertificateSecretConfig, namespace string) (*corev1.Secret, error)

GetOrCreateShootKubeconfig gets or creates a Kubeconfig for a Shoot cluster which has a running control plane in the given `namespace`. If the CA of an existing Kubeconfig has changed, it creates a new Kubeconfig. Newly generated Kubeconfigs are applied with the given `client` to the given `namespace`.

func Int32Ptr

func Int32Ptr(i int32) *int32

Int32Ptr returns a int32 pointer to its argument.

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) (*rest.Config, client.Client, error)

NewClientForShoot returns the rest config and the client for the given shoot namespace.

func NewRESTConfigFromKubeconfig

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

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

func ObjectName

func ObjectName(obj runtime.Object) string

ObjectName returns the name of the given object in the format <namespace>/<name>

func QuantityPtr

func QuantityPtr(q resource.Quantity) *resource.Quantity

QuantityPtr returns a Quatity pointer to its argument

func ScaleDeployment

func ScaleDeployment(ctx context.Context, client client.Client, deployment *appsv1.Deployment, replicas int32) error

ScaleDeployment scales the given deployment.

func StringPtr

func StringPtr(s string) *string

StringPtr returns a String pointer to its argument.

func Use

func Use(_ ...interface{})

Use can be used to mark go elements as used to temporaryly avoid compiler errors due to unused elements.

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 Chart

type Chart interface {
	// Apply applies this chart in the given namespace using the given ChartApplier. Before applying the chart,
	// it collects its values, injecting images and merging the given values as needed.
	Apply(context.Context, gardenerkubernetes.ChartApplier, string, imagevector.ImageVector, string, string, map[string]interface{}) error
	// Render renders this chart in the given namespace using the given chartRenderer. Before rendering the chart,
	// it collects its values, injecting images and merging the given values as needed.
	Render(chartrenderer.Interface, string, imagevector.ImageVector, string, string, map[string]interface{}) (string, []byte, error)
	// Delete deletes this chart's objects from the given namespace.
	Delete(context.Context, client.Client, string) error
}

Chart represents a Helm chart that can be applied and deleted.

type Secrets

type Secrets interface {
	// Deploy generates and deploys the secrets into the given namespace, taking into account existing secrets.
	Deploy(context.Context, kubernetes.Interface, gardenerkubernetes.Interface, string) (map[string]*corev1.Secret, error)
	// Delete deletes the secrets from the given namespace.
	Delete(kubernetes.Interface, string) error
}

Secrets represents a set of secrets that can be deployed and deleted.

type ShootClients

type ShootClients interface {
	Client() client.Client
	Clientset() kubernetes.Interface
	GardenerClientset() gardenerkubernetes.Interface
	ChartApplier() gardener.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) (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 gardenerkubernetes.Interface, chartApplier gardener.ChartApplier, version *version.Info) ShootClients

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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