shared

package
v0.0.0-...-d47c561 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: GPL-2.0 Imports: 7 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

Functions

func EnactmentKey

func EnactmentKey(node, policy string) types.NamespacedName

Types

type Condition

type Condition struct {
	Type               ConditionType          `json:"type"`
	Status             corev1.ConditionStatus `json:"status"`
	Reason             ConditionReason        `json:"reason,omitempty"`
	Message            string                 `json:"message,omitempty"`
	LastHeartbeatTime  metav1.Time            `json:"lastHeartbeatTime,omitempty"`
	LastTransitionTime metav1.Time            `json:"lastTransitionTime,omitempty"`
}

func NewCondition

func NewCondition(conditionType ConditionType, status corev1.ConditionStatus, reason ConditionReason, message string) Condition

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.

type ConditionList

type ConditionList []Condition

func (ConditionList) DeepCopy

func (in ConditionList) DeepCopy() ConditionList

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

func (ConditionList) DeepCopyInto

func (in ConditionList) DeepCopyInto(out *ConditionList)

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

func (ConditionList) Find

func (conditions ConditionList) Find(conditionType ConditionType) *Condition

func (*ConditionList) Set

func (conditions *ConditionList) Set(conditionType ConditionType, status corev1.ConditionStatus, reason ConditionReason, message string)

type ConditionReason

type ConditionReason string
const (
	NodeNetworkConfigurationEnactmentConditionFailedToConfigure          ConditionReason = "FailedToConfigure"
	NodeNetworkConfigurationEnactmentConditionSuccessfullyConfigured     ConditionReason = "SuccessfullyConfigured"
	NodeNetworkConfigurationEnactmentConditionMaxUnavailableLimitReached ConditionReason = "MaxUnavailableLimitReached"
	NodeNetworkConfigurationEnactmentConditionConfigurationProgressing   ConditionReason = "ConfigurationProgressing"
	NodeNetworkConfigurationEnactmentConditionConfigurationAborted       ConditionReason = "ConfigurationAborted"
)
const (
	NodeNetworkConfigurationPolicyConditionFailedToConfigure           ConditionReason = "FailedToConfigure"
	NodeNetworkConfigurationPolicyConditionSuccessfullyConfigured      ConditionReason = "SuccessfullyConfigured"
	NodeNetworkConfigurationPolicyConditionConfigurationProgressing    ConditionReason = "ConfigurationProgressing"
	NodeNetworkConfigurationPolicyConditionConfigurationNoMatchingNode ConditionReason = "NoMatchingNode"
)
const (
	NodeNetworkStateConditionFailedToConfigure      ConditionReason = "FailedToConfigure"
	NodeNetworkStateConditionSuccessfullyConfigured ConditionReason = "SuccessfullyConfigured"
)

type ConditionType

type ConditionType string
const (
	EnactmentPolicyLabel                                                = "nmstate.io/policy"
	EnactmentNodeLabel                                                  = "nmstate.io/node"
	NodeNetworkConfigurationEnactmentConditionAvailable   ConditionType = "Available"
	NodeNetworkConfigurationEnactmentConditionFailing     ConditionType = "Failing"
	NodeNetworkConfigurationEnactmentConditionPending     ConditionType = "Pending"
	NodeNetworkConfigurationEnactmentConditionProgressing ConditionType = "Progressing"
	NodeNetworkConfigurationEnactmentConditionAborted     ConditionType = "Aborted"
)
const (
	NodeNetworkConfigurationPolicyConditionAvailable   ConditionType = "Available"
	NodeNetworkConfigurationPolicyConditionDegraded    ConditionType = "Degraded"
	NodeNetworkConfigurationPolicyConditionProgressing ConditionType = "Progressing"
)
const (
	NodeNetworkStateConditionAvailable ConditionType = "Available"
	NodeNetworkStateConditionFailing   ConditionType = "Failing"
)

type NodeNetworkConfigurationEnactmentCapturedState

type NodeNetworkConfigurationEnactmentCapturedState struct {
	// +kubebuilder:validation:XPreserveUnknownFields
	State    State                                     `json:"state,omitempty"`
	MetaInfo NodeNetworkConfigurationEnactmentMetaInfo `json:"metaInfo,omitempty"`
}

type NodeNetworkConfigurationEnactmentMetaInfo

type NodeNetworkConfigurationEnactmentMetaInfo struct {
	Version   string      `json:"version,omitempty"`
	TimeStamp metav1.Time `json:"time,omitempty"`
}

type NodeNetworkConfigurationEnactmentStatus

type NodeNetworkConfigurationEnactmentStatus struct {
	// +kubebuilder:validation:XPreserveUnknownFields
	// The desired state rendered for the enactment's node using
	// the policy desiredState as template
	DesiredState State `json:"desiredState,omitempty"`

	DesiredStateMetaInfo NodeNetworkConfigurationEnactmentMetaInfo `json:"desiredStateMetaInfo,omitempty"`

	// A cache containing the resolved captures after processing the capture at NNCP
	CapturedStates map[string]NodeNetworkConfigurationEnactmentCapturedState `json:"capturedStates,omitempty"`

	// The generation from policy needed to check if an enactment
	// condition status belongs to the same policy version
	PolicyGeneration int64 `json:"policyGeneration,omitempty"`

	Conditions ConditionList `json:"conditions,omitempty"`

	Features []string `json:"features,omitempty"`
}

