botanist

package
v0.0.0-...-48c86bf Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2018 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Botanist

type Botanist struct {
	*operation.Operation
	DefaultDomainSecret *corev1.Secret
}

Botanist is a struct which has methods that perform cloud-independent operations for a Shoot cluster.

func New

func New(o *operation.Operation) (*Botanist, error)

New takes an operation object <o> and creates a new Botanist object. It checks whether the given Shoot DNS domain is covered by a default domain, and if so, it sets the <DefaultDomainSecret> attribute on the Botanist object.

func (*Botanist) CheckConditionControlPlaneHealthy

func (b *Botanist) CheckConditionControlPlaneHealthy(condition *gardenv1beta1.Condition) *gardenv1beta1.Condition

CheckConditionControlPlaneHealthy checks whether the control plane of the Shoot cluster is healthy, i.e. whether all containers running in the relevant namespace in the Seed cluster are healthy.

func (*Botanist) CheckConditionEveryNodeReady

func (b *Botanist) CheckConditionEveryNodeReady(condition *gardenv1beta1.Condition) *gardenv1beta1.Condition

CheckConditionEveryNodeReady checks whether every node registered at the Shoot cluster is in "Ready" state and that no node known to the IaaS is not registered to the Shoot's kube-apiserver.

func (*Botanist) CheckConditionSystemComponentsHealthy

func (b *Botanist) CheckConditionSystemComponentsHealthy(condition *gardenv1beta1.Condition) *gardenv1beta1.Condition

CheckConditionSystemComponentsHealthy checks whether every container in the kube-system namespace of the Shoot cluster is in "Running" state and that the number of available replicas per deployment matches the number of actual replicas (i.e., the number of desired pods matches the number of actual running pods).

func (*Botanist) CleanKubernetesResources

func (b *Botanist) CleanKubernetesResources() error

CleanKubernetesResources deletes all the Kubernetes resources in the Shoot cluster other than those stored in the exceptions map.

func (*Botanist) DeleteGardenSecrets

func (b *Botanist) DeleteGardenSecrets() error

DeleteGardenSecrets deletes the Shoot-specific secrets from the project namespace in the Garden cluster. TODO: Switch to putting an ownerReference of the Shoot into the Secret's metadata once garbage collection works properly.

func (*Botanist) DeleteKubeAPIServer

func (b *Botanist) DeleteKubeAPIServer() error

DeleteKubeAPIServer deletes the kube-apiserver deployment in the Seed cluster which holds the Shoot's control plane.

func (*Botanist) DeleteKubeAddonManager

func (b *Botanist) DeleteKubeAddonManager() error

DeleteKubeAddonManager deletes the kube-addon-manager deployment in the Seed cluster which holds the Shoot's control plane. It needs to be deleted before trying to remove any resources in the Shoot cluster, othwewise it will automatically recreate them and block the infrastructure deletion.

func (*Botanist) DeleteNamespace

func (b *Botanist) DeleteNamespace() error

DeleteNamespace deletes the namespace in the Seed cluster which holds the control plane components. The built-in garbage collection in Kubernetes will automatically delete all resources which belong to this namespace. This comprises volumes and load balancers as well.

func (*Botanist) DeleteSeedMonitoring

func (b *Botanist) DeleteSeedMonitoring() error

DeleteSeedMonitoring will delete the monitoring stack from the Seed cluster to avoid phantom alerts during the deletion process. More precisely, the Alertmanager and Prometheus StatefulSets will be deleted.

func (*Botanist) DeployDNSRecord

func (b *Botanist) DeployDNSRecord(terraformerPurpose, name, target string, purposeInternalDomain bool) error

DeployDNSRecord kicks off a Terraform job of name <alias> which deploys the DNS record for <name> which will point to <target>.

func (*Botanist) DeployExternalDomainDNSRecord

func (b *Botanist) DeployExternalDomainDNSRecord() error

DeployExternalDomainDNSRecord deploys the DNS record for the external cluster domain.

func (*Botanist) DeployInternalDomainDNSRecord

func (b *Botanist) DeployInternalDomainDNSRecord() error

DeployInternalDomainDNSRecord deploys the DNS record for the internal cluster domain.

func (*Botanist) DeployKubeAPIServerService

func (b *Botanist) DeployKubeAPIServerService() error

DeployKubeAPIServerService creates a Service of type 'LoadBalancer' in the Seed cluster which is used to expose the kube-apiserver deployment (of the Shoot cluster). It waits until the load balancer is available and stores the address on the Botanist's APIServerAddress attribute.

func (*Botanist) DeployMachineControllerManager

func (b *Botanist) DeployMachineControllerManager() error

DeployMachineControllerManager deploys the machine-controller-manager into the Shoot namespace in the Seed cluster. It is responsible for managing the worker nodes of the Shoot.

func (*Botanist) DeployNamespace

func (b *Botanist) DeployNamespace() error

