common

package
v0.0.0-...-5ee5d88 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultFedSystemNamespace = "kube-admiral-system"
	DefaultPrefix             = "kubeadmiral.io/"
	InternalPrefix            = "internal." + DefaultPrefix
	FederateControllerPrefix  = "federate.controller." + DefaultPrefix
)
View Source
const (
	SpecField       = "spec"
	StatusField     = "status"
	MetadataField   = "metadata"
	GenerationField = "generation"

	ManagedFields = "managedFields"

	SecretsField = "secrets"

	RetainReplicasField = "retainReplicas"

	RevisionHistoryLimit = "revisionHistoryLimit"

	TemplateField   = "template"
	PlacementsField = "placements"
	OverridesField  = "overrides"
	FollowsField    = "follows"

	AvailableReplicasField = "availableReplicas"
)
View Source
const (
	AnnotationValueTrue  = "true"
	AnnotationValueFalse = "false"

	SourceGenerationAnnotation = DefaultPrefix + "source-generation"

	NoSchedulingAnnotation = DefaultPrefix + "no-scheduling"

	// RetainReplicasAnnotation indicates that the replicas field of the cluster objects should be retained during propagation.
	RetainReplicasAnnotation = DefaultPrefix + "retain-replicas"

	// FollowersAnnotation indicates the additional followers of a leader.
	FollowersAnnotation = DefaultPrefix + "followers"
	// EnableFollowerSchedulingAnnotation indicates whether follower scheduling should be enabled for the leader object.
	EnableFollowerSchedulingAnnotation = InternalPrefix + "enable-follower-scheduling"
	// DisableFollowingAnnotation indicates whether follower scheduling should be disabled for the follower object.
	DisableFollowingAnnotation = DefaultPrefix + "disable-following"

	// When a pod remains unschedulable beyond this threshold, it becomes eligible for automatic migration.
	PodUnschedulableThresholdAnnotation = InternalPrefix + "pod-unschedulable-threshold"
	// AutoMigrationInfoAnnotation contains auto migration information.
	AutoMigrationInfoAnnotation = DefaultPrefix + "auto-migration-info"
	// ObservedAnnotationKeysAnnotation contains annotation keys observed in the last reconcile.
	// It will be in the format of `a,b|c,d`, where `a` and `b` are the keys that are synced
	// from source annotations to federated object annotations.
	ObservedAnnotationKeysAnnotation = FederateControllerPrefix + "observed-annotations"
	// ObservedLabelKeysAnnotation contains label keys observed in the last reconcile.
	// It will be in the format of `a,b|c,d`, where `a` and `b` are the keys that are synced from source labels to federated object labels.
	ObservedLabelKeysAnnotation = FederateControllerPrefix + "observed-labels"
	// TemplateGeneratorMergePatchAnnotation indicates the merge patch document capable of converting
	// the source object to the template object.
	TemplateGeneratorMergePatchAnnotation = FederateControllerPrefix + "template-generator-merge-patch"

	LatestReplicasetDigestsAnnotation = DefaultPrefix + "latest-replicaset-digests"

	// MigrationConfigurationAnnotation contains custom migration configuration from users.
	MigrationConfigurationAnnotation = DefaultPrefix + "migration-configuration"
	// AppliedMigrationConfigurationAnnotation contains the applied custom migration configuration.
	AppliedMigrationConfigurationAnnotation = DefaultPrefix + "applied-migration-configuration"
	// DryRunAnnotation indicates resource is in dry run process. It will prevent new resources from being dispatched by the sync controller.
	// It works only when resources have not been propagated to member clusters.
	DryRunAnnotation = DefaultPrefix + "dry-run"

	HPAScaleTargetRefPath = DefaultPrefix + "scale-target-ref-path"

	CentralizedHPAEnableKey = DefaultPrefix + "centralized-hpa-enabled"

	DerivedServiceAnnotation = DefaultPrefix + "derived-service"
)
View Source
const (
	PropagatedAnnotationKeys = DefaultPrefix + "propagated-annotation-keys"
	PropagatedLabelKeys      = DefaultPrefix + "propagated-label-keys"
)

PropagatedAnnotationKeys and PropagatedLabelKeys are used to store the keys of annotations and labels that are present on the resource to propagate. By persisting these, we can tell whether an annotation/label is deleted from the propagated and prevent accidental retention.

