k8s

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 55 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackFunc added in v0.1.18

type CallbackFunc func(unstructured.Unstructured) error

type Conditionals added in v0.1.11

type Conditionals struct {
	When string `json:"when"`
}

type ConvertSchemaFn added in v0.7.0

type FetchCRDFn added in v0.7.0

type FetchCRDFn func(context.Context) ([]extv1.CustomResourceDefinition, error)

type ForEach added in v0.1.9

type ForEach struct {
	IsArray bool
	IsMap   bool
	Array   []interface{}
	Map     map[string]interface{}
}

type ForEachResource added in v0.1.9

type ForEachResource struct {
	ForEach string `json:"forEach"`
}

type MapInterface added in v0.1.2

type MapInterface map[string]interface{}

type NullWatcher added in v0.1.18

type NullWatcher struct{}

func (*NullWatcher) Watch added in v0.1.18

func (w *NullWatcher) Watch(exampleObject *unstructured.Unstructured, template *templatev1.Template, cb CallbackFunc) error

type PatchApplier

type PatchApplier struct {
	Clientset     *kubernetes.Clientset
	Log           logr.Logger
	FuncMap       template.FuncMap
	SchemaManager *SchemaManager
}

func NewPatchApplier

func NewPatchApplier(clientset *kubernetes.Clientset, schemaManager *SchemaManager, log logr.Logger) (*PatchApplier, error)

func (*PatchApplier) Apply

func (p *PatchApplier) Apply(resource *unstructured.Unstructured, patchStr string, patchType PatchType) (*unstructured.Unstructured, error)

type PatchType

type PatchType string
var (
	PatchTypeYaml PatchType = "yaml"
	PatchTypeJSON PatchType = "json"
)

type RESTManager added in v0.5.0

type RESTManager struct {
	Client *kommons.Client
	kubernetes.Interface
	Log     logr.Logger
	FuncMap template.FuncMap
}

func NewRESTManager added in v0.5.0

func NewRESTManager(c *kommons.Client, log logr.Logger) (*RESTManager, error)

func (*RESTManager) Delete added in v0.5.0

func (r *RESTManager) Delete(ctx context.Context, rest *templatev1.REST) error

func (*RESTManager) Update added in v0.5.0

func (r *RESTManager) Update(ctx context.Context, rest *templatev1.REST) (map[string]string, error)

type ResourcePatch

type ResourcePatch struct {
	Resource   *unstructured.Unstructured
	Patch      string
	Kind       string
	APIVersion string
	PatchType  PatchType
}

type SchemaCache added in v0.1.7

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

func NewSchemaCache added in v0.1.7

func NewSchemaCache(clientset *kubernetes.Clientset, crdClient extapi.ApiextensionsV1Interface, expire time.Duration, log logr.Logger) *SchemaCache

func (*SchemaCache) CachedConvertSchema added in v0.7.0

func (*SchemaCache) ExpireResources added in v0.1.15

func (sc *SchemaCache) ExpireResources() error

func (*SchemaCache) ExpireSchema added in v0.1.15

func (sc *SchemaCache) ExpireSchema() error

func (*SchemaCache) FetchCRD added in v0.7.0

func (sc *SchemaCache) FetchCRD() ([]extv1.CustomResourceDefinition, error)

func (*SchemaCache) FetchResources added in v0.1.7

func (sc *SchemaCache) FetchResources() ([]*metav1.APIResourceList, error)

func (*SchemaCache) FetchSchema added in v0.1.7

func (sc *SchemaCache) FetchSchema() (*spec.Swagger, error)

func (*SchemaCache) ResourceHasExpired added in v0.1.15

func (sc *SchemaCache) ResourceHasExpired() bool

func (*SchemaCache) SchemaHasExpired added in v0.1.15

func (sc *SchemaCache) SchemaHasExpired() bool

type SchemaManager added in v0.1.2

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

func NewSchemaManager added in v0.1.2

func NewSchemaManager(clientset *kubernetes.Clientset, crdClient extapi.ApiextensionsV1Interface, log logr.Logger) (*SchemaManager, error)

func NewSchemaManagerWithCache added in v0.1.7

func NewSchemaManagerWithCache(clientset *kubernetes.Clientset, crdClient extapi.ApiextensionsV1Interface, cache *SchemaCache, log logr.Logger) (*SchemaManager, error)

func (*SchemaManager) DuckType added in v0.1.2

func (*SchemaManager) FindSchemaForKind added in v0.1.2

func (m *SchemaManager) FindSchemaForKind(gvk schema.GroupVersionKind) (*spec.Schema, bool, error)

func (*SchemaManager) FindTypeForKey added in v0.1.2

func (m *SchemaManager) FindTypeForKey(gvk schema.GroupVersionKind, key string) (*TypedField, error)

func (*SchemaManager) FindTypeForKeyFromSchema added in v0.1.2

func (m *SchemaManager) FindTypeForKeyFromSchema(schema *spec.Schema, key string) (*TypedField, error)

type TemplateManager

type TemplateManager struct {
	Client *kommons.Client
	kubernetes.Interface
	Log           logr.Logger
	PatchApplier  *PatchApplier
	SchemaManager *SchemaManager
	SchemaCache   *SchemaCache
	FuncMap       template.FuncMap
	Events        record.EventRecorder
	Watcher       WatcherInterface
}

func NewTemplateManager

func NewTemplateManager(c *kommons.Client, log logr.Logger, cache *SchemaCache, events record.EventRecorder, watcher WatcherInterface) (*TemplateManager, error)

func (*TemplateManager) GetSourceNamespaces added in v0.1.18

func (tm *TemplateManager) GetSourceNamespaces(ctx context.Context, template *templatev1.Template) ([]string, error)

func (*TemplateManager) HandleSource added in v0.1.18

func (tm *TemplateManager) HandleSource(ctx context.Context, template *templatev1.Template, source unstructured.Unstructured) (result ctrl.Result, err error)

func (*TemplateManager) JSONPath added in v0.1.9

func (tm *TemplateManager) JSONPath(object interface{}, jsonpath string) (*ForEach, error)

func (*TemplateManager) Run

func (tm *TemplateManager) Run(ctx context.Context, template *templatev1.Template, cb CallbackFunc) (result ctrl.Result, err error)

func (*TemplateManager) Template added in v0.1.0

func (tm *TemplateManager) Template(data []byte, vars interface{}) ([]byte, error)

type TypedField added in v0.1.2

type TypedField struct {
	Types  []string
	Format string
}

type Watcher added in v0.1.18

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

func (*Watcher) Watch added in v0.1.18

func (w *Watcher) Watch(exampleObject *unstructured.Unstructured, template *templatev1.Template, cb CallbackFunc) error

type WatcherInterface added in v0.1.18

type WatcherInterface interface {
	Watch(exampleObject *unstructured.Unstructured, template *templatev1.Template, cb CallbackFunc) error
}

func NewWatcher added in v0.1.18

func NewWatcher(client *kommons.Client, log logr.Logger) (WatcherInterface, error)

Jump to

Keyboard shortcuts

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