nmstate

package
v0.0.0-...-091666d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanAllNMStatePolicies

func CleanAllNMStatePolicies(apiClient *clients.Settings, options ...goclient.ListOptions) error

CleanAllNMStatePolicies removes all NodeNetworkConfigurationPolicies.

Types

type AdditionalOptions

type AdditionalOptions func(builder *PolicyBuilder) (*PolicyBuilder, error)

AdditionalOptions additional options for pod object.

type Bridge

type Bridge struct {
	Port []map[string]string `yaml:"port,omitempty"`
}

Bridge provides struct for the NMState Interface Ethernet Bridge state object containing interface Bridge information.

type Builder

type Builder struct {
	// NMState definition. Used to create NMState object with minimum set of required elements.
	Definition *nmstateV1.NMState
	// Created NMState object on the cluster.
	Object *nmstateV1.NMState
	// contains filtered or unexported fields
}

Builder provides struct for the NMState object containing connection to the cluster and the NMState definitions.

func NewBuilder

func NewBuilder(apiClient *clients.Settings, name string) *Builder

NewBuilder creates a new instance of nmstate Builder.

func PullNMstate

func PullNMstate(apiClient *clients.Settings, name string) (*Builder, error)

PullNMstate retrieves an existing NMState object from the cluster.

func (*Builder) Create

func (builder *Builder) Create() (*Builder, error)

Create makes a NMState in the cluster and stores the created object in struct.

func (*Builder) Delete

func (builder *Builder) Delete() (*Builder, error)

Delete removes NMState object from a cluster.

func (*Builder) Exists

func (builder *Builder) Exists() bool

Exists checks whether the given NMState exists.

func (*Builder) Get

func (builder *Builder) Get() (*nmstateV1.NMState, error)

Get returns NMState object if found.

func (*Builder) Update

func (builder *Builder) Update(force bool) (*Builder, error)

Update renovates the existing NMState object with the NMState definition in builder.

type DesiredState

type DesiredState struct {
	Interfaces []NetworkInterface `yaml:"interfaces,omitempty"`
}

DesiredState provides struct for the NMState desired state object containing all NMState configuration.

type Ethernet

type Ethernet struct {
	Sriov Sriov `yaml:"sr-iov,omitempty"`
}

Ethernet provides struct for the NMState Interface Ethernet state object containing interface Ethernet information.

type LinkAggregation

type LinkAggregation struct {
	Mode    string                 `yaml:"mode"`
	Options OptionsLinkAggregation `yaml:"options,omitempty"`
	Port    []string               `yaml:"port,omitempty"`
}

LinkAggregation provides struct for the NMState Interface Ethernet LinkAggregation state object containing interface LinkAggregation information.

type NetworkInterface

type NetworkInterface struct {
	Name            string          `yaml:"name"`
	Type            string          `yaml:"type"`
	State           string          `yaml:"state"`
	Ethernet        Ethernet        `yaml:"ethernet,omitempty"`
	Bridge          Bridge          `yaml:"bridge,omitempty"`
	LinkAggregation LinkAggregation `yaml:"link-aggregation,omitempty"`
	Vlan            Vlan            `yaml:"vlan,omitempty"`
}

NetworkInterface provides struct for the NMState interface state object containing interface information.

type OptionsLinkAggregation

type OptionsLinkAggregation struct {
	Primary     string `yaml:"primary,omitempty"`
	Miimon      int    `yaml:"miimon,omitempty"`
	FailOverMac string `yaml:"fail_over_mac,omitempty"`
}

OptionsLinkAggregation provides struct for the NMState Interface Ethernet LinkAggregation Options state object containing interface LinkAggregation Options information.

type PolicyBuilder

type PolicyBuilder struct {
	// srIovPolicy definition. Used to create srIovPolicy object.
	Definition *nmstateV1.NodeNetworkConfigurationPolicy
	// Created srIovPolicy object
	Object *nmstateV1.NodeNetworkConfigurationPolicy
	// contains filtered or unexported fields
}

PolicyBuilder provides struct for the NodeNetworkConfigurationPolicy object containing connection to the cluster and the NodeNetworkConfigurationPolicy definition.

func ListPolicy

func ListPolicy(apiClient *clients.Settings, options ...goclient.ListOptions) ([]*PolicyBuilder, error)

ListPolicy returns a list of NodeNetworkConfigurationPolicy.

func NewPolicyBuilder

func NewPolicyBuilder(apiClient *clients.Settings, name string, nodeSelector map[string]string) *PolicyBuilder

NewPolicyBuilder creates a new instance of PolicyBuilder.

func (*PolicyBuilder) Create

func (builder *PolicyBuilder) Create() (*PolicyBuilder, error)

Create makes a NodeNetworkConfigurationPolicy in the cluster and stores the created object in struct.

func (*PolicyBuilder) Delete

