Documentation ¶
Index ¶
- Constants
- func ApplyClientConnectionConfigurationToRESTConfig(clientConnection *componentbaseconfig.ClientConnectionConfiguration, ...)
- func BoolPtr(b bool) *bool
- func ComputeChecksum(data interface{}) string
- func ContextFromStopChannel(stopCh <-chan struct{}) context.Context
- func GetGardenerSecret(ctx context.Context, client client.Client, namespace string) (*corev1.Secret, error)
- func GetKubeconfigFromSecret(secret *corev1.Secret) (*restclient.Config, error)
- func GetOrCreateShootKubeconfig(ctx context.Context, client client.Client, ...) (*corev1.Secret, error)
- func GetReplicaCount(shoot *gardenv1beta1.Shoot, count int) int
- func GetSecretByRef(ctx context.Context, c client.Client, ref corev1.SecretReference) (*corev1.Secret, error)
- func Int32Ptr(i int32) *int32
- func NewChartRendererForShoot(version string) (chartrenderer.Interface, error)
- func NewRESTConfigFromKubeconfig(kubeconfig []byte) (*rest.Config, error)
- func ObjectName(obj runtime.Object) string
- func QuantityPtr(q resource.Quantity) *resource.Quantity
- func ScaleDeployment(ctx context.Context, client client.Client, deployment *appsv1.Deployment, ...) error
- func StringPtr(s string) *string
- func VersionInfo(vs string) (*version.Info, error)
- func VersionMajorMinor(version string) (string, error)
- func WaitUntilResourceDeleted(ctx context.Context, c client.Client, obj runtime.Object, ...) error
- type Chart
- type Secrets
- type ShootClients
Constants ¶
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 ComputeChecksum ¶
func ComputeChecksum(data interface{}) string
ComputeChecksum computes a SHA256 checksum for the give map.
func ContextFromStopChannel ¶
ContextFromStopChannel creates a new context from a given stop channel.
func GetGardenerSecret ¶
func GetGardenerSecret(ctx context.Context, client client.Client, namespace string) (*corev1.Secret, error)
GetGardenerSecret gets the secret from the given namespace which contains certificate information as well as the Kubeconfig for a Shoot cluster.
func GetKubeconfigFromSecret ¶
func GetKubeconfigFromSecret(secret *corev1.Secret) (*restclient.Config, error)
GetKubeconfigFromSecret gets the Kubeconfig from the passed secret.
func GetOrCreateShootKubeconfig ¶
func GetOrCreateShootKubeconfig(ctx context.Context, client 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 GetReplicaCount ¶
func GetReplicaCount(shoot *gardenv1beta1.Shoot, count int) int
GetReplicaCount returns the given replica count base on the hibernation status of the shoot.
func GetSecretByRef ¶
func GetSecretByRef(ctx context.Context, c client.Client, ref corev1.SecretReference) (*corev1.Secret, error)
GetSecretByRef reads the secret given by the reference and returns it.
func NewChartRendererForShoot ¶
func NewChartRendererForShoot(version string) (chartrenderer.Interface, error)
NewChartRendererForShoot creates a new chartrenderer.Interface for the shoot cluster.
func NewRESTConfigFromKubeconfig ¶
NewRESTConfigFromKubeconfig creates a new REST config from a given Kubeconfig and returns it.
func ObjectName ¶
ObjectName returns the name of the given object in the format <namespace>/<name>
func QuantityPtr ¶
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 VersionInfo ¶
VersionInfo converts the given version string to version.Info (input must be a semantic version).
func VersionMajorMinor ¶
VersionMajorMinor extracts and returns the major and the minor part of the given version (input must be a semantic version).
func WaitUntilResourceDeleted ¶
func WaitUntilResourceDeleted(ctx context.Context, c client.Client, obj runtime.Object, interval time.Duration) error
WaitUntilResourceDeleted deletes the given resource and then waits until it has been deleted. It respects the given interval and timeout. TODO: Remove and use https://github.com/gardener/gardener/blob/master/pkg/utils/kubernetes/kubernetes.go#L105 once new version of github.com/gardener/gardener can be vendored.
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(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.