key

package
v4.0.0-...-567bbdc Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2023 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasterID = "master"
	WorkerID = "worker"
	EtcdPort = 443

	// HealthEndpoint is http path for liveness probe.
	HealthEndpoint = "/healthz"
	// ProbeHost host for liveness probe.
	ProbeHost = "127.0.0.1"
	// LivenessProbeInitialDelaySeconds is LivenessProbeInitialDelaySeconds param in liveness probe config.
	LivenessProbeInitialDelaySeconds = 500
	// ReadinessProbeInitialDelaySeconds is ReadinessProbeInitialDelaySeconds param in readiness probe config.
	ReadinessProbeInitialDelaySeconds = 100
	// TimeoutSeconds is TimeoutSeconds param in liveness probe config.
	TimeoutSeconds = 5
	// PeriodSeconds is PeriodSeconds param in liveness probe config.
	PeriodSeconds = 35
	// FailureThreshold is FailureThreshold param in liveness probe config
	FailureThreshold = 4
	// SuccessThreshold is SuccessThreshold param in liveness probe config
	SuccessThreshold = 1

	// Enable k8s-kvm-health check for k8s api.
	CheckK8sApi = "true"

	// Environment variable names for Downward API use (shutdown-deferrer).
	EnvKeyMyPodName      = "MY_POD_NAME"
	EnvKeyMyPodNamespace = "MY_POD_NAMESPACE"

	ContainerLinuxComponentName = "containerlinux"

	FlatcarImageDir = "/var/lib/flatcar-kvm-images"
	FlatcarChannel  = "stable"

	K8SKVMContainerName = "k8s-kvm"

	K8SKVMDockerImage = "quay.io/giantswarm/k8s-kvm:0.4.1-6c7a7f8ec4f0cce3ef3745ae999f5afa431c357f"

	// DefaultDockerDiskSize defines the space used to partition the docker FS
	// within k8s-kvm. Note we use this only for masters, since the value for the
	// workers can be configured at runtime by the user.
	DefaultDockerDiskSize = "50G"
	// DefaultKubeletDiskSize defines the space used to partition the kubelet FS
	// within k8s-kvm. Note we use this only for masters, since the value for the
	// workers can be configured at runtime by the user.
	DefaultKubeletDiskSize = "5G"
	// DefaultOSDiskSize defines the space used to partition the root FS within
	// k8s-kvm.
	DefaultOSDiskSize = "5G"

	DefaultImagePullProgressDeadline = "1m"
)
View Source
const (
	AnnotationAPIEndpoint            = "kvm-operator.giantswarm.io/api-endpoint"
	AnnotationComponentVersionPrefix = "kvm-operator.giantswarm.io/component-version"
	AnnotationEtcdDomain             = "giantswarm.io/etcd-domain"
	AnnotationService                = "endpoint.kvm.giantswarm.io/service"
	AnnotationPodDrained             = "endpoint.kvm.giantswarm.io/drained"
	AnnotationPrometheusCluster      = "giantswarm.io/prometheus-cluster"
	AnnotationVersionBundle          = "kvm-operator.giantswarm.io/version-bundle"

	LabelApp           = "app"
	LabelCluster       = "giantswarm.io/cluster"
	LabelCustomer      = "customer"
	LabelManagedBy     = "giantswarm.io/managed-by"
	LabelMountTag      = "mount-tag"
	LabelOrganization  = "giantswarm.io/organization"
	LabelVersionBundle = "giantswarm.io/version-bundle"

	LegacyLabelCluster = "cluster"
)
View Source
const (
	VersionBundleVersionAnnotation = "giantswarm.io/version-bundle-version"
	ReleaseVersionAnnotation       = "giantswarm.io/release-version"
)
View Source
const (
	// Keep in sync with https://github.com/giantswarm/node-operator/blob/e8f8250f7d518d7af0acfdb1b0934a1174c22d7d/service/controller/v2/resource/drainer/create.go#L50
	PodDeletionGracePeriod                           = 10 * time.Minute
	WorkloadClusterNodeReady corev1.PodConditionType = "kvm-operator.giantswarm.io/workload-cluster-node-ready"
)
View Source
const (
	KubernetesNetworkSetupDocker = "0.2.0"
)
View Source
const (
	OperatorName = "kvm-operator"
)
View Source
const (
	PodWatcherLabel = "kvm-operator.giantswarm.io/pod-watcher"
)

Variables

View Source
var (
	RequeueNone = reconcile.Result{
		Requeue:      false,
		RequeueAfter: 0,
	}
	RequeueErrorShort = reconcile.Result{
		Requeue:      true,
		RequeueAfter: time.Second * 10,
	}
	RequeueErrorLong = reconcile.Result{
		Requeue:      true,
		RequeueAfter: time.Second * 30,
	}
)

