Documentation ¶
Index ¶
- Constants
- func Add(mgr manager.Manager, hubconfig *rest.Config, syncid *types.NamespacedName, ...) error
- type Extension
- type KubeSynchronizer
- func (sync *KubeSynchronizer) DeleteSingleSubscribedResource(hostSub types.NamespacedName, ...) error
- func (sync *KubeSynchronizer) GetInterval() int
- func (sync *KubeSynchronizer) GetLocalClient() client.Client
- func (sync *KubeSynchronizer) GetLocalNonCachedClient() client.Client
- func (sync *KubeSynchronizer) GetRemoteClient() client.Client
- func (sync *KubeSynchronizer) GetRemoteNonCachedClient() client.Client
- func (sync *KubeSynchronizer) IsResourceNamespaced(rsc *unstructured.Unstructured) bool
- func (sync *KubeSynchronizer) OverrideResource(hostSub types.NamespacedName, resource *ResourceUnit) (*unstructured.Unstructured, error)
- func (sync *KubeSynchronizer) ProcessSubResources(appsub *appv1alpha1.Subscription, resources []ResourceUnit, ...) error
- func (sync *KubeSynchronizer) PurgeAllSubscribedResources(appsub *appv1alpha1.Subscription) error
- func (sync *KubeSynchronizer) Start(ctx context.Context) error
- func (sync *KubeSynchronizer) SyncAppsubClusterStatus(appsub *appv1.Subscription, appsubClusterStatus SubscriptionClusterStatus, ...) error
- type ResourceUnit
- type SubscriptionClusterStatus
- type SubscriptionExtension
- func (se *SubscriptionExtension) GetHostFromObject(obj metav1.Object) *types.NamespacedName
- func (se *SubscriptionExtension) IsObjectOwnedByHost(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) bool
- func (se *SubscriptionExtension) IsObjectOwnedBySynchronizer(obj metav1.Object, syncid *types.NamespacedName) bool
- func (se *SubscriptionExtension) SetHostToObject(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) error
- func (se *SubscriptionExtension) SetSynchronizerToObject(obj metav1.Object, syncid *types.NamespacedName) error
- type SubscriptionUnitStatus
Constants ¶
const ( Synchronizer = "synchronizer" UpdateError = "cached_client_update_total" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Extension ¶
type Extension interface { GetHostFromObject(metav1.Object) *types.NamespacedName SetSynchronizerToObject(metav1.Object, *types.NamespacedName) error SetHostToObject(metav1.Object, types.NamespacedName, *types.NamespacedName) error IsObjectOwnedByHost(metav1.Object, types.NamespacedName, *types.NamespacedName) bool IsObjectOwnedBySynchronizer(metav1.Object, *types.NamespacedName) bool }
Extension defines the extension features of synchronizer
type KubeSynchronizer ¶
type KubeSynchronizer struct { Interval int LocalClient client.Client LocalNonCachedClient client.Client RemoteClient client.Client RemoteNonCachedClient client.Client DynamicClient dynamic.Interface RestMapper meta.RESTMapper SynchronizerID *types.NamespacedName // managed cluster Namespaced name Extension Extension SkipAppSubStatusResDel bool // used by helm subscriber to skip resource delete based on AppSubStatus // contains filtered or unexported fields }
KubeSynchronizer handles resources to a kube endpoint.
func CreateSynchronizer ¶
func CreateSynchronizer(config, remoteConfig *rest.Config, scheme *runtime.Scheme, syncid *types.NamespacedName, interval int, ext Extension, hub, standalone bool) (*KubeSynchronizer, error)
CreateSynchronizer createa an instance of synchrizer with give api-server config.
func GetDefaultSynchronizer ¶
func GetDefaultSynchronizer() *KubeSynchronizer
GetDefaultSynchronizer - return the default kubernetse synchronizer.
func (*KubeSynchronizer) DeleteSingleSubscribedResource ¶ added in v0.5.0
func (sync *KubeSynchronizer) DeleteSingleSubscribedResource(hostSub types.NamespacedName, pkgStatus appSubStatusV1alpha1.SubscriptionUnitStatus) error
DeleteSingleSubscribedResource delete a subcribed resource from a appsub.
func (*KubeSynchronizer) GetInterval ¶
func (sync *KubeSynchronizer) GetInterval() int
func (*KubeSynchronizer) GetLocalClient ¶
func (sync *KubeSynchronizer) GetLocalClient() client.Client
func (*KubeSynchronizer) GetLocalNonCachedClient ¶ added in v0.5.0
func (sync *KubeSynchronizer) GetLocalNonCachedClient() client.Client
func (*KubeSynchronizer) GetRemoteClient ¶
func (sync *KubeSynchronizer) GetRemoteClient() client.Client
func (*KubeSynchronizer) GetRemoteNonCachedClient ¶ added in v0.5.0
func (sync *KubeSynchronizer) GetRemoteNonCachedClient() client.Client
func (*KubeSynchronizer) IsResourceNamespaced ¶
func (sync *KubeSynchronizer) IsResourceNamespaced(rsc *unstructured.Unstructured) bool
func (*KubeSynchronizer) OverrideResource ¶ added in v0.5.0
func (sync *KubeSynchronizer) OverrideResource(hostSub types.NamespacedName, resource *ResourceUnit) (*unstructured.Unstructured, error)
OverrideResource updates resource based on the hosting appsub before the resource is deployed.
func (*KubeSynchronizer) ProcessSubResources ¶ added in v0.5.0
func (sync *KubeSynchronizer) ProcessSubResources(appsub *appv1alpha1.Subscription, resources []ResourceUnit, allowlist, denyList map[string]map[string]string, isAdmin bool) error
func (*KubeSynchronizer) PurgeAllSubscribedResources ¶ added in v0.5.0
func (sync *KubeSynchronizer) PurgeAllSubscribedResources(appsub *appv1alpha1.Subscription) error
PurgeSubscribedResources purge all resources deployed by the appsub.
func (*KubeSynchronizer) Start ¶
func (sync *KubeSynchronizer) Start(ctx context.Context) error
this will be triggered by the manager.
func (*KubeSynchronizer) SyncAppsubClusterStatus ¶ added in v0.5.0
func (sync *KubeSynchronizer) SyncAppsubClusterStatus(appsub *appv1.Subscription, appsubClusterStatus SubscriptionClusterStatus, skipOrphanDelete *bool, skipUpdate *bool) error
type ResourceUnit ¶ added in v0.5.0
type ResourceUnit struct { Resource *unstructured.Unstructured Gvk schema.GroupVersionKind }
type SubscriptionClusterStatus ¶ added in v0.5.0
type SubscriptionClusterStatus struct { Cluster string AppSub types.NamespacedName /* hosting appsub */ Action string /* "APPLY" or "DELETE" */ SubscriptionPackageStatus []SubscriptionUnitStatus }
type SubscriptionExtension ¶
type SubscriptionExtension struct { IngoredGroupKindMap map[schema.GroupKind]bool // contains filtered or unexported fields }
SubscriptionExtension provides default extension settings
func (*SubscriptionExtension) GetHostFromObject ¶
func (se *SubscriptionExtension) GetHostFromObject(obj metav1.Object) *types.NamespacedName
GetHostFromObject defines update host status function for object
func (*SubscriptionExtension) IsObjectOwnedByHost ¶
func (se *SubscriptionExtension) IsObjectOwnedByHost(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) bool
IsObjectOwnedByHost defines update host status function for object
func (*SubscriptionExtension) IsObjectOwnedBySynchronizer ¶
func (se *SubscriptionExtension) IsObjectOwnedBySynchronizer(obj metav1.Object, syncid *types.NamespacedName) bool
IsObjectOwnedBySynchronizer defines update host status function for object
func (*SubscriptionExtension) SetHostToObject ¶
func (se *SubscriptionExtension) SetHostToObject(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) error
SetHostToObject defines update host status function for object
func (*SubscriptionExtension) SetSynchronizerToObject ¶
func (se *SubscriptionExtension) SetSynchronizerToObject(obj metav1.Object, syncid *types.NamespacedName) error
SetSynchronizerToObject defines update host status function for object