v1

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 8 Imported by: 37

Documentation

Overview

Package v1 contains core API types used by most ndd resources. +kubebuilder:object:generate=true

Index

Constants

View Source
const LabelKeyNetworkNodeName = "ndd.yndd.io/networknode"

LabelKeyNetworkNodeName is added to NetworkNodeUsages to relate them to their NetworkNode.

Variables

View Source
var RegisterPath = &gnmi.Path{
	Elem: []*gnmi.PathElem{
		{Name: RegisterPathElemName, Key: map[string]string{RegisterPathElemKey: ""}},
	},
}
View Source
var RegisterPathElemKey = "name"
View Source
var RegisterPathElemName = "ndd-registration"

Functions

This section is empty.

Types

type Condition

type Condition struct {
	// Type of this condition. At most one of each condition type may apply to
	// a resource at any point in time.
	Kind ConditionKind `json:"kind"`

	// Status of this condition; is it currently True, False, or Unknown?
	Status corev1.ConditionStatus `json:"status"`

	// LastTransitionTime is the last time this condition transitioned from one
	// status to another.
	LastTransitionTime metav1.Time `json:"lastTransitionTime"`

	// A Reason for this condition's last transition from one status to another.
	Reason ConditionReason `json:"reason"`

	// A Message containing details about this condition's last transition from
	// one status to another, if any.
	// +optional
	Message string `json:"message,omitempty"`
}

A Condition that may apply to a resource

func Available

func Available() Condition

Available returns a condition that indicates the resource is currently observed to be available for use.

func Creating

func Creating() Condition

Creating returns a condition that indicates the resource is currently being created.

func Deleting

func Deleting() Condition

Deleting returns a condition that indicates the resource is currently being deleted.

func Failed added in v0.2.9

func Failed(msg string) Condition

Failed returns a condition that indicates the resource failed to get instantiated.

func Pending added in v0.2.23

func Pending() Condition

Pending returns a condition that indicates the resource is not currently available for use and is still being processed

func ReconcileError

func ReconcileError(err error) Condition

ReconcileError returns a condition indicating that ndd encountered an error while reconciling the resource. This could mean ndd was unable to update the resource to reflect its desired state, or that ndd was unable to determine the current actual state of the resource.

func ReconcileSuccess

func ReconcileSuccess() Condition

ReconcileSuccess returns a condition indicating that ndd successfully completed the most recent reconciliation of the resource.

func RootPathValidationFailure added in v0.3.0

func RootPathValidationFailure() Condition

LeafRefValidationFailure returns a condition that indicates the resource leafreference(s) are missing

func RootPathValidationSuccess added in v0.3.0

func RootPathValidationSuccess() Condition

LeafRefValidationSuccess returns a condition that indicates the resource leafreference(s) are found or no leafrefs exist

func RootPathValidationUnknown added in v0.3.0

func RootPathValidationUnknown() Condition

LeafRefValidationUnknown returns a condition that indicates the internal leafref validation is unknown

func TargetFound

func TargetFound() Condition

TargetFound returns a condition that indicates the resource has target(s) available for use.

func TargetNotFound

func TargetNotFound() Condition

TargetNotFound returns a condition that indicates the resource has no target(s) available for use.

func Unavailable

func Unavailable() Condition

Unavailable returns a condition that indicates the resource is not currently available for use. Unavailable should be set only when ndd expects the resource to be available but knows it is not, for example because its API reports it is unhealthy.

func Unknown

func Unknown() Condition

Unknown returns a condition that indicates the resource is in an unknown status.

func Updating

func Updating() Condition

Updating returns a condition that indicates the resource is currently being updated.

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (Condition) Equal

func (c Condition) Equal(other Condition) bool

Equal returns true if the condition is identical to the supplied condition, ignoring the LastTransitionTime.

func (Condition) WithMessage

func (c Condition) WithMessage(msg string) Condition

WithMessage returns a condition by adding the provided message to existing condition.

type ConditionKind

type ConditionKind string

A ConditionKind represents a condition kind for a resource

const (
	// handled per resource
	//ConditionKindLeafRef ConditionKind = "LeafrefValidationSuccess"
	// handled per resource
	//ConditionKindInternalLeafRef ConditionKind = "InternalLeafrefValidationSuccess"
	// handled per target per resource
	//ConditionKindExternalLeafRef ConditionKind = "ExternalLeafrefValidationSuccess"
	// handled per resource
	ConditionKindRootPath ConditionKind = "RootPathValidationSuccess"
	// handled per resource
	ConditionKindTarget ConditionKind = "TargetFound"
	// handled per target per resource
	ConditionKindSynced ConditionKind = "Synced"
	// handled per target per resource
	ConditionKindReady ConditionKind = "Ready"
)

Condition Kinds.

type ConditionReason

type ConditionReason string

A ConditionReason represents the reason a resource is in a condition.

const (
	ConditionReasonSuccess ConditionReason = "Success"
	ConditionReasonFailed  ConditionReason = "Failed"
)

Reasons a resource validation is or is not ok applicable to leafref validation and target validation

