object

package
v0.0.0-...-f843765 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTypeNotSupported = errors.New("this type is not supported")
	ErrNotFound         = errors.New("this resource does not exist")
)

Functions

func ConvertToMeta

func ConvertToMeta(obj interface{}) (map[string]string, metav1.Object, error)

ConvertToMeta checks whether the object is of type Pod, Deployment, StatefulSet or DaemonSet, and converts it to metav1.Object, and returns its labels

Types

type Action

type Action uint8
const (
	Create Action = iota
	Update
	Delete
)

type Handler

type Handler struct {
	Client dynamic.Interface
	Obj    metav1.Object
}

func NewHandler

func NewHandler(c dynamic.Interface, obj metav1.Object) *Handler

func (*Handler) AddLabel

func (h *Handler) AddLabel() error

AddLabel applies the "netpol-ctrl":"<obj_name>-<obj_namespace>" label to a metav1.Object if it does not yet have a label

func (*Handler) Mutate

func (h *Handler) Mutate(action Action) error

Mutate applies the modifications to a given metaObj based on the given Action

Jump to

Keyboard shortcuts

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