config

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2025 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyJSON added in v0.2.4

func ApplyJSON(s Spec, js string) error

func ApplyJSONStrict added in v0.2.4

func ApplyJSONStrict(s Spec, js string) error

func ApplyYAML added in v0.2.4

func ApplyYAML(s Spec, yml string) error

func CanonicalGroup added in v0.2.4

func CanonicalGroup(group string) string

func DeepCopy added in v0.2.4

func DeepCopy(s any) any

func Key added in v0.2.4

func Key(grp, ver, typ, name, namespace string) string

Key function for the configuration objects

func LabelsInRevision added in v0.2.4

func LabelsInRevision(lbls map[string]string, rev string) bool

func LabelsInRevisionOrTags added in v0.2.4

func LabelsInRevisionOrTags(lbls map[string]string, rev string, tags sets.Set[string]) bool

func NamespacedName added in v0.2.4

func NamespacedName[T Namer](o T) kubetypes.NamespacedName

func ObjectInRevision added in v0.2.4

func ObjectInRevision(o *Config, rev string) bool

func ToJSON added in v0.2.4

func ToJSON(s Spec) ([]byte, error)

func ToMap added in v0.2.4

func ToMap(s Spec) (map[string]any, error)

func ToPrettyJSON added in v0.2.4

func ToPrettyJSON(s Spec) ([]byte, error)

func ToProto added in v0.2.4

func ToProto(s Spec) (*anypb.Any, error)

func ToRaw added in v0.2.4

func ToRaw(s Spec) (json.RawMessage, error)

Types

type Config

type Config struct {
	Meta

	// Spec holds the configuration object as a gogo protobuf message
	Spec Spec

	// Status holds long-running status.
	Status Status

	// Extra holds additional, non-spec information for internal processing.
	Extra map[string]any
}

Config is a configuration unit consisting of the type of configuration, the key identifier that is unique per type, and the content represented as a protobuf message.

func (Config) DeepCopy added in v0.2.4

func (c Config) DeepCopy() Config

func (*Config) Equals added in v0.2.4

func (c *Config) Equals(other *Config) bool

func (Config) GetCreationTimestamp added in v0.2.4

func (c Config) GetCreationTimestamp() time.Time

func (Config) GetName added in v0.2.4

func (c Config) GetName() string

func (Config) GetNamespace added in v0.2.4

func (c Config) GetNamespace() string

func (Config) NamespacedName added in v0.2.4

func (c Config) NamespacedName() kubetypes.NamespacedName

type GroupVersionKind added in v0.2.4

type GroupVersionKind struct {
	Group   string `json:"group"`
	Version string `json:"version"`
	Kind    string `json:"kind"`
}

func FromKubernetesGVK added in v0.2.4

func FromKubernetesGVK(gvk schema.GroupVersionKind) GroupVersionKind

func (GroupVersionKind) CanonicalGroup added in v0.2.4

func (g GroupVersionKind) CanonicalGroup() string

CanonicalGroup returns the group with defaulting applied. This means an empty group will be treated as "core", following Kubernetes API standards

func (GroupVersionKind) GroupVersion added in v0.2.4

func (g GroupVersionKind) GroupVersion() string

GroupVersion returns the group/version similar to what would be found in the apiVersion field of a Kubernetes resource.

func (GroupVersionKind) Kubernetes added in v0.2.4

func (g GroupVersionKind) Kubernetes() schema.GroupVersionKind

Kubernetes returns the same GVK, using the Kubernetes object type

func (GroupVersionKind) String added in v0.2.4

func (g GroupVersionKind) String() string

type Meta added in v0.2.4

type Meta struct {
	// GroupVersionKind is a short configuration name that matches the content message type
	// (e.g. "route-rule")
	GroupVersionKind GroupVersionKind `json:"type,omitempty"`

	// UID
	UID string `json:"uid,omitempty"`

	// Name is a unique immutable identifier in a namespace
	Name string `json:"name,omitempty"`

	// Namespace defines the space for names (optional for some types),
	// applications may choose to use namespaces for a variety of purposes
	// (security domains, fault domains, organizational domains)
	Namespace string `json:"namespace,omitempty"`

	// Domain defines the suffix of the fully qualified name past the namespace.
	// Domain is not a part of the unique key unlike name and namespace.
	Domain string `json:"domain,omitempty"`

	// Map of string keys and values that can be used to organize and categorize
	// (scope and select) objects.
	Labels map[string]string `json:"labels,omitempty"`

	// Annotations is an unstructured key value map stored with a resource that may be
	// set by external tools to store and retrieve arbitrary metadata. They are not
	// queryable and should be preserved when modifying objects.
	Annotations map[string]string `json:"annotations,omitempty"`

	// ResourceVersion is an opaque identifier for tracking updates to the config registry.
	// The implementation may use a change index or a commit log for the revision.
	// The config client should not make any assumptions about revisions and rely only on
	// exact equality to implement optimistic concurrency of read-write operations.
	//
	// The lifetime of an object of a particular revision depends on the underlying data store.
	// The data store may compactify old revisions in the interest of storage optimization.
	//
	// An empty revision carries a special meaning that the associated object has
	// not been stored and assigned a revision.
	ResourceVersion string `json:"resourceVersion,omitempty"`

	// CreationTimestamp records the creation time
	CreationTimestamp time.Time `json:"creationTimestamp,omitempty"`

	// OwnerReferences allows specifying in-namespace owning objects.
	OwnerReferences []metav1.OwnerReference `json:"ownerReferences,omitempty"`

	// A sequence number representing a specific generation of the desired state. Populated by the system. Read-only.
	Generation int64 `json:"generation,omitempty"`
}

Meta is metadata attached to each configuration unit. The revision is optional, and if provided, identifies the last update operation on the object.

func (Meta) DeepCopy added in v0.2.4

func (meta Meta) DeepCopy() Meta

func (*Meta) Key added in v0.2.4

func (meta *Meta) Key() string

Key is the unique identifier for a configuration object

func (*Meta) ToObjectMeta added in v0.2.4

func (meta *Meta) ToObjectMeta() metav1.ObjectMeta

type Namer added in v0.2.4

type Namer interface {
	GetName() string
	GetNamespace() string
}

type ObjectWithCluster added in v0.2.4

type ObjectWithCluster[T any] struct {
	ClusterID cluster.ID
	Object    *T
}

func (ObjectWithCluster[T]) GetObjectKeyable added in v0.2.4

func (o ObjectWithCluster[T]) GetObjectKeyable() any

We can't refer to krt directly without causing an import cycle, but this function implements an interface that allows the krt helper to know how to get the object key

type PatchFunc added in v0.2.4

type PatchFunc func(cfg Config) (Config, kubetypes.PatchType)

PatchFunc provides the cached config as a base for modification. Only diff the between the cfg parameter and the returned Config will be applied.

type Spec added in v0.2.4

type Spec any

Spec defines the spec for the config. In order to use below helper methods, this must be one of: * golang/protobuf Message * gogo/protobuf Message * Able to marshal/unmarshal using json

type Status added in v0.2.4

type Status any

Directories

Path Synopsis
schema
gvk
gvr

Jump to

Keyboard shortcuts

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