conversion

package
v0.0.0-...-44dad58 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildMetadata

func BuildMetadata(cluster, vcns, vcname, targetNamespace string, obj runtime.Object) (runtime.Object, error)

func BuildSuperMasterNamespace

func BuildSuperMasterNamespace(cluster, vcName, vcNamespace, vcUID string, obj runtime.Object) (runtime.Object, error)

func BuildVirtualEvent

func BuildVirtualEvent(cluster string, pEvent *v1.Event, vObj metav1.Object) *v1.Event

func BuildVirtualPersistentVolume

func BuildVirtualPersistentVolume(cluster, vcNS, vcName string, pPV *v1.PersistentVolume, vPVC *v1.PersistentVolumeClaim) *v1.PersistentVolume

func BuildVirtualPriorityClass

func BuildVirtualPriorityClass(cluster string, pPriorityClass *v1scheduling.PriorityClass) *v1scheduling.PriorityClass

func BuildVirtualStorageClass

func BuildVirtualStorageClass(cluster string, pStorageClass *storagev1.StorageClass) *storagev1.StorageClass

func CheckDWPodConditionEquality

func CheckDWPodConditionEquality(pPod, vPod *v1.Pod) *v1.PodStatus

CheckDWPodConditionEquality check whether super master Pod Status and virtual Pod Status are logically equal. In most cases, the source of truth is super pod status, because super master actually own the physical resources, status is reported by **real** kubelet. Besides, kubernetes allows user-defined conditions, such as pod readiness gate, it will report readiness state to pod conditions. In other words, the source of truth for user-defined pod conditions should be tenant side controller, only the condition reported by kubelet should keep consistent with super. It is not recommended that webhook in super append other readiness gate to pod. we left them unchanged in super, don't sync them upward to tenant side. ref https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#pod-readiness-gate

func Equality

func Equality(syncerConfig *config.SyncerConfiguration, vc *v1alpha1.VirtualCluster) *vcEquality

func GetKubeConfigOfVC

func GetKubeConfigOfVC(c v1core.CoreV1Interface, vc *v1alpha1.VirtualCluster) ([]byte, error)

func GetVirtualNamespace

func GetVirtualNamespace(nsLister listersv1.NamespaceLister, pNamespace string) (cluster, namespace string, err error)

GetVirtualNamespace is used to find the corresponding namespace in tenant master for objects created in super master originally, e.g., events.

func GetVirtualOwner

func GetVirtualOwner(meta metav1.Object) (cluster, namespace string)

func IsControlPlaneService

func IsControlPlaneService(service *v1.Service, cluster string) bool

IsControlPlaneService will return if the namespacedName matches the proper NamespacedName in the tenant control plane

func ResetMetadata

func ResetMetadata(obj metav1.Object)

func ToClusterKey

func ToClusterKey(vc *v1alpha1.VirtualCluster) string

ToClusterKey makes a unique key which is used to create the root namespace in super master for a virtual cluster. To avoid name conflict, the key uses the format <namespace>-<hash>-<name>

func ToSuperMasterNamespace

func ToSuperMasterNamespace(cluster, ns string) string

Types

type PodMutateInterface

type PodMutateInterface interface {
	Mutate(ms ...PodMutator) error
}

type PodMutator

type PodMutator func(p *podMutateCtx) error

func PodAddExtensionMeta

func PodAddExtensionMeta(vPod *v1.Pod) PodMutator

for now, only Deployment Pods are mutated.

func PodMutateAutoMountServiceAccountToken

func PodMutateAutoMountServiceAccountToken(disable bool) PodMutator

func PodMutateDefault

func PodMutateDefault(vPod *v1.Pod, saSecretMap map[string]string, services []*v1.Service, nameServer string) PodMutator
func PodMutateServiceLink(disableServiceLinks bool) PodMutator

type SecretMutateInterface

type SecretMutateInterface interface {
	Mutate(vSecret *v1.Secret, clusterName string)
}

type ServiceMutateInterface

type ServiceMutateInterface interface {
	Mutate(vService *v1.Service)
}

type VCMutateInterface

type VCMutateInterface interface {
	Pod(pPod *v1.Pod) PodMutateInterface
	Service(pService *v1.Service) ServiceMutateInterface
	ServiceAccountTokenSecret(pSecret *v1.Secret) SecretMutateInterface
}

func VC

Directories

Path Synopsis
Package envvars is the package that build the environment variables that kubernetes provides to the containers run by it.
Package envvars is the package that build the environment variables that kubernetes provides to the containers run by it.

Jump to

Keyboard shortcuts

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