Functions

func AllNodes

func AllNodes(cr v1alpha1.KVMConfig) []v1alpha1.ClusterNode

func AllocatedNodeIndexes

func AllocatedNodeIndexes(cr v1alpha1.KVMConfig) []int

func AnyPodContainerRunning

func AnyPodContainerRunning(pod corev1.Pod) bool

AnyPodContainerRunning checks ContainerState for all containers present in given pod. If any container is in Running state, true is returned.

func BaseDomain

func BaseDomain(customObject v1alpha1.KVMConfig) string

func ClusterAPIEndpoint

func ClusterAPIEndpoint(customObject v1alpha1.KVMConfig) string

func ClusterAPIEndpointFromPod

func ClusterAPIEndpointFromPod(pod *corev1.Pod) (string, error)

func ClusterCustomer

func ClusterCustomer(customObject v1alpha1.KVMConfig) string

func ClusterEtcdDomain

func ClusterEtcdDomain(customObject v1alpha1.KVMConfig) string

func ClusterID

func ClusterID(customObject v1alpha1.KVMConfig) string

func ClusterNamespace

func ClusterNamespace(customObject v1alpha1.KVMConfig) string

func ClusterRoleBindingName

func ClusterRoleBindingName(customObject v1alpha1.KVMConfig) string

func ClusterRoleBindingPSPName

func ClusterRoleBindingPSPName(customObject v1alpha1.KVMConfig) string

func ConfigMapName

func ConfigMapName(cr v1alpha1.KVMConfig, node v1alpha1.ClusterNode, prefix string) string

func ContainerDistro

func ContainerDistro(release *releasev1alpha1.Release) (string, error)

func CreateK8sClientForWorkloadCluster

func CreateK8sClientForWorkloadCluster(ctx context.Context, cluster v1alpha1.KVMConfig, logger micrologger.Logger, workloadCluster workloadcluster.Interface) (*k8sclient.Clients, error)

CreateK8sClientForWorkloadCluster takes the context of the reconciled object and the provided logger and workload cluster interface and creates a K8s client for the workload cluster

func DefaultVersions

func DefaultVersions() k8scloudconfig.Versions

func DeploymentName

func DeploymentName(prefix string, nodeID string) string

func DockerVolumeSizeFromNode

func DockerVolumeSizeFromNode(node v1alpha1.KVMConfigSpecKVMNode) string

func EtcdPVCName

func EtcdPVCName(clusterID string, vmNumber string) string

func EtcdStorageType

func EtcdStorageType(customObject v1alpha1.KVMConfig) string

func FindNodeCondition

func FindNodeCondition(node corev1.Node, conditionType corev1.NodeConditionType) (corev1.NodeCondition, bool)

FindNodeCondition returns the condition of the given type from the node. The second return value indicates if the condition was found.

func FindPodCondition

func FindPodCondition(pod corev1.Pod, conditionType corev1.PodConditionType) (corev1.PodCondition, bool)

FindNodeCondition returns the condition of the given type from the pod. The second return value indicates if the condition was found.

func HasHostVolumes

func HasHostVolumes(customObject v1alpha1.KVMConfig) bool

func HealthListenAddress

func HealthListenAddress(customObject v1alpha1.KVMConfig) string

func HostVolumesToEnvVar

func HostVolumesToEnvVar(hostVolumes []v1alpha1.KVMConfigSpecKVMNodeHostVolumes) corev1.EnvVar

func HostVolumesToVolumeMounts

func HostVolumesToVolumeMounts(hostVolumes []v1alpha1.KVMConfigSpecKVMNodeHostVolumes) []corev1.VolumeMount

func HostVolumesToVolumes

func HostVolumesToVolumes(customObject v1alpha1.KVMConfig, nodeIndex int) []corev1.Volume

func IsDeleted

func IsDeleted(object v1.Object) bool

func IsInvalidMemoryConfigurationError

func IsInvalidMemoryConfigurationError(err error) bool

func IsMissingAnnotationError

func IsMissingAnnotationError(err error) bool

func IsMissingNodeInternalIP

func IsMissingNodeInternalIP(err error) bool

func IsMissingVersionError

func IsMissingVersionError(err error) bool

func IsPodDrained

func IsPodDrained(pod corev1.Pod) (bool, error)

IsPodDrained checks whether the pod status indicates it got drained. The pod status is partially reflected by its annotations. Here we check for the annotation that tells us if the pod was already drained or not. In case the pod does not have any annotations an unrecoverable error is returned. Such situations should actually never happen. If it happens, something really bad is going on. This is nothing we can just sort right away in our code.

