Documentation ¶
Overview ¶
Package resource provides core resource definition.
Index ¶
- Variables
- func Equal(r1, r2 Resource) bool
- func IsTombstone(res Resource) bool
- func MarshalYAML(r Resource) (interface{}, error)
- type Any
- type Finalizer
- type Finalizers
- type ID
- type Kind
- type List
- type Metadata
- func (md *Metadata) BumpVersion()
- func (md Metadata) Copy() Metadata
- func (md Metadata) Equal(other Metadata) bool
- func (md *Metadata) Finalizers() *Finalizers
- func (md Metadata) ID() ID
- func (md *Metadata) MarshalYAML() (interface{}, error)
- func (md Metadata) Namespace() Namespace
- func (md Metadata) Owner() Owner
- func (md Metadata) Phase() Phase
- func (md *Metadata) SetOwner(owner Owner) error
- func (md *Metadata) SetPhase(newPhase Phase)
- func (md *Metadata) SetVersion(newVersion Version)
- func (md Metadata) String() string
- func (md Metadata) Type() Type
- func (md Metadata) Version() Version
- type MetadataProto
- type Namespace
- type Owner
- type Phase
- type Pointer
- type Reference
- type Resource
- type SpecProto
- type Tombstone
- type Tombstoned
- type Type
- type Version
Constants ¶
This section is empty.
Variables ¶
var (
VersionUndefined = Version{}
)
Special version constants.
Functions ¶
func IsTombstone ¶
IsTombstone checks if resource is represented by the Tombstone.
func MarshalYAML ¶
MarshalYAML marshals resource to YAML definition.
Types ¶
type Any ¶
type Any struct {
// contains filtered or unexported fields
}
Any can hold data from any resource type.
func NewAnyFromProto ¶
func NewAnyFromProto(protoMd MetadataProto, protoSpec SpecProto) (*Any, error)
NewAnyFromProto unmarshals Any from protobuf interface.
type Finalizer ¶
type Finalizer = string
Finalizer is a free-form string which blocks resource destruction.
Resource can't be destroyed until all the finalizers are cleared.
type Finalizers ¶
type Finalizers []Finalizer
Finalizers is a set of Finalizer's with methods to add/remove items.
func (*Finalizers) Add ¶
func (fins *Finalizers) Add(fin Finalizer) (added bool)
Add a (unique) Finalizer to the set.
func (Finalizers) Empty ¶
func (fins Finalizers) Empty() bool
Empty returns true if list of finalizers is empty.
func (*Finalizers) Remove ¶
func (fins *Finalizers) Remove(fin Finalizer) (removed bool)
Remove a (unique) Finalizer from the set.
type Metadata ¶
type Metadata struct {
// contains filtered or unexported fields
}
Metadata implements resource meta.
func NewMetadata ¶
NewMetadata builds new metadata.
func NewMetadataFromProto ¶
func NewMetadataFromProto(proto MetadataProto) (Metadata, error)
NewMetadataFromProto builds Metadata object from ProtoMetadata interface data.
func (*Metadata) BumpVersion ¶
func (md *Metadata) BumpVersion()
BumpVersion increments resource version.
func (*Metadata) Finalizers ¶
func (md *Metadata) Finalizers() *Finalizers
Finalizers returns a reference to the finalizers.
func (*Metadata) MarshalYAML ¶
MarshalYAML implements yaml.Marshaller interface.
func (*Metadata) SetVersion ¶
SetVersion updates resource version.
type MetadataProto ¶
type MetadataProto interface { GetNamespace() string GetType() string GetId() string GetVersion() string GetPhase() string GetOwner() string GetFinalizers() []string }
MetadataProto is an interface for protobuf serialization of Metadata.
type Phase ¶
type Phase int
Phase represents state of the resource.
Resource might be either Running or TearingDown (waiting for the finalizers to be removed).
type Resource ¶
type Resource interface { // String() method for debugging/logging. fmt.Stringer // Metadata for the resource. // // Metadata.Version should change each time Spec changes. Metadata() *Metadata // Opaque data resource contains. Spec() interface{} // Deep copy of the resource. DeepCopy() Resource }
Resource is an abstract resource managed by the state.
Resource is uniquely identified by the tuple (Namespace, Type, ID). Resource might have additional opaque data in Spec(). When resource is updated, Version should change with each update.
type SpecProto ¶
type SpecProto interface {
GetYaml() []byte
}
SpecProto is a protobuf interface of resource spec.
type Tombstone ¶
type Tombstone struct {
// contains filtered or unexported fields
}
Tombstone is a resource without a Spec.
Tombstones are used to present state of a deleted resource.
func NewTombstone ¶
NewTombstone builds a tombstone from resource reference.
func (*Tombstone) Metadata ¶
Metadata for the resource.
Metadata.Version should change each time Spec changes.
type Tombstoned ¶
type Tombstoned interface {
Tombstone()
}
Tombstoned is a marker interface for Tombstones.
type Version ¶
type Version struct {
// contains filtered or unexported fields
}
Version of a resource.
func ParseVersion ¶
ParseVersion from string representation.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package meta provides definition of core metadata resources.
|
Package meta provides definition of core metadata resources. |
Package protobuf provides a bridge between resources and protobuf interface.
|
Package protobuf provides a bridge between resources and protobuf interface. |