common

package
v0.0.0-...-133fb1b Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2018 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AlertManagerDeploymentName is the name of the AlertManager deployment.
	AlertManagerDeploymentName = "alertmanager"

	// BackupSecretName defines the name of the secret containing the credentials which are required to
	// authenticate against the respective cloud provider (required by etcd-operator to store the backups
	// of Shoot clusters).
	BackupSecretName = "etcd-backup"

	// ChartPath is the path to the Helm charts.
	ChartPath = "charts"

	// ConfirmationDeletionTimestamp is an annotation on a Shoot resource whose value must be set equal to the Shoot's
	// '.metadata.deletionTimestamp' value to trigger the deletion process of the Shoot cluster.
	ConfirmationDeletionTimestamp = "confirmation.garden.sapcloud.io/deletionTimestamp"

	// DNSProvider is the key for an annotation on a Kubernetes Secret object whose value must point to a valid
	// DNS provider.
	DNSProvider = "dns.garden.sapcloud.io/provider"

	// DNSDomain is the key for an annotation on a Kubernetes Secret object whose value must point to a valid
	// domain name.
	DNSDomain = "dns.garden.sapcloud.io/domain"

	// DNSHostedZoneID is the key for an annotation on a Kubernetes Secret object whose value must point to a valid
	// DNS Hosted Zone.
	DNSHostedZoneID = "dns.garden.sapcloud.io/hostedZoneID"

	// EtcdRoleMain is the constant defining the role for main etcd storing data about objects in Shoot.
	EtcdRoleMain = "main"

	// EtcdRoleEvents is the constant defining the role for etcd storing events in Shoot.
	EtcdRoleEvents = "events"

	// GardenNamespace is a constant for the Garden namespace which holds configuration for the Gardener.
	GardenNamespace = "garden"

	// GardenRole is the key for an annotation on a Kubernetes Secret object whose value must be either 'seed' or
	// 'shoot'.
	GardenRole = "garden.sapcloud.io/role"

	// GardenRoleSeed is the value of the GardenRole key indicating type 'seed'.
	GardenRoleSeed = "seed"

	// GardenRoleDefaultDomain is the value of the GardenRole key indicating type 'default-domain'.
	GardenRoleDefaultDomain = "default-domain"

	// GardenRoleInternalDomain is the value of the GardenRole key indicating type 'internal-domain'.
	GardenRoleInternalDomain = "internal-domain"

	// GardenRoleImagePull is the value of the GardenRole key indicating type 'image-pull'.
	GardenRoleImagePull = "image-pull"

	// GardenRoleAlertingSMTP is the value of the GardenRole key indicating type 'alerting-smtp'.
	GardenRoleAlertingSMTP = "alerting-smtp"

	// GardenRoleMembers ist the value of GardenRole key indicating type 'members'.
	GardenRoleMembers = "members"

	//GardenRoleProject is the value of GardenRole key indicating type 'project'.
	GardenRoleProject = "project"

	// GardenOperatedBy is the key for an annotation of a Shoot cluster whose value must be a valid email address and
	// is used to send alerts to.
	GardenOperatedBy = "garden.sapcloud.io/operatedBy"

	// KubeAPIServerDeploymentName is the name of the kube-apiserver deployment.
	KubeAPIServerDeploymentName = "kube-apiserver"

	// KubeAddonManagerDeploymentName is the name of the kube-addon-manager deployment.
	KubeAddonManagerDeploymentName = "kube-addon-manager"

	// ProjectPrefix is the prefix of namespaces in the Garden cluster which is used for all projects created by the
	// Gardener UI.
	ProjectPrefix = "garden-"

	// PrometheusDeploymentName is the name of the Prometheus deployment.
	PrometheusDeploymentName = "prometheus"

	// TerraformerConfigSuffix is the suffix used for the ConfigMap which stores the Terraform configuration and variables declaration.
	TerraformerConfigSuffix = ".tf-config"

	// TerraformerVariablesSuffix is the suffix used for the Secret which stores the Terraform variables definition.
	TerraformerVariablesSuffix = ".tf-vars"

	// TerraformerStateSuffix is the suffix used for the ConfigMap which stores the Terraform state.
	TerraformerStateSuffix = ".tf-state"

	// TerraformerPodSuffix is the suffix used for the name of the Pod which validates the Terraform configuration.
	TerraformerPodSuffix = ".tf-pod"

	// TerraformerJobSuffix is the suffix used for the name of the Job which executes the Terraform configuration.
	TerraformerJobSuffix = ".tf-job"

	// TerraformerPurposeInfra is a constant for the complete Terraform setup with purpose 'infrastructure'.
	TerraformerPurposeInfra = "infra"

	// TerraformerPurposeInternalDNS is a constant for the complete Terraform setup with purpose 'internal cluster domain'
	TerraformerPurposeInternalDNS = "internal-dns"

	// TerraformerPurposeExternalDNS is a constant for the complete Terraform setup with purpose 'external cluster domain'.
	TerraformerPurposeExternalDNS = "external-dns"

	// TerraformerPurposeBackup is a constant for the complete Terraform setup with purpose 'etcd backup'.
	TerraformerPurposeBackup = "backup"

	// TerraformerPurposeKube2IAM is a constant for the complete Terraform setup with purpose 'kube2iam roles'.
	TerraformerPurposeKube2IAM = "kube2iam"

	// TerraformerPurposeIngress is a constant for the complete Terraform setup with purpose 'ingress'.
	TerraformerPurposeIngress = "ingress"
)