NodeNetworkConfigurationEnactmentStatus defines the observed state of NodeNetworkConfigurationEnactment

func (*NodeNetworkConfigurationEnactmentStatus) DeepCopy

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

func (*NodeNetworkConfigurationEnactmentStatus) DeepCopyInto

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

type NodeNetworkConfigurationPolicySpec

type NodeNetworkConfigurationPolicySpec struct {
	// NodeSelector is a selector which must be true for the policy to be applied to the node.
	// Selector which must match a node's labels for the policy to be scheduled on that node.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	NodeSelector map[string]string `json:"nodeSelector,omitempty"`

	// Capture contains expressions with an associated name than can be referenced
	// at the DesiredState.
	// +optional
	Capture map[string]string `json:"capture,omitempty"`

	// +kubebuilder:validation:XPreserveUnknownFields
	// The desired configuration of the policy
	DesiredState State `json:"desiredState,omitempty"`

	// MaxUnavailable specifies percentage or number
	// of machines that can be updating at a time. Default is "50%".
	// +optional
	MaxUnavailable *intstr.IntOrString `json:"maxUnavailable,omitempty"`
}

NodeNetworkConfigurationPolicySpec defines the desired state of NodeNetworkConfigurationPolicy

func (*NodeNetworkConfigurationPolicySpec) DeepCopy

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

func (*NodeNetworkConfigurationPolicySpec) DeepCopyInto

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

type NodeNetworkConfigurationPolicyStatus

type NodeNetworkConfigurationPolicyStatus struct {
	Conditions ConditionList `json:"conditions,omitempty" optional:"true"`

	// UnavailableNodeCount represents the total number of potentially unavailable nodes that are
	// processing a NodeNetworkConfigurationPolicy
	// +optional
	UnavailableNodeCount int `json:"unavailableNodeCount,omitempty" optional:"true"`
	// LastUnavailableNodeCountUpdate is time of the last UnavailableNodeCount update
	// +optional
	LastUnavailableNodeCountUpdate *metav1.Time `json:"lastUnavailableNodeCountUpdate,omitempty" optional:"true"`
}

NodeNetworkConfigurationPolicyStatus defines the observed state of NodeNetworkConfigurationPolicy

func (*NodeNetworkConfigurationPolicyStatus) DeepCopy

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

func (*NodeNetworkConfigurationPolicyStatus) DeepCopyInto

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

type NodeNetworkStateStatus

type NodeNetworkStateStatus struct {
	// +kubebuilder:validation:XPreserveUnknownFields
	CurrentState                 State       `json:"currentState,omitempty"`
	LastSuccessfulUpdateTime     metav1.Time `json:"lastSuccessfulUpdateTime,omitempty"`
	HostNetworkManagerVersion    string      `json:"hostNetworkManagerVersion,omitempty"`
	HandlerNetworkManagerVersion string      `json:"handlerNetworkManagerVersion,omitempty"`
	HandlerNmstateVersion        string      `json:"handlerNmstateVersion,omitempty"`

	Conditions ConditionList `json:"conditions,omitempty" optional:"true"`
}

NodeNetworkStateStatus is the status of the NodeNetworkState of a specific node

func (*NodeNetworkStateStatus) DeepCopy

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

func (*NodeNetworkStateStatus) DeepCopyInto

func (in *NodeNetworkStateStatus) DeepCopyInto(out *NodeNetworkStateStatus)

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

type RawState

type RawState []byte

func (RawState) DeepCopy

func (in RawState) DeepCopy() RawState

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

func (RawState) DeepCopyInto

func (in RawState) DeepCopyInto(out *RawState)

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

type State

type State struct {
	Raw RawState `json:"-"`
}

State contains the namestatectl yaml [1] as string instead of golang struct so we don't need to be in sync with the schema.

[1] https://github.com/nmstate/nmstate/blob/base/libnmstate/schemas/operational-state.yaml +kubebuilder:validation:Type=object

func NewState

func NewState(raw string) State

func (*State) DeepCopy

func (in *State) DeepCopy() *State

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

func (*State) DeepCopyInto

func (in *State) DeepCopyInto(out *State)

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

func (State) MarshalJSON

func (t State) MarshalJSON() (output []byte, err error)

We are using behind the scenes the golang encode/json so we need to return json here for golang to work well, the upper yaml parser will convert it to yaml making nmstate yaml transparent to kubernetes-nmstate

func (State) String

func (t State) String() string

Simple stringer for State

func (*State) UnmarshalJSON

func (t *State) UnmarshalJSON(b []byte) error

Bypass State parsing and directly store it as yaml string to later on pass it to namestatectl using it as transparet data at kubernetes-nmstate

Jump to

Keyboard shortcuts

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