Documentation ¶
Index ¶
- func BuildVirtualCRD(cluster string, pCRD *apiextensionsv1.CustomResourceDefinition) *apiextensionsv1.CustomResourceDefinition
- func BuildVirtualEvent(cluster string, pEvent *v1.Event, vObj client.Object) *v1.Event
- func BuildVirtualPersistentVolume(pPV *v1.PersistentVolume, vPVC *v1.PersistentVolumeClaim) *v1.PersistentVolume
- func BuildVirtualPriorityClass(cluster string, pPriorityClass *v1scheduling.PriorityClass) *v1scheduling.PriorityClass
- func BuildVirtualStorageClass(cluster string, pStorageClass *storagev1.StorageClass) *storagev1.StorageClass
- func CheckDWPodConditionEquality(pPod, vPod *v1.Pod) *v1.PodStatus
- func Equality(syncerConfig *config.SyncerConfiguration, vc *v1alpha1.VirtualCluster) *vcEquality
- func GetConfigMapName(name string) (string, string)
- func GetKubeConfigOfVC(c v1core.CoreV1Interface, vc *v1alpha1.VirtualCluster) ([]byte, error)
- func GetVirtualNamespace(nsLister listersv1.NamespaceLister, pNamespace string) (cluster, namespace string, err error)
- func GetVirtualOwner(meta client.Object) (cluster, namespace string)
- func IsControlPlaneService(service *v1.Service, cluster string) bool
- func ResetMetadata(obj metav1.Object)
- func ToClusterKey(vc *v1alpha1.VirtualCluster) string
- func ToSuperClusterNamespace(cluster, ns string) string
- func WithSuperClusterLabels(labels map[string]string) map[string]string
- type Conversion
- type PodMutateCtx
- type PodMutateInterface
- type PodMutator
- type SecretMutateInterface
- type ServiceMutateInterface
- type VCMutateInterface
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildVirtualCRD ¶
func BuildVirtualCRD(cluster string, pCRD *apiextensionsv1.CustomResourceDefinition) *apiextensionsv1.CustomResourceDefinition
func BuildVirtualEvent ¶
func BuildVirtualPersistentVolume ¶
func BuildVirtualPersistentVolume(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 ¶
CheckDWPodConditionEquality check whether super control plane Pod Status and virtual Pod Status are logically equal. In most cases, the source of truth is super pod status, because super control plane 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 GetConfigMapName ¶
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 control plane for objects created in super control plane originally, e.g., events.
func GetVirtualOwner ¶
func IsControlPlaneService ¶
IsControlPlaneService will return if the namespacedName matches the proper NamespacedName in the tenant control plane
func ResetMetadata ¶
func ToClusterKey ¶
func ToClusterKey(vc *v1alpha1.VirtualCluster) string
ToClusterKey makes a unique key which is used to create the root namespace in super control plane for a virtual cluster. To avoid name conflict, the key uses the format <namespace>-<hash>-<name>
func ToSuperClusterNamespace ¶
Types ¶
type Conversion ¶
type Conversion interface { BuildSuperClusterObject(cluster string, obj client.Object) (client.Object, error) BuildSuperClusterNamespace(cluster string, obj client.Object) (client.Object, error) }
func Convertor ¶
func Convertor(syncerConfig *config.SyncerConfiguration, mcc mc.MultiClusterInterface) Conversion
Convertor implement the Conversion interface.
type PodMutateCtx ¶
type PodMutateCtx struct { Mc *mc.MultiClusterController ClusterName string PPod *v1.Pod VPod *v1.Pod }
PodMutateCtx is the context passed to the pod mutator
func (*PodMutateCtx) Mutate ¶
func (p *PodMutateCtx) Mutate(ms ...PodMutator) error
Mutate convert the meta data of containers to super control plane namespace. replace the service account token volume mounts to super control plane side one.
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 PodMutateDefault ¶
func PodMutateDefault(vPod *v1.Pod, saSecretMap map[string]string, services []*v1.Service, nameServer string, dnsOption []v1.PodDNSConfigOption) PodMutator
type SecretMutateInterface ¶
type ServiceMutateInterface ¶
type VCMutateInterface ¶
type VCMutateInterface interface { Pod(pPod, vPod *v1.Pod) PodMutateInterface Service(pService *v1.Service) ServiceMutateInterface ServiceAccountTokenSecret(pSecret *v1.Secret) SecretMutateInterface }
func VC ¶
func VC(mc *mc.MultiClusterController, clusterName string) VCMutateInterface