store

package
v1.11.1 Latest Latest
Warning

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

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

Documentation

Overview

Package store provides a store use to manage deployment dependencies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

type Store struct {
	// contains filtered or unexported fields
}

Store Kubernetes resource dependencies store this store helps to keep track of every resources that the different agent deployments depend on.

func NewStore

func NewStore(owner metav1.Object, options *StoreOptions) *Store

NewStore returns a new Store instance

func (*Store) AddOrUpdate

func (ds *Store) AddOrUpdate(kind kubernetes.ObjectKind, obj client.Object) error

AddOrUpdate used to add or update an object in the Store kind correspond to the object kind, and id can be `namespace/name` identifier of just `name` if we are talking about a cluster scope object like `ClusterRole`.

func (*Store) AddOrUpdateStore

func (ds *Store) AddOrUpdateStore(kind kubernetes.ObjectKind, obj client.Object) *Store

AddOrUpdateStore used to add or update an object in the Store kind correspond to the object kind, and id can be `namespace/name` identifier of just `name` if we are talking about a cluster scope object like `ClusterRole`.

func (*Store) Apply

func (ds *Store) Apply(ctx context.Context, k8sClient client.Client) []error

Apply use to create/update resources in the api-server

func (*Store) Cleanup

func (ds *Store) Cleanup(ctx context.Context, k8sClient client.Client) []error

Cleanup use to cleanup resources that are not needed anymore

func (*Store) Delete

func (ds *Store) Delete(kind kubernetes.ObjectKind, namespace string, name string) bool

Delete deletes an item from the store by kind, namespace and name.

func (*Store) DeleteAll

func (ds *Store) DeleteAll(ctx context.Context, k8sClient client.Client) []error

DeleteAll deletes all the resources that are in the Store

func (*Store) Get

func (ds *Store) Get(kind kubernetes.ObjectKind, namespace string, name string) (client.Object, bool)

Get returns the client.Object instance if it was previously added in the Store. kind correspond to the object kind, and id can be `namespace/name` identifier of just `name` if we are talking about a cluster scope object like `ClusterRole`. It also return a boolean to know if the Object was found in the Store.

func (*Store) GetOrCreate

func (ds *Store) GetOrCreate(kind kubernetes.ObjectKind, namespace, name string) (client.Object, bool)

GetOrCreate returns the client.Object instance.

  • if it was previously added in the Store, it returns the corresponding object
  • if it wasn't previously added in the Store, it returns a new instance of the object Kind with the corresponding name and namespace.

`kind“ correspond to the object kind, and id can be `namespace/name` identifier of just `name` if we are talking about a cluster scope object like `ClusterRole`. It also return a boolean to know if the Object was found in the Store.

func (*Store) GetPlatformInfo

func (ds *Store) GetPlatformInfo() kubernetes.PlatformInfo

GetPlatformInfo returns api-resources info

func (*Store) Logger

func (ds *Store) Logger() logr.Logger

Logger returns the log client

type StoreClient

type StoreClient interface {
	AddOrUpdate(kind kubernetes.ObjectKind, obj client.Object) error
	Get(kind kubernetes.ObjectKind, namespace, name string) (client.Object, bool)
	GetOrCreate(kind kubernetes.ObjectKind, namespace, name string) (client.Object, bool)
	GetPlatformInfo() kubernetes.PlatformInfo
	Delete(kind kubernetes.ObjectKind, namespace string, name string) bool
	DeleteAll(ctx context.Context, k8sClient client.Client) []error
	Logger() logr.Logger
}

StoreClient dependencies store client interface

type StoreOptions

type StoreOptions struct {
	SupportCilium bool
	PlatformInfo  kubernetes.PlatformInfo

	Scheme *runtime.Scheme
	Logger logr.Logger
}

StoreOptions use to provide to NewStore() function some Store creation options.

Jump to

Keyboard shortcuts

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