const (
	ConditionReasonUnknown     ConditionReason = "Unknown"
	ConditionReasonCreating    ConditionReason = "Creating"
	ConditionReasonDeleting    ConditionReason = "Deleting"
	ConditionReasonUpdating    ConditionReason = "Updating"
	ConditionReasonUnavailable ConditionReason = "UnAvailable"
	ConditionReasonAvailable   ConditionReason = "Available"
	ConditionReasonPending     ConditionReason = "Pending"
)

Reasons a resource is or is not ready

const (
	ConditionReasonReconcileSuccess ConditionReason = "ReconcileSuccess"
	ConditionReasonReconcileFailure ConditionReason = "ReconcileFailure"
)

Reasons a resource is or is not synced.

type ConditionedStatus

type ConditionedStatus struct {
	// Conditions of the resource.
	// +optional
	Conditions []Condition `json:"conditions,omitempty"`
}

A ConditionedStatus reflects the observed status of a resource. Only one condition of each kind may exist.

func NewConditionedStatus

func NewConditionedStatus(c ...Condition) *ConditionedStatus

NewConditionedStatus returns a stat with the supplied conditions set.

func (*ConditionedStatus) DeepCopy

func (in *ConditionedStatus) DeepCopy() *ConditionedStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConditionedStatus.

func (*ConditionedStatus) DeepCopyInto

func (in *ConditionedStatus) DeepCopyInto(out *ConditionedStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*ConditionedStatus) Equal

func (s *ConditionedStatus) Equal(other *ConditionedStatus) bool

Equal returns true if the status is identical to the supplied status, ignoring the LastTransitionTimes and order of statuses.

func (*ConditionedStatus) GetCondition

func (s *ConditionedStatus) GetCondition(ck ConditionKind) Condition

GetCondition returns the condition for the given ConditionKind if exists, otherwise returns nil

func (*ConditionedStatus) SetConditions

func (s *ConditionedStatus) SetConditions(c ...Condition)

SetConditions sets the supplied conditions, replacing any existing conditions of the same kind. This is a no-op if all supplied conditions are identical, ignoring the last transition time, to those already set.

type DeletionPolicy

type DeletionPolicy string

A DeletionPolicy determines what should happen to the underlying external resource when a managed resource is deleted. +kubebuilder:validation:Enum=Orphan;Delete

const (
	// DeletionOrphan means the external resource will orphaned when its managed
	// resource is deleted.
	DeletionOrphan DeletionPolicy = "Orphan"

	// DeletionDelete means both the  external resource will be deleted when its
	// managed resource is deleted.
	DeletionDelete DeletionPolicy = "Delete"
)

type DeviceType

type DeviceType string
const (
	DeviceTypeUnknown DeviceType = ""
)

func DeviceTypePtr

func DeviceTypePtr(c DeviceType) *DeviceType

type NetworkNodeStatus

type NetworkNodeStatus struct {
	ConditionedStatus `json:",inline"`

	// Users of this network node configuration.
	Users int64 `json:"users,omitempty"`
}

A NetworkNodeStatus defines the observed status of a NetworkNode.

func (*NetworkNodeStatus) DeepCopy

func (in *NetworkNodeStatus) DeepCopy() *NetworkNodeStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkNodeStatus.

func (*NetworkNodeStatus) DeepCopyInto