func (builder *PolicyBuilder) Delete() (*PolicyBuilder, error)

Delete removes NodeNetworkConfigurationPolicy object from a cluster.

func (*PolicyBuilder) Exists

func (builder *PolicyBuilder) Exists() bool

Exists checks whether the given NodeNetworkConfigurationPolicy exists.

func (*PolicyBuilder) Get

Get returns NodeNetworkConfigurationPolicy object if found.

func (*PolicyBuilder) Update

func (builder *PolicyBuilder) Update(force bool) (*PolicyBuilder, error)

Update renovates the existing NodeNetworkConfigurationPolicy object with the NodeNetworkConfigurationPolicy definition in builder.

func (*PolicyBuilder) WaitUntilCondition

func (builder *PolicyBuilder) WaitUntilCondition(condition nmstateShared.ConditionType, timeout time.Duration) error

WaitUntilCondition waits for the duration of the defined timeout or until the NodeNetworkConfigurationPolicy gets to a specific condition.

func (*PolicyBuilder) WithAbsentInterface

func (builder *PolicyBuilder) WithAbsentInterface(interfaceName string) *PolicyBuilder

WithAbsentInterface appends the configuration for an absent interface to the NodeNetworkConfigurationPolicy.

func (*PolicyBuilder) WithBondInterface

func (builder *PolicyBuilder) WithBondInterface(slavePorts []string, bondName, mode string) *PolicyBuilder

WithBondInterface adds Bond interface configuration to the NodeNetworkConfigurationPolicy.

func (*PolicyBuilder) WithInterfaceAndVFs

func (builder *PolicyBuilder) WithInterfaceAndVFs(sriovInterface string, numberOfVF uint8) *PolicyBuilder

WithInterfaceAndVFs adds SR-IOV VF configuration to the NodeNetworkConfigurationPolicy.

func (*PolicyBuilder) WithOptions

func (builder *PolicyBuilder) WithOptions(options ...AdditionalOptions) *PolicyBuilder

WithOptions creates pod with generic mutation options.

func (*PolicyBuilder) WithVlanInterface

func (builder *PolicyBuilder) WithVlanInterface(baseInterface string, vlanID uint16) *PolicyBuilder

WithVlanInterface adds VLAN interface configuration to the NodeNetworkConfigurationPolicy.

type Sriov

type Sriov struct {
	TotalVfs *int `yaml:"total-vfs,omitempty"`
	Vfs      []Vf `yaml:"vfs,omitempty"`
}

Sriov provides struct for the NMState Interface Ethernet Sriov state object containing interface Ethernet Sriov information.

type StateBuilder

type StateBuilder struct {
	// Created NodeNetworkState object on the cluster.
	Object *nmstateV1alpha1.NodeNetworkState
	// contains filtered or unexported fields
}

StateBuilder provides struct for the NodeNetworkState object containing connection to the cluster.

func PullNodeNetworkState

func PullNodeNetworkState(apiClient *clients.Settings, name string) (*StateBuilder, error)

PullNodeNetworkState retrieves an existing NodeNetworkState object from the cluster.

func (*StateBuilder) Exists

func (builder *StateBuilder) Exists() bool

Exists checks whether the given NodeNetworkState exists.

func (*StateBuilder) Get

Get returns NodeNetworkState object if found.

func (*StateBuilder) GetInterfaceType

func (builder *StateBuilder) GetInterfaceType(interfaceName, interfaceType string) (NetworkInterface, error)

GetInterfaceType returns Interface with the given interface name and given type.

func (*StateBuilder) GetSriovVfs

func (builder *StateBuilder) GetSriovVfs(sriovInterfaceName string) ([]Vf, error)

GetSriovVfs returns all configured VFs under the given SR-IOV interface.

func (*StateBuilder) GetTotalVFs

func (builder *StateBuilder) GetTotalVFs(sriovInterfaceName string) (int, error)

GetTotalVFs returns total-vfs under the given interface.

type Vf

type Vf struct {
	ID         int    `yaml:"id"`
	MacAddress string `yaml:"mac-address,omitempty"`
	MaxTxRate  *int   `yaml:"max-tx-rate,omitempty"`
	MinTxRate  *int   `yaml:"min-tx-rate,omitempty"`
	Qos        *int   `yaml:"qos,omitempty"`
	SpoofCheck *bool  `yaml:"spoof-check,omitempty"`
	Trust      *bool  `yaml:"trust,omitempty"`
	VlanID     *int   `yaml:"vlan-id,omitempty"`
}

Vf provides struct for the NMState SR-IOV VF state object containing SR-IOV VF information.

type Vlan

type Vlan struct {
	BaseIface string `yaml:"base-iface"`
	ID        int    `yaml:"id"`
}

Vlan provides struct for the NMState Interface Ethernet Vlan Options state object containing interface Vlan information.

Jump to

Keyboard shortcuts

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