labelenforcingclient

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheLabelSelectorKey   = "hypershift.openshift.io/managed"
	CacheLabelSelectorValue = "true"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LabelEnforcingClient

type LabelEnforcingClient struct {
	client.Client
	// contains filtered or unexported fields
}

LabelEnforcingClient enforces that its configured labels are set during a Create or Update call

func New

func New(upstream client.Client, labels map[string]string) *LabelEnforcingClient

func (*LabelEnforcingClient) Create

func (*LabelEnforcingClient) Update

type LabelEnforcingUpsertProvider

type LabelEnforcingUpsertProvider struct {
	Upstream  upsert.CreateOrUpdateProvider
	APIReader client.Reader
}

LabelEnforcingUpsertProvider wraps an existing upsert provider who is called with a cache-backed client that has a labelselector configured. If someone unlabels an object, the upserprovider will always get a notfound when trying to Get is, because it is not in the cache. Thus it will subsquently try to Create it, which will fail with an IsAlreadyExists since it exists in the api. To deal with this, the LabelEnforcingUpsertProvider simply re-runs the upsert logic with an api reading client if an IsAlreadyExists happened.

func (*LabelEnforcingUpsertProvider) CreateOrUpdate

Jump to

Keyboard shortcuts

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