common

package
v0.0.0-...-32fc51b Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2018 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AlertManagerStatefulSetName is the name of the alertmanager stateful set.
	AlertManagerStatefulSetName = "alertmanager"

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

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

	// CloudConfigPrefix is a constant for the prefix which is added to secret storing the original cloud config (which
	// is being downloaded from the cloud-config-downloader process)
	CloudConfigPrefix = "cloud-config"

	// CloudProviderSecretName is the name of the secret containing the cloud provider credentials.
	CloudProviderSecretName = "cloudprovider"

	// CloudProviderConfigName is the name of the configmap containing the cloud provider config.
	CloudProviderConfigName = "cloud-provider-config"

	// CloudProviderConfigMapKey is the key storing the cloud provider config as value in the cloud provider configmap.
	CloudProviderConfigMapKey = "cloudprovider.conf"

	// CloudPurposeShoot is a constant used while instantiating a cloud botanist for the Shoot cluster.
	CloudPurposeShoot = "shoot"

	// CloudPurposeSeed is a constant used while instantiating a cloud botanist for the Seed cluster.
	CloudPurposeSeed = "seed"

	// ClusterAutoscalerDeploymentName is the name of the cluster-autoscaler deployment.
	ClusterAutoscalerDeploymentName = "cluster-autoscaler"

	// ConfirmationDeletion is an annotation on a Shoot resource whose value must be set to "true" in order to
	// allow deleting the Shoot (if the annotation is not set any DELETE request will be denied).
	ConfirmationDeletion = "confirmation.garden.sapcloud.io/deletion"

	// ControllerManagerInternalConfigMapName is the name of the internal config map in which the Gardener controller
	// manager stores its configuration.
	ControllerManagerInternalConfigMapName = "gardener-controller-manager-internal-config"

	// 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 the namespace in which the configuration and secrets for
	// the Gardener controller manager will be stored (e.g., secrets for the Seed clusters).
	// It is also used by the gardener-apiserver.
	GardenNamespace = "garden"

	// GardenRole is the key for an annotation on a Kubernetes object indicating what it is used for.
	GardenRole = "garden.sapcloud.io/role"

	// GardenRoleShoot is the value of the GardenRole key indicating type 'shoot'.
	GardenRoleShoot = "shoot"

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

	// GardenRoleControlPlane is the value of the GardenRole key indicating type 'controlplane'.
	GardenRoleControlPlane = "controlplane"

	// GardenRoleSystemComponent is the value of the GardenRole key indicating type 'system-component'.
	GardenRoleSystemComponent = "system-component"

	// GardenRoleMonitoring is the value of the GardenRole key indicating type 'monitoring'.
	GardenRoleMonitoring = "monitoring"

	// GardenRoleOptionalAddon is the value of the GardenRole key indicating type 'optional-addon'.
	GardenRoleOptionalAddon = "optional-addon"

	// GardenRoleLogging is the value of the GardenRole key indicating type 'logging'.
	GardenRoleLogging = "logging"

	// 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"

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

	// GardenRoleOpenVPNDiffieHellman is the value of the GardenRole key indicating type 'openvpn-diffie-hellman'.
	GardenRoleOpenVPNDiffieHellman = "openvpn-diffie-hellman"

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

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

	//GardenRoleBackup is the value of GardenRole key indicating type 'backup'.
	GardenRoleBackup = "backup"

	// GardenCreatedBy is the key for an annotation of a Shoot cluster whose value indicates contains the username
	// of the user that created the resource.
	GardenCreatedBy = "garden.sapcloud.io/createdBy"

	// 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"

	// GardenPurpose is a key for a label describing the purpose of the respective object.
	GardenPurpose = "garden.sapcloud.io/purpose"

	// IngressPrefix is the part of a FQDN which will be used to construct the domain name for an ingress controller of
	// a Shoot cluster. For example, when a Shoot specifies domain 'cluster.example.com', the ingress domain would be
	// '*.<IngressPrefix>.cluster.example.com'.
	IngressPrefix = "ingress"

	// InternalDomainKey is a key which must be present in an internal domain constructed for a Shoot cluster. If the
	// configured internal domain already contains it, it won't be added twice. If it does not contain it, it will be
	// appended.
	InternalDomainKey = "internal"

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

	// AWSLBReadvertiserDeploymentName is the name for the aws-lb-readvertiser
	AWSLBReadvertiserDeploymentName = "aws-lb-readvertiser"

	// EnableHPANodeCount is the number of nodes in shoot cluster after which HPA is deployed to autoscale kube-apiserver.
	EnableHPANodeCount = 5

	// CloudControllerManagerDeploymentName is the name of the cloud-controller-manager deployment.
	CloudControllerManagerDeploymentName = "cloud-controller-manager"

	// CloudControllerManagerServerName is the name of the cloud-controller-manager server.
	CloudControllerManagerServerName = "cloud-controller-manager-server"

	// KubeControllerManagerDeploymentName is the name of the kube-controller-manager deployment.
	KubeControllerManagerDeploymentName = "kube-controller-manager"

	// KubeControllerManagerServerName is the name of the kube-controller-manager server.
	KubeControllerManagerServerName = "kube-controller-manager-server"

	// MachineControllerManagerDeploymentName is the name of the machine-controller-manager deployment.
	MachineControllerManagerDeploymentName = "machine-controller-manager"

	// KubeSchedulerDeploymentName is the name of the kube-scheduler deployment.
	KubeSchedulerDeploymentName = "kube-scheduler"

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

	// CalicoTyphaDeploymentName is the name of the calico-typha deployment.
	CalicoTyphaDeploymentName = "calico-typha"

	// CoreDNSDeploymentName is the name of the coredns deployment.
	CoreDNSDeploymentName = "coredns"

	// VPNShootDeploymentName is the name of the vpn-shoot deployment.
	VPNShootDeploymentName = "vpn-shoot"

	// MetricsServerDeploymentName is the name of the metrics-server deployment.
	MetricsServerDeploymentName = "metrics-server"

	// CalicoNodeDaemonSetName is the name of the calico-node daemon set.
	CalicoNodeDaemonSetName = "calico-node"

	// KubeProxyDaemonSetName is the name of the kube-proxy daemon set.
	KubeProxyDaemonSetName = "kube-proxy"

	// GrafanaDeploymentName is the name of the grafana deployment.
	GrafanaDeploymentName = "grafana"

	// KubeStateMetricsShootDeploymentName is the name of the kube-state-metrics deployment.
	KubeStateMetricsShootDeploymentName = "kube-state-metrics"

	// KubeStateMetricsSeedDeploymentName is the name of the kube-state-metrics-shoot deployment.
	KubeStateMetricsSeedDeploymentName = "kube-state-metrics-seed"

	// NodeExporterDaemonSetName is the name of the node-exporter daemon set.
	NodeExporterDaemonSetName = "node-exporter"

	// ElasticSearchStatefulSetName is the name of the elasticsearch-logging stateful set.
	ElasticSearchStatefulSetName = "elasticsearch-logging"

	// KibanaDeploymentName is the name of the kibana-logging deployment.
	KibanaDeploymentName = "kibana-logging"

	// FluentBitDaemonSetName is the name of the fluent-bit daemon set.
	FluentBitDaemonSetName = "fluent-bit"

	// FluentdEsStatefulSetName is the name of the fluentd-es stateful set.
	FluentdEsStatefulSetName = "fluentd-es"

	// ProjectPrefix is the prefix of namespaces representing projects.
	ProjectPrefix = "garden-"

	// ProjectName is they key of a label on namespaces whose value holds the project name. Usually, the label is set
	// by the Gardener Dashboard.
	ProjectName = "project.garden.sapcloud.io/name"

	// ProjectNamespace is they key of a label on projects whose value holds the namespace name. Usually, the label is set
	// by the Gardener Dashboard.
	ProjectNamespace = "project.garden.sapcloud.io/namespace"

	// NamespaceProject is they key of a label on namespace whose value holds the project uid.
	NamespaceProject = "namespace.garden.sapcloud.io/project"

	// ProjectOwner is they key of a label on namespaces whose value holds the project owner. Usually, the label is set
	// by the Gardener Dashboard.
	ProjectOwner = "project.garden.sapcloud.io/owner"

	// ProjectDescription is they key of a label on namespaces whose value holds the project description. Usually, the label is set
	// by the Gardener Dashboard.
	ProjectDescription = "project.garden.sapcloud.io/description"

	// ProjectPurpose is they key of a label on namespaces whose value holds the project purpose. Usually, the label is set
	// by the Gardener Dashboard.
	ProjectPurpose = "project.garden.sapcloud.io/purpose"

	// ProjectMemberClusterRole is the name of the cluster role defining the permissions for project members.
	ProjectMemberClusterRole = "garden.sapcloud.io:system:project-member"

	// PrometheusStatefulSetName is the name of the Prometheus stateful set.
	PrometheusStatefulSetName = "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"

	// ShootExpirationTimestamp is an annotation on a Shoot resource whose value represents the time when the Shoot lifetime
	// is expired. The lifetime can be extended, but at most by the minimal value of the 'clusterLifetimeDays' property
	// of referenced quotas.
	ShootExpirationTimestamp = "shoot.garden.sapcloud.io/expirationTimestamp"

	// ShootUseAsSeed is a constant for an annotation on a Shoot resource indicating that the Shoot shall be registered as Seed in the
	// Garden cluster once successfully created.
	ShootUseAsSeed = "shoot.garden.sapcloud.io/use-as-seed"

	// ShootUnhealthy is a constant for a label on a Shoot resource indicating that the Shoot is unhealthy. It is set and unset by the
	// Shoot Care controller and can be used to easily identify Shoot clusters with issues.
	ShootUnhealthy = "shoot.garden.sapcloud.io/unhealthy"

	// ShootOperation is a constant for an annotation on a Shoot in a failed state indicating that an operation shall be performed.
	ShootOperation = "shoot.garden.sapcloud.io/operation"

	// ShootOperationMaintain is a constant for an annotation on a Shoot indicating that the Shoot maintenance shall be executed as soon as
	// possible.
	ShootOperationMaintain = "maintain"

	// ShootOperationRetry is a constant for an annotation on a Shoot indicating that a failed Shoot reconciliation shall be retried.
	ShootOperationRetry = "retry"

	// ShootSyncPeriod is a constant for an annotation on a Shoot which may be used to overwrite the global Shoot controller sync period.
	// The value must be a duration. It can also be used to disable the reconciliation at all by setting it to 0m. Disabling the reconciliation
	// does only mean that the period reconciliation is disabled. However, when the Gardener is restarted/redeployed or the specification is
	// changed then the reconciliation flow will be executed.
	ShootSyncPeriod = "shoot.garden.sapcloud.io/sync-period"

	// ShootIgnore is a constant for an annotation on a Shoot which may be used to tell the Gardener that the Shoot with this name should be
	// ignored completely. That means that the Shoot will never reach the reconciliation flow (independent of the operation (create/update/
	// delete)).
	ShootIgnore = "shoot.garden.sapcloud.io/ignore"

	// BackupNamespacePrefix is a constant for backup namespace created for shoot's backup infrastructure related resources.
	BackupNamespacePrefix = "backup"

	// KubeAddonManagerImageName is the name of the KubeAddonManager image.
	KubeAddonManagerImageName = "kube-addon-manager"

	// CalicoNodeImageName is the name of the CalicoNode image.
	CalicoNodeImageName = "calico-node"

	// CalicoCNIImageName is the name of the CalicoCNI image.
	CalicoCNIImageName = "calico-cni"

	// CalicoTyphaImageName is the name of the CalicoTypha image.
	CalicoTyphaImageName = "calico-typha"

	// CoreDNSImageName is the name of the CoreDNS image.
	CoreDNSImageName = "coredns"

	// HyperkubeImageName is the name of the Hyperkube image.
	HyperkubeImageName = "hyperkube"

	// MetricsServerImageName is the name of the MetricsServer image.
	MetricsServerImageName = "metrics-server"

	// VPNShootImageName is the name of the VPNShoot image.
	VPNShootImageName = "vpn-shoot"

	// VPNSeedImageName is the name of the VPNSeed image.
	VPNSeedImageName = "vpn-seed"

	// NodeExporterImageName is the name of the NodeExporter image.
	NodeExporterImageName = "node-exporter"

	// HelmTillerImageName is the name of the HelmTiller image.
	HelmTillerImageName = "helm-tiller"

	// KubeLegoImageName is the name of the KubeLego image.
	KubeLegoImageName = "kube-lego"

	// Kube2IAMImageName is the name of the Kube2IAM image.
	Kube2IAMImageName = "kube2iam"

	// KubernetesDashboardImageName is the name of the KubernetesDashboard image.
	KubernetesDashboardImageName = "kubernetes-dashboard"

	// MonocularAPIImageName is the name of the MonocularAPI image.
	MonocularAPIImageName = "monocular-api"

	// MonocularUIImageName is the name of the MonocularUI image.
	MonocularUIImageName = "monocular-ui"

	// BusyboxImageName is the name of the Busybox image.
	BusyboxImageName = "busybox"

	// NginxIngressControllerImageName is the name of the NginxIngressController image.
	NginxIngressControllerImageName = "nginx-ingress-controller"

	// IngressDefaultBackendImageName is the name of the IngressDefaultBackend image.
	IngressDefaultBackendImageName = "ingress-default-backend"

	// MachineControllerManagerImageName is the name of the MachineControllerManager image.
	MachineControllerManagerImageName = "machine-controller-manager"

	// ClusterAutoscalerImageName is the name of the ClusterAutoscaler image.
	ClusterAutoscalerImageName = "cluster-autoscaler"

	// AlertManagerImageName is the name of the AlertManager image.
	AlertManagerImageName = "alertmanager"

	// ConfigMapReloaderImageName is the name of the ConfigMapReloader image.
	ConfigMapReloaderImageName = "configmap-reloader"

	// GrafanaImageName is the name of the Grafana image.
	GrafanaImageName = "grafana"

	// PrometheusImageName is the name of the Prometheus image.
	PrometheusImageName = "prometheus"

	// BlackboxExporterImageName is the name of the BlackboxExporter image.
	BlackboxExporterImageName = "blackbox-exporter"

	// KubeStateMetricsImageName is the name of the KubeStateMetrics image.
	KubeStateMetricsImageName = "kube-state-metrics"

	// ETCDImageName is the name of the ETCD image.
	ETCDImageName = "etcd"

	// ETCDBackupRestoreImageName is the name of the ETCDBackupRestore image.
	ETCDBackupRestoreImageName = "etcd-backup-restore"

	// RubyImageName is the name of the Ruby image.
	RubyImageName = "ruby"

	// AWSLBReadvertiserImageName is the name of the AWSLBReadvertiser image.
	AWSLBReadvertiserImageName = "aws-lb-readvertiser"

	// PauseContainerImageName is the name of the PauseContainer image.
	PauseContainerImageName = "pause-container"

	// GardenerExternalAdmissionControllerImageName is the name of the GardenerExternalAdmissionController image.
	GardenerExternalAdmissionControllerImageName = "gardener-external-admission-controller"

	// TerraformerImageName is the name of the Terraformer image.
	TerraformerImageName = "terraformer"

	// ElasticsearchImageName is the name of the Elastic-Search image used for logging
	ElasticsearchImageName = "elasticsearch-oss"

	// CuratorImageName is the name of the curator image used to alter the Elastic-search logs
	CuratorImageName = "curator-es"

	// KibanaImageName is the name of the Kibana image used for logging  UI
	KibanaImageName = "kibana-oss"

	// FluentdEsImageName is the image of the Fluentd image used for logging
	FluentdEsImageName = "fluentd-es"

	// FluentBitImageName is the image of Fluent-bit image
	FluentBitImageName = "fluent-bit"

	// AlpineImageName is the name of alpine image
	AlpineImageName = "alpine"
)

