kubernetes

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 12, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(mgr manager.Manager, hubconfig *rest.Config, syncid *types.NamespacedName, interval int) error

Add creates the default syncrhonizer and add the start function as runnable into manager

Types

type Extension

type Extension interface {
	UpdateHostStatus(error, *unstructured.Unstructured, interface{}) error
	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
	IsIgnoredGroupKind(schema.GroupKind) bool
}

Extension defines the extension features of synchronizer

type KubeSynchronizer

type KubeSynchronizer struct {
	Interval     int
	LocalClient  client.Client
	RemoteClient client.Client

	DynamicClient  dynamic.Interface
	KubeResources  map[schema.GroupVersionKind]*ResourceMap
	SynchronizerID *types.NamespacedName
	Extension      Extension
	// 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) (*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) ApplyValiadtor

func (sync *KubeSynchronizer) ApplyValiadtor(v *Validator)

ApplyValiadtor use validator to check resources in synchronizer

func (*KubeSynchronizer) CleanupByHost

func (sync *KubeSynchronizer) CleanupByHost(host types.NamespacedName, syncsource string)

CleanupByHost returns initialized validator struct

func (*KubeSynchronizer) CreateValiadtor

func (sync *KubeSynchronizer) CreateValiadtor(syncsource string) *Validator

CreateValiadtor returns initialized validator struct

func (*KubeSynchronizer) DeRegisterTemplate

func (sync *KubeSynchronizer) DeRegisterTemplate(host, dpl types.NamespacedName, source string) error

DeRegisterTemplate applies the resource in spec.template to given kube

func (*KubeSynchronizer) GetInterval

func (sync *KubeSynchronizer) GetInterval() int

func (*KubeSynchronizer) GetValidatedGVK

func (sync *KubeSynchronizer) GetValidatedGVK(org schema.GroupVersionKind) *schema.GroupVersionKind

GetValidatedGVK return right gvk from original

func (*KubeSynchronizer) IsResourceNamespaced

func (sync *KubeSynchronizer) IsResourceNamespaced(gvk schema.GroupVersionKind) bool

func (*KubeSynchronizer) RegisterTemplate

func (sync *KubeSynchronizer) RegisterTemplate(host types.NamespacedName, instance *dplv1alpha1.Deployable, source string) error

RegisterTemplate applies the resource in spec.template to given kube

func (*KubeSynchronizer) Start

func (sync *KubeSynchronizer) Start(s <-chan struct{}) error

Start the discovery and start caches

type ResourceMap

type ResourceMap struct {
	GroupVersionResource schema.GroupVersionResource
	Namespaced           bool
	ServerUpdated        bool
	TemplateMap          map[string]*TemplateUnit
}

ResourceMap is a registry for all resources

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 deployable

func (*SubscriptionExtension) IsIgnoredGroupKind

func (se *SubscriptionExtension) IsIgnoredGroupKind(gk schema.GroupKind) bool

IsIgnoredGroupKind defines update host status function for deployable

func (*SubscriptionExtension) IsObjectOwnedByHost

func (se *SubscriptionExtension) IsObjectOwnedByHost(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) bool

IsObjectOwnedByHost defines update host status function for deployable

func (*SubscriptionExtension) IsObjectOwnedBySynchronizer

func (se *SubscriptionExtension) IsObjectOwnedBySynchronizer(obj metav1.Object, syncid *types.NamespacedName) bool

IsObjectOwnedBySynchronizer defines update host status function for deployable

func (*SubscriptionExtension) SetHostToObject

func (se *SubscriptionExtension) SetHostToObject(obj metav1.Object, host types.NamespacedName, syncid *types.NamespacedName) error

SetHostToObject defines update host status function for deployable

func (*SubscriptionExtension) SetSynchronizerToObject

func (se *SubscriptionExtension) SetSynchronizerToObject(obj metav1.Object, syncid *types.NamespacedName) error

SetSynchronizerToObject defines update host status function for deployable

func (*SubscriptionExtension) UpdateHostStatus

func (se *SubscriptionExtension) UpdateHostStatus(actionerr error, tplunit *unstructured.Unstructured, status interface{}) error

UpdateHostSubscriptionStatus defines update host status function for deployable

type TemplateUnit

type TemplateUnit struct {
	*unstructured.Unstructured
	Source          string
	ResourceUpdated bool
	StatusUpdated   bool
}

TemplateUnit defines the basic unit of Template and whether it should be updated or not

type Validator

type Validator struct {
	*KubeSynchronizer
	Store map[schema.GroupVersionKind]map[string]bool
	// contains filtered or unexported fields
}

Validator is used to validate resources in synchronizer

func (*Validator) AddValidResource

func (v *Validator) AddValidResource(gvk schema.GroupVersionKind, host, dpl types.NamespacedName)

AddValidResource adds resource into validator

Jump to

Keyboard shortcuts

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