DeployNamespace creates a namespace in the Seed cluster which is used to deploy all the control plane components for the Shoot cluster. Moreover, the cloud provider configuration and all the secrets will be stored as ConfigMaps/Secrets.

func (*Botanist) DeployNginxIngressResources

func (b *Botanist) DeployNginxIngressResources() error

DeployNginxIngressResources creates the respective wildcard DNS record for the nginx-ingress-controller.

func (*Botanist) DeploySecrets

func (b *Botanist) DeploySecrets() error

DeploySecrets creates a CA certificate for the Shoot cluster and uses it to sign the server certificate used by the kube-apiserver, and all client certificates used for communcation. It also creates RSA key pairs for SSH connections to the nodes/VMs and for the VPN tunnel. Moreover, basic authentication credentials are computed which will be used to secure the Ingress resources and the kube-apiserver itself. Server certificates for the exposed monitoring endpoints (via Ingress) are generated as well.

func (*Botanist) DeploySeedMonitoring

func (b *Botanist) DeploySeedMonitoring() error

DeploySeedMonitoring will install the Helm release "seed-monitoring" in the Seed clusters. It comprises components to monitor the Shoot cluster whose control plane runs in the Seed cluster.

func (*Botanist) DestroyDNSRecord

func (b *Botanist) DestroyDNSRecord(terraformerPurpose string, purposeInternalDomain bool) error

DestroyDNSRecord kicks off a Terraform job which destroys the DNS record.

func (*Botanist) DestroyExternalDomainDNSRecord

func (b *Botanist) DestroyExternalDomainDNSRecord() error

DestroyExternalDomainDNSRecord destroys the DNS record for the external cluster domain.

func (*Botanist) DestroyInternalDomainDNSRecord

func (b *Botanist) DestroyInternalDomainDNSRecord() error

DestroyInternalDomainDNSRecord destroys the DNS record for the internal cluster domain.

func (*Botanist) DestroyNginxIngressResources

func (b *Botanist) DestroyNginxIngressResources() error

DestroyNginxIngressResources destroys the nginx-ingress resources created by Terraform.

func (*Botanist) GenerateHeapsterConfig

func (b *Botanist) GenerateHeapsterConfig() (map[string]interface{}, error)

GenerateHeapsterConfig generates the values which are required to render the chart of heapster properly.

func (*Botanist) GenerateHelmTillerConfig

func (b *Botanist) GenerateHelmTillerConfig() (map[string]interface{}, error)

GenerateHelmTillerConfig generates the values which are required to render the chart of helm-tiller properly.

func (*Botanist) GenerateKubeLegoConfig

func (b *Botanist) GenerateKubeLegoConfig() (map[string]interface{}, error)

GenerateKubeLegoConfig generates the values which are required to render the chart of kube-lego properly.

func (*Botanist) GenerateKubernetesDashboardConfig

func (b *Botanist) GenerateKubernetesDashboardConfig() (map[string]interface{}, error)

GenerateKubernetesDashboardConfig generates the values which are required to render the chart of the kubernetes-dashboard properly.

func (*Botanist) GenerateMonocularConfig

func (b *Botanist) GenerateMonocularConfig() (map[string]interface{}, error)

GenerateMonocularConfig generates the values which are required to render the chart of monocular properly.

func (*Botanist) GenerateNginxIngressConfig

func (b *Botanist) GenerateNginxIngressConfig() (map[string]interface{}, error)

GenerateNginxIngressConfig generates the values which are required to render the chart of the nginx-ingress-controller properly.

func (*Botanist) GenerateTerraformCloudDNSVariablesEnvironment

func (b *Botanist) GenerateTerraformCloudDNSVariablesEnvironment(purposeInternalDomain bool) ([]map[string]interface{}, error)

GenerateTerraformCloudDNSVariablesEnvironment generates the environment containing the credentials which are required to validate/apply/destroy the Terraform configuration. These environment must contain Terraform variables which are prefixed with TF_VAR_.

func (*Botanist) GenerateTerraformDNSConfig

func (b *Botanist) GenerateTerraformDNSConfig(name, hostedZoneID string, values []string) map[string]interface{}