Variables

This section is empty.

Functions

func ApplyChart

func ApplyChart(k8sClient kubernetes.Client, renderer chartrenderer.ChartRenderer, chartPath, name, namespace string, defaultValues, additionalValues map[string]interface{}) error

ApplyChart takes a Kubernetes client <k8sClient>, chartRender <renderer>, path to a chart <chartPath>, name of the release <name>, release's namespace <namespace> and two maps <defaultValues>, <additionalValues>, and renders the template based on the merged result of both value maps. The resulting manifest will be applied to the cluster the Kubernetes client has been created for.

func ComputeClusterIP

func ComputeClusterIP(cidr gardenv1beta1.CIDR, lastByte byte) string

ComputeClusterIP parses the provided <cidr> and sets the last byte to the value of <lastByte>. For example, <cidr> = 100.64.0.0/11 and <lastByte> = 10 the result would be 100.64.0.10

func ComputeNonMasqueradeCIDR

func ComputeNonMasqueradeCIDR(cidr gardenv1beta1.CIDR) string

ComputeNonMasqueradeCIDR computes the CIDR range which should be non-masqueraded (this is passed as command-line flag to kubelet during its start). This range is the whole service/pod network range.

func DiskSize

func DiskSize(size string) string

DiskSize extracts the numerical component of DiskSize strings, i.e. strings like "10Gi" and returns it as string, i.e. "10" will be returned.

func DistributeOverZones

func DistributeOverZones(zoneIndex, size, zoneSize int) string

DistributeOverZones is a function which is used to determine how many nodes should be used for each availability zone. It takes the number of availability zones (<zoneSize>), the index of the current zone (<zoneIndex>) and the number of nodes which must be distributed over the zones (<size>) and returns the number of nodes which should be placed in the zone of index <zoneIndex>. The distribution happens equally. In case of an uneven number <size>, the last zone will have one more node than the others.

func EnsureImagePullSecrets

func EnsureImagePullSecrets(k8sClient kubernetes.Client, namespace string, secrets map[string]*corev1.Secret, createSecrets bool, log *logrus.Entry) error

EnsureImagePullSecrets takes a Kubernetes client <k8sClient> and a <namespace> and creates the image pull secrets stored in the Garden namespace and having the respective role label. After that it patches the default service account in that namespace by appending the names of the just created secrets to its .imagePullSecrets[] list.

func GenerateAddonConfig

func GenerateAddonConfig(values map[string]interface{}, isEnabled interface{}) map[string]interface{}

GenerateAddonConfig returns the provided <values> in case <isEnabled> is a boolean value which is true. Otherwise, nil is returned.

func GenerateTerraformVariablesEnvironment

func GenerateTerraformVariablesEnvironment(secret *corev1.Secret, keyValueMap map[string]string) []map[string]interface{}

GenerateTerraformVariablesEnvironment takes a <secret> and a <keyValueMap> and builds an environment which can be injected into the Terraformer job/pod manifest. The keys of the <keyValueMap> will be prefixed with 'TF_VAR_' and the value will be used to extract the respective data from the <secret>.

func GetLoadBalancerIngress

func GetLoadBalancerIngress(client kubernetes.Client, namespace, name string) (string, []corev1.LoadBalancerIngress, error)

GetLoadBalancerIngress takes a K8SClient, a namespace and a service name. It queries for a load balancer's technical name (ip address or hostname). It returns the value of the technical name whereby it always prefers the IP address (if given) over the hostname. It also returns the list of all load balancer ingresses.

func GetSecretKeysWithPrefix

func GetSecretKeysWithPrefix(kind string, m map[string]*corev1.Secret) []string

GetSecretKeysWithPrefix returns a list of keys of the given map <m> which are prefixed with <kind>.

func IdentifyAddressType

func IdentifyAddressType(address string) (string, net.IP)

IdentifyAddressType takes a string containing an address (hostname or IP) and tries to parse it to an IP address in order to identify whether it is a DNS name or not. It returns a tuple whereby the first element is either "ip" or "hostname", and the second the parsed IP address of type net.IP (in case the loadBalancer is an IP address, otherwise it is nil).

Types

type CloudConfigUserDataConfig

type CloudConfigUserDataConfig struct {
	CloudConfig       bool
	KubeletParameters []string
	NetworkPlugin     string
	CABundle          string
	WorkerNames       []string
}

CloudConfigUserDataConfig is a struct containing cloud-specific configuration required to render the shoot-cloud-config chart properly.

Jump to

Keyboard shortcuts

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