Variables

View Source
var (
	// ETCDMainStatefulSetName is the name of the etcd-main stateful set.
	ETCDMainStatefulSetName = fmt.Sprintf("etcd-%s", EtcdRoleMain)
	// ETCDEventsStatefulSetName is the name of the etcd-events stateful set.
	ETCDEventsStatefulSetName = fmt.Sprintf("etcd-%s", EtcdRoleEvents)

	// RequiredControlPlaneDeployments is a set of the required shoot control plane deployments
	// running in the seed.
	RequiredControlPlaneDeployments = sets.NewString(
		CloudControllerManagerDeploymentName,
		KubeAddonManagerDeploymentName,
		KubeAPIServerDeploymentName,
		KubeControllerManagerDeploymentName,
		KubeSchedulerDeploymentName,
		MachineControllerManagerDeploymentName,
	)

	// RequiredControlPlaneStatefulSets is a set of the required shoot control plane stateful
	// sets running in the seed.
	RequiredControlPlaneStatefulSets = sets.NewString(
		ETCDMainStatefulSetName,
		ETCDEventsStatefulSetName,
	)

	// RequiredSystemComponentDeployments is a set of the required system components.
	RequiredSystemComponentDeployments = sets.NewString(
		CalicoTyphaDeploymentName,
		CoreDNSDeploymentName,
		VPNShootDeploymentName,
		MetricsServerDeploymentName,
	)

	// RequiredSystemComponentDaemonSets is a set of the required shoot control plane daemon sets.
	RequiredSystemComponentDaemonSets = sets.NewString(
		CalicoNodeDaemonSetName,
		KubeProxyDaemonSetName,
	)

	// RequiredMonitoringSeedDeployments is a set of the required seed monitoring deployments.
	RequiredMonitoringSeedDeployments = sets.NewString(
		GrafanaDeploymentName,
		KubeStateMetricsSeedDeploymentName,
		KubeStateMetricsShootDeploymentName,
	)

	// RequiredMonitoringSeedStatefulSets is a set of the required seed monitoring stateful sets.
	RequiredMonitoringSeedStatefulSets = sets.NewString(
		AlertManagerStatefulSetName,
		PrometheusStatefulSetName,
	)

	// RequiredMonitoringShootDaemonSets is a set of the required shoot monitoring daemon sets.
	RequiredMonitoringShootDaemonSets = sets.NewString(
		NodeExporterDaemonSetName,
	)

	// RequiredLoggingStatefulSets is a set of the required logging stateful sets.
	RequiredLoggingStatefulSets = sets.NewString(
		ElasticSearchStatefulSetName,
		FluentdEsStatefulSetName,
	)

	// RequiredLoggingDeployments is a set of the required logging deployments.
	RequiredLoggingDeployments = sets.NewString(
		KibanaDeploymentName,
	)

	// RequiredLoggingDaemonSetNames is a set of the required logging daemon sets.
	RequiredLoggingDaemonSetNames = sets.NewString(
		FluentBitDaemonSetName,
	)
)
View Source
var GardenerDeletionGracePeriod = 1 * time.Minute