View Source
const (
	ClusterClientCertificateKey    = "client-certificate-data"
	ClusterClientKeyKey            = "client-key-data"
	ClusterCertificateAuthorityKey = "certificate-authority-data"
	ClusterServiceAccountTokenKey  = "service-account-token-data"
	ClusterBootstrapTokenKey       = "bootstrap-token-data"
)
View Source
const (
	NamespaceResource     = "namespaces"
	DeploymentResource    = "deployments"
	DaemonSetResource     = "daemonsets"
	ConfigMapResource     = "configmaps"
	SecretResource        = "secrets"
	PodResource           = "pods"
	ReplicaSetResource    = "replicasets"
	ServiceResource       = "services"
	ServiceExportResource = "serviceexports"
	EndpointSliceResource = "endpointslices"

	NamespaceKind               = "Namespace"
	DeploymentKind              = "Deployment"
	StatefulSetKind             = "StatefulSet"
	DaemonSetKind               = "DaemonSet"
	JobKind                     = "Job"
	CronJobKind                 = "CronJob"
	ConfigMapKind               = "ConfigMap"
	SecretKind                  = "Secret"
	ServiceKind                 = "Service"
	ServiceAccountKind          = "ServiceAccount"
	IngressKind                 = "Ingress"
	PersistentVolumeKind        = "PersistentVolume"
	PersistentVolumeClaimKind   = "PersistentVolumeClaim"
	PodKind                     = "Pod"
	ReplicaSetKind              = "ReplicaSet"
	HorizontalPodAutoscalerKind = "HorizontalPodAutoscaler"
	ServiceExportKind           = "ServiceExport"
	ServiceImportKind           = "ServiceImport"
	EndpointSliceKind           = "EndpointSlice"
	FederatedObjectKind         = "FederatedObject"
)
View Source
const (
	MaxFederatedObjectNameLength = 253
	MaxEndpointSliceNameLength   = 253
	MaxLabelValueLength          = 63
)

MaxFederatedObjectNameLength defines the max length of a federated object name. A custom resource name must be a DNS subdomain as defined in RFC1123 with a maximum length of 253. For more information about the custom resource validator, please refer to https://github.com/kubernetes/kubernetes/blob/a17149e/staging/src/k8s.io/apiextensions-apiserver/pkg/registry/customresource/validator.go#L61

Variables

View Source
var (
	TemplatePath   = []string{SpecField, TemplateField}
	PlacementsPath = []string{SpecField, PlacementsField}
	OverridesPath  = []string{SpecField, OverridesField}
	FollowsPath    = []string{SpecField, FollowsField}
)
View Source
var (
	ServiceGVK               = corev1.SchemeGroupVersion.WithKind(ServiceKind)
	ServiceAccountGVK        = corev1.SchemeGroupVersion.WithKind(ServiceAccountKind)
	PersistentVolumeGVK      = corev1.SchemeGroupVersion.WithKind(PersistentVolumeKind)
	PersistentVolumeClaimGVK = corev1.SchemeGroupVersion.WithKind(PersistentVolumeClaimKind)
	PodGVK                   = corev1.SchemeGroupVersion.WithKind(PodKind)

	JobGVK = batchv1.SchemeGroupVersion.WithKind(JobKind)

	ServiceExportGVK   = mcsv1alpha1.SchemeGroupVersion.WithKind(ServiceExportKind)
	ServiceImportGVK   = mcsv1alpha1.SchemeGroupVersion.WithKind(ServiceImportKind)
	EndpointSliceGVK   = discoveryv1b1.SchemeGroupVersion.WithKind(EndpointSliceKind)
	FederatedObjectGVK = fedcorev1a1.SchemeGroupVersion.WithKind(FederatedObjectKind)
)
View Source
var (
	NamespaceGVR = corev1.SchemeGroupVersion.WithResource(NamespaceResource)
	ConfigMapGVR = corev1.SchemeGroupVersion.WithResource(ConfigMapResource)
	SecretGVR    = corev1.SchemeGroupVersion.WithResource(SecretResource)
	PodGVR       = corev1.SchemeGroupVersion.WithResource(PodResource)
	ServiceGVR   = corev1.SchemeGroupVersion.WithResource(ServiceResource)

	DeploymentGVR = appsv1.SchemeGroupVersion.WithResource(DeploymentResource)
	DaemonSetGVR  = appsv1.SchemeGroupVersion.WithResource(DaemonSetResource)
	ReplicaSetGVR = appsv1.SchemeGroupVersion.WithResource(ReplicaSetResource)

	ServiceExportGVR = mcsv1alpha1.SchemeGroupVersion.WithResource(ServiceExportResource)
	EndpointSliceGVR = discoveryv1b1.SchemeGroupVersion.WithResource(EndpointSliceResource)
)

Functions

This section is empty.

Types

type QualifiedName

type QualifiedName struct {
	Namespace string
	Name      string
}

QualifiedName comprises a resource name with an optional namespace. If namespace is provided, a QualifiedName will be rendered as "<namespace>/<name>". If not, it will be rendered as "name". This is intended to allow the FederatedTypeAdapter interface and its consumers to operate on both namespaces and namespace-qualified resources.

func NewQualifiedFromString

func NewQualifiedFromString(s string) QualifiedName

func NewQualifiedName

func NewQualifiedName(obj metav1.Object) QualifiedName

func (QualifiedName) String

func (n QualifiedName) String() string

String returns the general purpose string representation

Jump to

Keyboard shortcuts

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