func (in *NetworkNodeStatus) DeepCopyInto(out *NetworkNodeStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NetworkNodeUsage

type NetworkNodeUsage struct {
	// NetworkNodeReference to the network node config being used.
	NetworkNodeReference Reference `json:"NetworkNodeRef"`

	// ResourceReference to the managed resource using the network node config.
	ResourceReference TypedReference `json:"resourceRef"`
}

A NetworkNodeUsage is a record that a particular managed resource is using a particular network node configuration.

func (*NetworkNodeUsage) DeepCopy

func (in *NetworkNodeUsage) DeepCopy() *NetworkNodeUsage

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NetworkNodeUsage.

func (*NetworkNodeUsage) DeepCopyInto

func (in *NetworkNodeUsage) DeepCopyInto(out *NetworkNodeUsage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Reference

type Reference struct {
	// Name of the referenced object.
	Name string `json:"name"`
}

A Reference to a named object.

func (*Reference) DeepCopy

func (in *Reference) DeepCopy() *Reference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Reference.

func (*Reference) DeepCopyInto

func (in *Reference) DeepCopyInto(out *Reference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Register

type Register struct {
	// MatchString defines the string to match the devices for discovery
	// +optional
	MatchString string `json:"matchString,omitempty"`

	// Registrations defines the Registrations the device driver subscribes to for config change notifications
	// +optional
	Subscriptions []string `json:"subscriptions,omitempty"`

	// ExceptionPaths defines the exception paths that should be ignored during change notifications
	// if the xpath contains the exception path it is considered a match
	// +optional
	ExceptionPaths []string `json:"exceptionPaths,omitempty"`

	// ExplicitExceptionPaths defines the exception paths that should be ignored during change notifications
	// the match should be exact to condider this xpath
	// +optional
	ExplicitExceptionPaths []string `json:"explicitExceptionPaths,omitempty"`
}

RegistrationParameters defines the Registrations the device driver subscribes to for config change notifications

func (*Register) DeepCopy

func (in *Register) DeepCopy() *Register

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Register.

func (*Register) DeepCopyInto

func (in *Register) DeepCopyInto(out *Register)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Register) GetSubscriptions

func (r *Register) GetSubscriptions() []string

func (*Register) SetSubscriptions

func (r *Register) SetSubscriptions(s []string)

type ResourceName

type ResourceName struct {
	Name string `json:"name,omitempty"`
}

func (*ResourceName) DeepCopy

func (in *ResourceName) DeepCopy() *ResourceName

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceName.

func (*ResourceName) DeepCopyInto

func (in *ResourceName) DeepCopyInto(out *ResourceName)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceSpec

type ResourceSpec struct {
	// Active specifies if the managed resource is active or not
	// +kubebuilder:default=true
	Active bool `json:"active,omitempty"`

	// NetworkNodeReference specifies which network node will be used to
	// create, observe, update, and delete this managed resource
	// +kubebuilder:default={"name": "default"}
	NetworkNodeReference *Reference `json:"networkNodeRef,omitempty"`

	// DeletionPolicy specifies what will happen to the underlying external
	// when this managed resource is deleted - either "Delete" or "Orphan" the
	// external resource.
	// +optional
	// +kubebuilder:default=Delete
	DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`
}

A ResourceSpec defines the desired state of a managed resource.

func (*ResourceSpec) DeepCopy

func (in *ResourceSpec) DeepCopy() *ResourceSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceSpec.

func (*ResourceSpec) DeepCopyInto

func (in *ResourceSpec) DeepCopyInto(out *ResourceSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceStatus

type ResourceStatus struct {
	// the condition status
	ConditionedStatus `json:",inline"`
	// rootPaths define the rootPaths of the cr, used to monitor the resource status
	RootPaths []string `json:"rootPaths,omitempty"`
	// HierPaths tracks the hierarchical paths of the CR based on adjacent resources
	HierPaths map[string][]string `json:"hierPaths,omitempty"`
}

ResourceStatus represents the observed state of a managed resource.

func (*ResourceStatus) DeepCopy

func (in *ResourceStatus) DeepCopy() *ResourceStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceStatus.

func (*ResourceStatus) DeepCopyInto

func (in *ResourceStatus) DeepCopyInto(out *ResourceStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Selector

type Selector struct {
	// MatchLabels ensures an object with matching labels is selected.
	MatchLabels map[string]string `json:"matchLabels,omitempty"`

	// MatchControllerRef ensures an object with the same controller reference
	// as the selecting object is selected.
	MatchControllerRef *bool `json:"matchControllerRef,omitempty"`
}

A Selector selects an object.

func (*Selector) DeepCopy

func (in *Selector) DeepCopy() *Selector

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Selector.

func (*Selector) DeepCopyInto

func (in *Selector) DeepCopyInto(out *Selector)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Target

type Target struct {
	// Name of the Target
	Name string `json:"name,omitempty"`
	// Configuration that is used by the gnmi client
	Config *types.TargetConfig `json:"config,omitempty"`
	// Target gnmi client
	Target *target.Target `json:"target,omitempty"`
}

+k8s:deepcopy-gen=false

func (*Target) IsTargetDeleted

func (t *Target) IsTargetDeleted(ns []string) bool

type TransactionResourceStatus added in v0.2.25

type TransactionResourceStatus struct {
	// the condition status
	ConditionedStatus `json:",inline"`

	// conditionsStatus per device
	Device map[string]ConditionedStatus `json:"device,omitempty"`
}

func (*TransactionResourceStatus) DeepCopy added in v0.2.30

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TransactionResourceStatus.

func (*TransactionResourceStatus) DeepCopyInto added in v0.2.30

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type TypedReference

type TypedReference struct {
	// APIVersion of the referenced object.
	APIVersion string `json:"apiVersion"`

	// Kind of the referenced object.
	Kind string `json:"kind"`

	// Name of the referenced object.
	Name string `json:"name"`

	// UID of the referenced object.
	// +optional
	UID types.UID `json:"uid,omitempty"`
}

A TypedReference refers to an object by Name, Kind, and APIVersion. It is commonly used to reference cluster-scoped objects or objects where the namespace is already known.

func (*TypedReference) DeepCopy

func (in *TypedReference) DeepCopy() *TypedReference

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TypedReference.

func (*TypedReference) DeepCopyInto

func (in *TypedReference) DeepCopyInto(out *TypedReference)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*TypedReference) GetObjectKind

func (obj *TypedReference) GetObjectKind() schema.ObjectKind

GetObjectKind get the ObjectKind of a TypedReference.

func (*TypedReference) GroupVersionKind

func (obj *TypedReference) GroupVersionKind() schema.GroupVersionKind

GroupVersionKind gets the GroupVersionKind of a TypedReference.

func (*TypedReference) SetGroupVersionKind

func (obj *TypedReference) SetGroupVersionKind(gvk schema.GroupVersionKind)

SetGroupVersionKind sets the Kind and APIVersion of a TypedReference.

Jump to

Keyboard shortcuts

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