shared

package
v0.34.2 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// the patch metadata is capped at 2kb of data, for more see https://github.com/solo-io/solo-kit/issues/523
	// 2147483647 bytes max k8s get from etcd / 2kb per status patch ~= 1 million resources
	MaxStatusBytes = 2048
)

Variables

View Source
var (
	// only public for unit tests!
	DisableMaxStatusSize = false

	NoNamespacedStatusesError = func(inputResource resources.InputResource) error {
		return errors.Errorf("no namespaced statuses found on input resource %s.%s (%T)",
			inputResource.GetMetadata().GetNamespace(),
			inputResource.GetMetadata().GetName(),
			inputResource)
	}
	StatusReporterNamespaceError = func(err error) error {
		return errors.Wrapf(err, "getting status reporter namespace")
	}
	NamespacedStatusNotFoundError = func(inputResource resources.InputResource, namespace string) error {
		return errors.Errorf("input resource %s.%s (%T) does not contain status for namespace %s",
			inputResource.GetMetadata().GetNamespace(),
			inputResource.GetMetadata().GetName(),
			inputResource,
			namespace)
	}
	ResourceMarshalError = func(err error, inputResource resources.InputResource) error {
		return errors.Wrapf(err, "marshalling input resource %s.%s (%T)",
			inputResource.GetMetadata().GetNamespace(),
			inputResource.GetMetadata().GetName(),
			inputResource)
	}
	PatchTooLargeError = func(data []byte) error {
		return errors.Errorf("patch is too large (%v bytes), max is %v bytes", len(data), MaxStatusBytes)
	}
)

Functions

func ApplyStatus

ApplyStatus is used by clients that don't support patch updates to resource statuses (e.g. consul, files, in-memory)

func GetJsonPatchData

func GetJsonPatchData(ctx context.Context, inputResource resources.InputResource) ([]byte, error)

GetJsonPatchData returns the status json patch data for the input resource. Prefer using json patch for single api call status updates when supported (e.g. k8s) to avoid ratelimiting to the k8s apiserver (e.g. https://github.com/solo-io/gloo/blob/a083522af0a4ce22f4d2adf3a02470f782d5a865/projects/gloo/api/v1/settings.proto#L337-L350)

Types

This section is empty.

Jump to

Keyboard shortcuts

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