shared

package
v0.0.0-...-7373c75 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: Apache-2.0 Imports: 7 Imported by: 7 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	NmstateConditionAvailable   ConditionType = "Available"
	NmstateConditionDegraded    ConditionType = "Degraded"
	NmstateConditionProgressing ConditionType = "Progressing"

	NmstateInternalError             ConditionReason = "InternalError"
	NmstateDeploying                 ConditionReason = "Deploying"
	NmstateSuccessfullyDeployed      ConditionReason = "SuccessfullyDeployed"
	NmstateTLSProfileNotFullyHonored ConditionReason = "TLSProfileNotFullyHonored"
)

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"
	NodeNetworkConfigurationEnactmentConditionRetrying                   ConditionReason = "Retrying"
	NodeNetworkConfigurationEnactmentConditionSuccessfullyConfigured     ConditionReason = "SuccessfullyConfigured"
	NodeNetworkConfigurationEnactmentConditionMaxUnavailableLimitReached ConditionReason = "MaxUnavailableLimitReached"
	NodeNetworkConfigurationEnactmentConditionConfigurationProgressing   ConditionReason = "ConfigurationProgressing"
	NodeNetworkConfigurationEnactmentConditionConfigurationAborted       ConditionReason = "ConfigurationAborted"
	NodeNetworkConfigurationEnactmentConditionConfigurationInterrupted   ConditionReason = "ConfigurationInterrupted"
	// NodeNetworkConfigurationEnactmentConditionConfigurationFinalizing marks the
	// post-apply phase: the desired state was applied and only releasing the
	// maxUnavailable slot and recording success remain. A reconcile that finds
	// the enactment in this phase must not re-apply the (already committed)
	// configuration.
	NodeNetworkConfigurationEnactmentConditionConfigurationFinalizing ConditionReason = "ConfigurationFinalizing"
)
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"
	NodeNetworkConfigurationPolicyConditionIgnored     ConditionType = "Ignored"
)
const (
	NodeNetworkStateConditionAvailable ConditionType = "Available"
	NodeNetworkStateConditionFailing   ConditionType = "Failing"
)

type LogLevel

type LogLevel string

LogLevel defines the log level for nmstate operations

const (
	// LogLevelInfo indicates info log level (default, minimal output)
	LogLevelInfo LogLevel = "info"
	// LogLevelDebug indicates debug log level (verbose output for debugging)
	LogLevelDebug LogLevel = "debug"
)

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"`

	RetryCount map[string]int `json:"retryCount,omitempty" optional:"true"`
}

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 that determines which nodes the policy will be applied to.
	// It uses simple key-value label matching (equality-based selection only). All specified
	// labels must match a node's labels for the policy to be scheduled on that node.
	// Note: matchLabels and matchExpressions are not supported; only direct key-value pair matching is available.
	// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
	// +optional
	// +kubebuilder:validation:MaxProperties=256
	//nolint:lll
	// +kubebuilder:validation:XValidation:rule="self.all(k, !format.qualifiedName().validate(k).hasValue())",message="nodeSelector keys must be valid qualified names"
	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%".
	// Must be greater than 0. When set as a percentage, it must be between 1% and 100%.
	// +optional
	//nolint:lll
	// +kubebuilder:validation:XValidation:rule="(type(self) == int && self > 0) || (type(self) == string && self.matches('^([1-9][0-9]*|([1-9]|[1-9][0-9]|100)%)$'))",message="maxUnavailable must be a positive integer or a percentage between 1% and 100%"
	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"`
	// UnavailableNodeCountMap represents the total number of potentially unavailable nodes that are
	// processing a NodeNetworkConfigurationPolicy per Generation (Map Key)
	// +optional
	UnavailableNodeCountMap map[string]int `json:"unavailableNodeCountMap,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