GardenerDeletionGracePeriod is the default grace period for Gardener's force deletion methods.

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 DetermineError

func DetermineError(message string) error

DetermineError determines the Garden error code for the given error message.

func DiskSize

func DiskSize(size string) int

DiskSize extracts the numerical component of DiskSize strings, i.e. strings like "10Gi" and returns it as string, i.e. "10" will be returned. If the conversion to integer fails or if the pattern does not match, it will return 0.

func DistributeOverZones

func DistributeOverZones(zoneIndex, size, zoneSize int) int

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 DistributePercentOverZones

func DistributePercentOverZones(zoneIndex int, percent string, zoneSize int, total int) string

DistributePercentOverZones distributes a given percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.

func DistributePositiveIntOrPercent

func DistributePositiveIntOrPercent(zoneIndex int, intOrPercent intstr.IntOrString, zoneSize int, total int) intstr.IntOrString

DistributePositiveIntOrPercent distributes a given int or percentage value over zones in relation to the given total value. In case the total value is evenly divisible over the zones, this always just returns the initial percentage. Otherwise, the total value is used to determine the weight of a specific zone in relation to the other zones and adapt the given percentage accordingly.

func ExtractShootName

func ExtractShootName(backupInfrastructureName string) string

ExtractShootName returns Shoot resource name extracted from provided <backupInfrastructureName>.