TODO(xh3b4sd) handle pod status via the runtime object status primitives and not via annotations.

func IsWrongTypeError

func IsWrongTypeError(err error) bool

IsWrongTypeError asserts wrongTypeError.

func IscsiInitiatorName

func IscsiInitiatorName(customObject v1alpha1.KVMConfig, nodeIndex int, nodeRole string) string

func KubeletVolumeSizeFromNode

func KubeletVolumeSizeFromNode(node v1alpha1.KVMConfigSpecKVMNode) string

func LivenessPort

func LivenessPort(customObject v1alpha1.KVMConfig) int32

func LocalWorkerPVCName

func LocalWorkerPVCName(clusterID string, vmNumber, mountTag string) string

func MasterCount

func MasterCount(customObject v1alpha1.KVMConfig) int

func MasterHostPathVolumeDir

func MasterHostPathVolumeDir(clusterID string, vmNumber string) string

func MemoryQuantityMaster

func MemoryQuantityMaster(n v1alpha1.KVMConfigSpecKVMNode) (resource.Quantity, error)

MemoryQuantity returns a resource.Quantity that represents the memory to be used by the nodes. It adds the memory from the node definition parameter to the additional memory calculated on the node role

func MemoryQuantityWorker

func MemoryQuantityWorker(n v1alpha1.KVMConfigSpecKVMNode) (resource.Quantity, error)

MemoryQuantity returns a resource.Quantity that represents the memory to be used by the nodes. It adds the memory from the node definition parameter to the additional memory calculated on the node role

func NetworkDNSBlock

func NetworkDNSBlock(servers []net.IP) string

func NodeIndex

func NodeIndex(cr v1alpha1.KVMConfig, nodeID string) (int, bool)

func NodeInternalIP

func NodeInternalIP(node corev1.Node) (string, error)

NodeInternalIP examines the Status Addresses of a Node and returns its InternalIP..

func NodeIsReady

func NodeIsReady(node corev1.Node) bool

NodeIsReady examines the Status Conditions of a Node and returns true if the NodeReady Condition is true.

func NodeIsUnschedulable

func NodeIsUnschedulable(node corev1.Node) bool

NodeIsUnschedulable examines a Node and returns true if the Node is marked Unschedulable or has a NoSchedule/NoExecute taint. Ignores the default NoSchedule effect for master nodes.

func NodePodObjectKey

func NodePodObjectKey(cluster v1alpha1.KVMConfig, node corev1.Node) client.ObjectKey

func OperatorVersion

func OperatorVersion(cr v1alpha1.KVMConfig) string

func PodIsReady

func PodIsReady(pod corev1.Pod) bool

PodIsReady examines the Status Conditions of a Pod and returns true if the PodReady Condition is true.

func PodNodeIsReady

func PodNodeIsReady(pod corev1.Pod) bool

PodNodeIsReady examines the Status Conditions of a Pod and returns true if the WorkloadClusterNodeReady Condition is true.

func PortMappings

func PortMappings(customObject v1alpha1.KVMConfig) []corev1.ServicePort

func ReleaseVersion

func ReleaseVersion(cr v1alpha1.KVMConfig) string

func ServiceAccountName

func ServiceAccountName(customObject v1alpha1.KVMConfig) string

func ShutdownDeferrerListenAddress

func ShutdownDeferrerListenAddress(customObject v1alpha1.KVMConfig) string

func ShutdownDeferrerListenPort

func ShutdownDeferrerListenPort(customObject v1alpha1.KVMConfig) int

func ShutdownDeferrerPollPath

func ShutdownDeferrerPollPath(customObject v1alpha1.KVMConfig) string

func ToClusterEndpoint

func ToClusterEndpoint(v interface{}) (string, error)

func ToClusterID

func ToClusterID(v interface{}) (string, error)

func ToClusterStatus

func ToClusterStatus(v interface{}) (v1alpha1.StatusCluster, error)

func ToCustomObject

func ToCustomObject(v interface{}) (v1alpha1.KVMConfig, error)

func ToNode

func ToNode(v interface{}) (corev1.Node, error)

func ToNodeCount

func ToNodeCount(v interface{}) (int, error)

func ToOperatorVersion

func ToOperatorVersion(v interface{}) (string, error)

func ToPod

func ToPod(v interface{}) (corev1.Pod, error)

func VMNumber

func VMNumber(ID int) string

func WorkerCount

func WorkerCount(customObject v1alpha1.KVMConfig) int

Types

type LabelsGetter

type LabelsGetter interface {
	GetLabels() map[string]string
}

Jump to

Keyboard shortcuts

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