configset

package
v0.0.0-...-0638c7c Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSetInfoSecretPrefix            = "configset.v1."
	DefaultSetInfoSecretDataKey           = "data"
	DefaultSetInfoSecretFieldOwner        = "configset/secret-store"
	DefaultSetInfoSecretLockAnnotationKey = "configset/lock-id"
	DefaultSetInfoSecretIsSetInfoLabelKey = "configset/is-set-info"
)
View Source
const (
	DefaultFieldOwner = "configset"
)

Variables

View Source
var (
	ErrFailedToOperateSomeResources = fmt.Errorf("failed to opearate some resources")
)

Functions

func AddObjectResultsToDiffer

func AddObjectResultsToDiffer(results []ObjectResult, differ *diffutil.Differ, opt AddObjectResultsToDifferOptions) error

Types

type AddObjectResultsToDifferOptions

type AddObjectResultsToDifferOptions struct {
	Prefix                                       string
	StripManagedFields                           bool
	StripGeneration                              bool
	StripResourceVersion                         bool
	StripStatus                                  bool
	FixAutoscalingV2Beta2HorizontalPodAutoscaler bool
}

type ApplyOptions

type ApplyOptions struct {
	DryRun              bool
	ForceConflicts      bool
	PopulateLiveObjects bool
	LogObjectResultFunc func(ObjectResult)
}

type ApplyResult

type ApplyResult struct {
	ObjectResults []ObjectResult
}

type Client

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

func NewClient

func NewClient(kubeClient crclient.Client, store SetInfoStore) (*Client, error)

func (*Client) Apply

func (c *Client) Apply(ctx context.Context, name string, objs []Object, opt ApplyOptions) (ApplyResult, error)

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, name string, opt DeleteOptions) (DeleteResult, error)

func (*Client) Store

func (c *Client) Store() SetInfoStore

type DeleteOptions

type DeleteOptions struct {
	DryRun              bool
	PopulateLiveObjects bool
	LogObjectResultFunc func(ObjectResult)
}

type DeleteResult

type DeleteResult struct {
	ObjectResults []ObjectResult
}

type Object

type Object interface {
	metav1.Object
	runtime.Object
}

type ObjectAction

type ObjectAction string
const (
	ObjectActionUpdate    ObjectAction = "update"
	LogObjectActionDelete ObjectAction = "delete"
)

type ObjectResult

type ObjectResult struct {
	Action ObjectAction
	Error  error

	Config  Object
	Live    Object
	Updated Object
}

type ResourceInfo

type ResourceInfo struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Namespace  string `json:"namespace"`
	Name       string `json:"name"`
	UID        string `json:"uid"`
}

type SecretSetInfoStore

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

func NewSecretSetInfoStore

func NewSecretSetInfoStore(kubeClient crclient.Client, namespace string) (*SecretSetInfoStore, error)

func (*SecretSetInfoStore) CreateSetInfo

func (s *SecretSetInfoStore) CreateSetInfo(ctx context.Context, name string, info *SetInfo) error

func (*SecretSetInfoStore) DeleteSetInfo

func (s *SecretSetInfoStore) DeleteSetInfo(ctx context.Context, name string) error

func (*SecretSetInfoStore) GetSetInfo

func (s *SecretSetInfoStore) GetSetInfo(ctx context.Context, name string) (*SetInfo, error)

func (*SecretSetInfoStore) ListSetInfos

func (s *SecretSetInfoStore) ListSetInfos(ctx context.Context) ([]*SetInfo, error)

func (*SecretSetInfoStore) UpdateSetInfo

func (s *SecretSetInfoStore) UpdateSetInfo(ctx context.Context, name string, info *SetInfo) error

type SetInfo

type SetInfo struct {
	Name      string         `json:"name"`
	Resources []ResourceInfo `json:"resources"`
	UpdatedAt string         `json:"updatedAt"`
}

type SetInfoStore

type SetInfoStore interface {
	GetSetInfo(ctx context.Context, name string) (*SetInfo, error)
	ListSetInfos(ctx context.Context) ([]*SetInfo, error)
	CreateSetInfo(ctx context.Context, name string, info *SetInfo) error
	UpdateSetInfo(ctx context.Context, name string, info *SetInfo) error
	DeleteSetInfo(ctx context.Context, name string) error
}

Jump to

Keyboard shortcuts

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