func GenerateAddonConfig

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

GenerateAddonConfig returns the provided <values> in case <enabled> is true. Otherwise, nil is being returned.

func GenerateBackupInfrastructureName

func GenerateBackupInfrastructureName(seedNamespace string, shootUID types.UID) string

GenerateBackupInfrastructureName returns BackupInfrastructure resource name created from provided <seedNamespace> and <shootUID>.

func GenerateBackupNamespaceName

func GenerateBackupNamespaceName(backupInfrastructureName string) string

GenerateBackupNamespaceName returns Backup namespace name created from provided <backupInfrastructureName>.

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 HasInitializer

func HasInitializer(initializers *metav1.Initializers, name string) bool

HasInitializer checks whether the passed name is part of the pending initializers.

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).

func IsFollowingNewNamingConvention

func IsFollowingNewNamingConvention(seedNamespace string) bool

IsFollowingNewNamingConvention determines whether the new naming convention followed for shoot resources. TODO: Remove this and use only "--" as separator, once we have all shoots deployed as per new naming conventions.

func MachineClassHash

func MachineClassHash(machineClassSpec map[string]interface{}, version string) string

MachineClassHash returns the SHA256-hash value of the <val> struct's representation concatenated with the provided <version>.

func MergeOwnerReferences

func MergeOwnerReferences(references []metav1.OwnerReference, newReferences ...metav1.OwnerReference) []metav1.OwnerReference