GenerateTerraformDNSConfig creates the Terraform variables and the Terraform config (for the DNS record) and returns them (these values will be stored as a ConfigMap and a Secret in the Garden cluster.

func (*Botanist) GenerateTerraformRoute53VariablesEnvironment

func (b *Botanist) GenerateTerraformRoute53VariablesEnvironment(purposeInternalDomain bool) ([]map[string]interface{}, error)

GenerateTerraformRoute53VariablesEnvironment generates the environment containing the credentials which are required to validate/apply/destroy the Terraform configuration. These environment must contain Terraform variables which are prefixed with TF_VAR_.

func (*Botanist) PerformGarbageCollectionSeed

func (b *Botanist) PerformGarbageCollectionSeed() error

PerformGarbageCollectionSeed performs garbage collection in the Shoot namespace in the Seed cluster, i.e., it deletes old replica sets which have a desired=actual=0 replica count.

func (*Botanist) PerformGarbageCollectionShoot

func (b *Botanist) PerformGarbageCollectionShoot() error

PerformGarbageCollectionShoot performs garbage collection in the kube-system namespace in the Shoot cluster, i.e., it deletes evicted pods (mitigation for https://github.com/kubernetes/kubernetes/issues/55051).

func (*Botanist) RegisterAsSeed

func (b *Botanist) RegisterAsSeed() error

RegisterAsSeed registers a Shoot cluster as a Seed in the Garden cluster.

func (*Botanist) UnregisterAsSeed

func (b *Botanist) UnregisterAsSeed() error

UnregisterAsSeed unregisters a Shoot cluster as a Seed in the Garden cluster.

func (*Botanist) WaitUntilKubeAPIServerIsReady

func (b *Botanist) WaitUntilKubeAPIServerIsReady() error

WaitUntilKubeAPIServerIsReady waits until the kube-apiserver pod has a condition in its status which marks that it is ready.

func (*Botanist) WaitUntilKubeAPIServerServiceIsReady

func (b *Botanist) WaitUntilKubeAPIServerServiceIsReady() error

WaitUntilKubeAPIServerServiceIsReady waits until the external load balancer of the kube-apiserver has been created (i.e., its ingress information has been updated in the service status).

func (*Botanist) WaitUntilKubeAddonManagerDeleted

func (b *Botanist) WaitUntilKubeAddonManagerDeleted() error

WaitUntilKubeAddonManagerDeleted waits until the kube-addon-manager deployment within the Seed cluster has been deleted.

func (*Botanist) WaitUntilKubernetesResourcesCleaned

func (b *Botanist) WaitUntilKubernetesResourcesCleaned() error

WaitUntilKubernetesResourcesCleaned will check whether all the Kubernetes resources in the Shoot cluster other than those stored in the exceptions map have been deleted. It will return an error in case it has not finished yet, and nil if all resources are gone.

func (*Botanist) WaitUntilNamespaceDeleted

func (b *Botanist) WaitUntilNamespaceDeleted() error

WaitUntilNamespaceDeleted waits until the namespace of the Shoot cluster within the Seed cluster is deleted.

func (*Botanist) WaitUntilVPNConnectionExists

func (b *Botanist) WaitUntilVPNConnectionExists() error

WaitUntilVPNConnectionExists waits until a port forward connection to the vpn-shoot pod in the kube-system namespace of the Shoot cluster can be established.

type ControlPlaneSecret

type ControlPlaneSecret struct {
	TLSSecret
	KubeconfigRequired                 bool
	KubeconfigWithBasicAuth            bool
	KubeconfigUseInternalClusterDomain bool
	RunsInSeed                         bool
}

ControlPlaneSecret is a struct which inherits from TLSSecret and is extended with a couple of additional properties. A control plane secret will always contain a client certificate and optionally a kubeconfig.

  • KubeconfigRequired specifies whether a Kubeconfig should be created or not.
  • KubeconfigWithBasicAuth specifies whether the generated Kubeconfig should contain the basic authentication credentials (beneath the client certificate).
  • KubeconfigUseInternalClusterDomain specifies whether the technical load balancer address or the cluster domain should be used in the Kubeconfig.
  • RunsInSeed specifies whether the component using the generated Kubeconfig runs in the Seed cluster (which means it can communicate with the kube-apiserver locally).

type RSASecret

type RSASecret struct {
	Secret
	Bits int
}

RSASecret is a struct which inherits from Secret (i.e., it gets a name) and which allows specifying the number of bits which should be used for the to-be-created RSA private key. A RSASecret always contains the corresponding public key as well. * Bits is the number of bits for the RSA private key.

type Secret

type Secret struct {
	Name       string
	DoNotApply bool
}

Secret is a struct which contains a name and is used to be inherited from for more advanced secrets.

  • DoNotApply is a boolean value which can be used to prevent creating the Secret in the Seed cluster. This can be useful to generate secrets which will be used in the Shoot cluster (whose API server might not be available yet).

type TLSSecret

type TLSSecret struct {
	Secret
	CommonName   string
	Organization []string
	DNSNames     []string
	IPAddresses  []net.IP
	IsServerCert bool
}

TLSSecret is a struct which inherits from Secret (i.e., it gets a name) and which allows specifying the required properties for the to-be-created certificate. It always contains a 2048-bit RSA private key and can be either a server of a client certificate.

  • CommonName is the common name used in the certificate.
  • Organization is a list of organizations used in the certificate.
  • DNSNames is a list of DNS names for the Subject Alternate Names list.
  • IPAddresses is a list of IP addresses for the Subject Alternate Names list.
  • IsServerCert specifies whether the certificate should be a server certificate (if not, a client certificate will be created).

Jump to

Keyboard shortcuts

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