MergeOwnerReferences merges the newReferences with the list of existing references.

func NewErrorWithCode

func NewErrorWithCode(code gardenv1beta1.ErrorCode, message string) error

NewErrorWithCode creates a new error that additionally exposes the given code via the Coder interface.

func ProjectForNamespace

func ProjectForNamespace(projectLister gardenlisters.ProjectLister, namespaceName string) (*gardenv1beta1.Project, error)

ProjectForNamespace returns the project object responsible for a given <namespace>. It tries to identify the project object by looking for the namespace name in the project statuses.

func ProjectNameForNamespace

func ProjectNameForNamespace(namespace *corev1.Namespace) string

ProjectNameForNamespace determines the project name for a given <namespace>. It tries to identify it first per the namespace's ownerReferences. If it doesn't help then it will check whether the project name is a label on the namespace object. If it doesn't help then the name can be inferred from the namespace name in case it is prefixed with the project prefix. If none of those approaches the namespace name itself is returned as project name.

func ReadLeaderElectionRecord

func ReadLeaderElectionRecord(k8sClient kubernetes.Client, lock, namespace, name string) (*resourcelock.LeaderElectionRecord, error)

ReadLeaderElectionRecord returns the leader election record for a given lock type and a namespace/name combination.

func ReplaceCloudProviderConfigKey

func ReplaceCloudProviderConfigKey(cloudProviderConfig, separator, key, value string) string

ReplaceCloudProviderConfigKey replaces a key with the new value in the given cloud provider config.

func ShouldObjectBeRemoved

func ShouldObjectBeRemoved(obj metav1.Object, gracePeriod time.Duration) bool

ShouldObjectBeRemoved determines whether the given object should be gone now. This is calculated by first checking the deletion timestamp of an object: If the deletion timestamp is unset, the object should not be removed - i.e. this returns false. Otherwise, it is checked whether the deletionTimestamp is before the current time minus the grace period.

Types

type CloudConfigUserDataConfig

type CloudConfigUserDataConfig struct {
	ProvisionCloudProviderConfig bool
	KubeletParameters            []string
	WorkerNames                  []string
	HostnameOverride             bool
}

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