Documentation ¶
Index ¶
- Constants
- func DisableTxOffload(n *NodeConfig) error
- type Bind
- type CertificateConfig
- type ConfigDispatcher
- type ContainerDetails
- type DNSConfig
- type Endpoint
- type EndpointRaw
- type Extras
- type FailBehaviour
- type GenericFilter
- type GenericPortBinding
- type HostRequirements
- type LabData
- type LicensePolicy
- type Link
- type LinkCommonParams
- type LinkConfig
- type LinkDefinition
- type LinkDefinitionType
- type LinkHostRaw
- type LinkMACVLANRaw
- type LinkMgmtNetRaw
- type LinkVEthRaw
- type MgmtNet
- type NodeConfig
- type NodeDefinition
- func (n *NodeDefinition) GetAutoRemove() *bool
- func (n *NodeDefinition) GetBinds() []string
- func (n *NodeDefinition) GetCertificateConfig() *CertificateConfig
- func (n *NodeDefinition) GetCmd() string
- func (n *NodeDefinition) GetConfigDispatcher() *ConfigDispatcher
- func (n *NodeDefinition) GetDns() *DNSConfig
- func (n *NodeDefinition) GetEnforceStartupConfig() bool
- func (n *NodeDefinition) GetEntrypoint() string
- func (n *NodeDefinition) GetEnv() map[string]string
- func (n *NodeDefinition) GetEnvFiles() []string
- func (n *NodeDefinition) GetExec() []string
- func (n *NodeDefinition) GetExtras() *Extras
- func (n *NodeDefinition) GetGroup() string
- func (n *NodeDefinition) GetImage() string
- func (n *NodeDefinition) GetImagePullPolicy() string
- func (n *NodeDefinition) GetKind() string
- func (n *NodeDefinition) GetLabels() map[string]string
- func (n *NodeDefinition) GetLicense() string
- func (n *NodeDefinition) GetMgmtIPv4() string
- func (n *NodeDefinition) GetMgmtIPv6() string
- func (n *NodeDefinition) GetNetworkMode() string
- func (n *NodeDefinition) GetNodeCPU() float64
- func (n *NodeDefinition) GetNodeCPUSet() string
- func (n *NodeDefinition) GetNodeKernel() string
- func (n *NodeDefinition) GetNodeMemory() string
- func (n *NodeDefinition) GetNodeRuntime() string
- func (n *NodeDefinition) GetNodeSandbox() string
- func (n *NodeDefinition) GetPorts() []string
- func (n *NodeDefinition) GetPostion() string
- func (n *NodeDefinition) GetPublish() []string
- func (n *NodeDefinition) GetSANs() []string
- func (n *NodeDefinition) GetStartupConfig() string
- func (n *NodeDefinition) GetStartupDelay() uint
- func (n *NodeDefinition) GetSysctls() map[string]string
- func (n *NodeDefinition) GetType() string
- func (n *NodeDefinition) GetUser() string
- func (n *NodeDefinition) GetWaitFor() []string
- func (n *NodeDefinition) ImportEnvs()
- func (n *NodeDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
- type PullPolicyValue
- type TopoPaths
- func (t *TopoPaths) AnsibleInventoryFileAbsPath() string
- func (t *TopoPaths) AuthorizedKeysFilename() string
- func (t *TopoPaths) CARootCertDir() string
- func (t *TopoPaths) CaDir() string
- func (t *TopoPaths) ClabTmpDir() string
- func (t *TopoPaths) GraphDir() string
- func (t *TopoPaths) GraphFilename(ext string) string
- func (t *TopoPaths) NodeCertAbsFilename(nodeName string) string
- func (t *TopoPaths) NodeCertCSRAbsFilename(nodeName string) string
- func (t *TopoPaths) NodeCertKeyAbsFilename(nodeName string) string
- func (t *TopoPaths) NodeDir(nodeName string) string
- func (t *TopoPaths) NodeTLSDir(nodename string) string
- func (t *TopoPaths) SetLabDir(topologyName string) (err error)
- func (t *TopoPaths) SetTopologyFilePath(topologyFile string) error
- func (t *TopoPaths) StartupConfigDownloadFileAbsPath(node string, postfix string) string
- func (t *TopoPaths) TLSBaseDir() string
- func (t *TopoPaths) TopoExportFile() string
- func (t *TopoPaths) TopologyBakFileAbsPath() string
- func (t *TopoPaths) TopologyFileDir() string
- func (t *TopoPaths) TopologyFileIsSet() bool
- func (t *TopoPaths) TopologyFilenameAbsPath() string
- func (t *TopoPaths) TopologyFilenameBase() string
- func (t *TopoPaths) TopologyFilenameWithoutExt() string
- func (t *TopoPaths) TopologyLabDir() string
- type Topology
- func (t *Topology) GetCertificateConfig(name string) *CertificateConfig
- func (t *Topology) GetDefaults() *NodeDefinition
- func (t *Topology) GetKind(kind string) *NodeDefinition
- func (t *Topology) GetKinds() map[string]*NodeDefinition
- func (t *Topology) GetNodeAutoRemove(name string) *bool
- func (t *Topology) GetNodeBinds(name string) ([]string, error)
- func (t *Topology) GetNodeCPU(name string) float64
- func (t *Topology) GetNodeCPUSet(name string) string
- func (t *Topology) GetNodeCmd(name string) string
- func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher
- func (t *Topology) GetNodeDns(name string) *DNSConfig
- func (t *Topology) GetNodeEnforceStartupConfig(name string) bool
- func (t *Topology) GetNodeEntrypoint(name string) string
- func (t *Topology) GetNodeEnv(name string) map[string]string
- func (t *Topology) GetNodeEnvFiles(name string) []string
- func (t *Topology) GetNodeExec(name string) []string
- func (t *Topology) GetNodeExtras(name string) *Extras
- func (t *Topology) GetNodeGroup(name string) string
- func (t *Topology) GetNodeImage(name string) string
- func (t *Topology) GetNodeImagePullPolicy(name string) PullPolicyValue
- func (t *Topology) GetNodeKernel(name string) string
- func (t *Topology) GetNodeKind(name string) string
- func (t *Topology) GetNodeLabels(name string) map[string]string
- func (t *Topology) GetNodeLicense(name string) (string, error)
- func (t *Topology) GetNodeMemory(name string) string
- func (t *Topology) GetNodeNetworkMode(name string) string
- func (t *Topology) GetNodePorts(name string) (nat.PortSet, nat.PortMap, error)
- func (t *Topology) GetNodePosition(name string) string
- func (t *Topology) GetNodePublish(name string) []string
- func (t *Topology) GetNodeRuntime(name string) string
- func (t *Topology) GetNodeSandbox(name string) string
- func (t *Topology) GetNodeStartupConfig(name string) (string, error)
- func (t *Topology) GetNodeStartupDelay(name string) uint
- func (t *Topology) GetNodeType(name string) string
- func (t *Topology) GetNodeUser(name string) string
- func (t *Topology) GetSANs(name string) []string
- func (t *Topology) GetSysCtl(name string) map[string]string
- func (t *Topology) GetWaitFor(name string) []string
- func (t *Topology) ImportEnvs()
Constants ¶
const ( // LicensePolicyRequired means a node should exit if no license provided. LicensePolicyRequired = "required" // LicensePolicyWarn means a node should warn (but not exit) if no license provided. LicensePolicyWarn = "warn" // LicensePolicyNone means a node doesn't care about a license. LicensePolicyNone = "none" )
const ( CertFileSuffix = ".pem" KeyFileSuffix = ".key" CSRFileSuffix = ".csr" )
const (
// env var containing the expected number of interfaces injected into every container.
CLAB_ENV_INTFS = "CLAB_INTFS"
)
Variables ¶
This section is empty.
Functions ¶
func DisableTxOffload ¶ added in v0.15.0
func DisableTxOffload(n *NodeConfig) error
Types ¶
type Bind ¶ added in v0.43.0
type Bind struct {
// contains filtered or unexported fields
}
Bind represents a bind mount.
type CertificateConfig ¶ added in v0.39.0
type CertificateConfig struct { // default false value indicates that the node does not use TLS Issue bool `yaml:"issue,omitempty"` }
CertificateConfig represents the configuration of a TLS infrastructure used by a node.
type ConfigDispatcher ¶ added in v0.15.0
type ConfigDispatcher struct {
Vars map[string]interface{} `yaml:"vars,omitempty"`
}
ConfigDispatcher represents the config of a configuration machine that is responsible to execute configuration commands on the nodes after they started.
func (*ConfigDispatcher) GetVars ¶ added in v0.15.0
func (cd *ConfigDispatcher) GetVars() map[string]interface{}
type ContainerDetails ¶ added in v0.25.0
type ContainerDetails struct { LabName string `json:"lab_name,omitempty"` LabPath string `json:"labPath,omitempty"` Name string `json:"name,omitempty"` ContainerID string `json:"container_id,omitempty"` Image string `json:"image,omitempty"` Kind string `json:"kind,omitempty"` Group string `json:"group,omitempty"` State string `json:"state,omitempty"` IPv4Address string `json:"ipv4_address,omitempty"` IPv6Address string `json:"ipv6_address,omitempty"` Ports []*GenericPortBinding `json:"ports,omitempty"` }
ContainerDetails contains information that is commonly outputted to tables or graphs.
type DNSConfig ¶ added in v0.35.0
type DNSConfig struct { // DNS servers Servers []string `yaml:"servers,omitempty"` // DNS options Options []string `yaml:"options,omitempty"` // DNS Search Domains Search []string `yaml:"search,omitempty"` }
DNSConfig represents DNS configuration options a node has.
type Endpoint ¶
type Endpoint struct { Node *NodeConfig // e1-x, eth, etc EndpointName string // mac address MAC string }
Endpoint is a struct that contains information of a link endpoint.
type EndpointRaw ¶ added in v0.43.0
type Extras ¶ added in v0.18.0
type Extras struct { SRLAgents []string `yaml:"srl-agents,omitempty"` // Nokia SR Linux agents. As of now just the agents spec files can be provided here MysocketProxy string `yaml:"mysocket-proxy,omitempty"` // Proxy address that mysocketctl will use CeosCopyToFlash []string `yaml:"ceos-copy-to-flash,omitempty"` }
Extras contains extra node parameters which are not entitled to be part of a generic node config.
type FailBehaviour ¶ added in v0.36.0
type FailBehaviour int
const ( FailBehaviourLog FailBehaviour = iota FailBehaviourError )
type GenericFilter ¶ added in v0.15.0
type GenericFilter struct { // defined by now "label" / "name" [then only Match is required] FilterType string // defines e.g. the label name for FilterType "label" Field string // = | != | exists Operator string // match value Match string }
func FilterFromLabelStrings ¶ added in v0.15.0
func FilterFromLabelStrings(labels []string) []*GenericFilter
FilterFromLabelStrings creates a GenericFilter based on the list of label=value pairs or just label entries. A filter of type `label` is created. For each label=value input label, a filter with the Field matching the label and Match matching the value is created. For each standalone label, a filter with Operator=exists and Field matching the label is created.
type GenericPortBinding ¶ added in v0.43.0
type GenericPortBinding struct { HostIP string `json:"host_ip,omitempty"` HostPort int `json:"host_port,omitempty"` ContainerPort int `json:"port,omitempty"` Protocol string `json:"protocol,omitempty"` }
GenericPortBinding represents a port binding.
func (*GenericPortBinding) String ¶ added in v0.43.0
func (p *GenericPortBinding) String() string
type HostRequirements ¶ added in v0.26.0
type HostRequirements struct { SSSE3 bool `json:"ssse3,omitempty"` // ssse3 cpu instruction // indicates that KVM virtualization is required for this node to run VirtRequired bool `json:"virt-required,omitempty"` // the minimum amount of vcpus this node requires MinVCPU int `json:"min-vcpu,omitempty"` MinVCPUFailAction FailBehaviour `json:"min-vcpu-fail-action,omitempty"` // The minimum amount of memory this node requires MinAvailMemoryGb int `json:"min-free-memory,omitempty"` MinAvailMemoryGbFailAction FailBehaviour `json:"min-free-memory-fail-action,omitempty"` }
func NewHostRequirements ¶ added in v0.36.0
func NewHostRequirements() *HostRequirements
NewHostRequirements is the constructor for new HostRequirements structs.
func (*HostRequirements) Verify ¶ added in v0.34.0
func (h *HostRequirements) Verify(kindName, nodeName string) error
type LabData ¶ added in v0.31.0
type LabData struct {
Containers []ContainerDetails `json:"containers"`
}
type LicensePolicy ¶ added in v0.40.0
type LicensePolicy string
LicensePolicy is a value of LicensePolicy.
type Link ¶
type Link struct { A *Endpoint B *Endpoint MTU int Labels map[string]string Vars map[string]interface{} }
Link is a struct that contains the information of a link between 2 containers.
type LinkCommonParams ¶ added in v0.43.0
type LinkCommonParams struct { Mtu int `yaml:"mtu,omitempty"` Labels map[string]string `yaml:"labels,omitempty"` Vars map[string]interface{} `yaml:"vars,omitempty"` }
LinkCommonParams represents the common parameters for all link types.
type LinkConfig ¶ added in v0.15.0
type LinkDefinition ¶ added in v0.43.0
type LinkDefinition struct { Type string `yaml:"type,omitempty"` LinkConfig `yaml:",inline"` }
LinkDefinition represents a link definition in the topology file.
func (*LinkDefinition) UnmarshalYAML ¶ added in v0.43.0
func (r *LinkDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML deserializes links passed via topology file into LinkDefinition struct. It supports both the brief and specific link type notations.
type LinkDefinitionType ¶ added in v0.43.0
type LinkDefinitionType string
LinkDefinitionType represents the type of a link definition.
const ( LinkTypeVEth LinkDefinitionType = "veth" LinkTypeMgmtNet LinkDefinitionType = "mgmt-net" LinkTypeMacVLan LinkDefinitionType = "macvlan" LinkTypeHost LinkDefinitionType = "host" // LinkTypeBrief is a link definition where link types // are encoded in the endpoint definition as string and allow users // to quickly type out link endpoints in a yaml file. LinkTypeBrief LinkDefinitionType = "brief" )
type LinkHostRaw ¶ added in v0.43.0
type LinkHostRaw struct { LinkCommonParams `yaml:",inline"` HostInterface string `yaml:"host-interface"` Endpoint *EndpointRaw `yaml:"endpoint"` }
LinkHostRaw is the raw (string) representation of a host link as defined in the topology file.
func (*LinkHostRaw) ToLinkConfig ¶ added in v0.43.0
func (r *LinkHostRaw) ToLinkConfig() *LinkConfig
ToLinkConfig converts the raw link into a LinkConfig.
type LinkMACVLANRaw ¶ added in v0.43.0
type LinkMACVLANRaw struct { LinkCommonParams `yaml:",inline"` HostInterface string `yaml:"host-interface"` Endpoint *EndpointRaw `yaml:"endpoint"` }
LinkMACVLANRaw is the raw (string) representation of a macvlan link as defined in the topology file.
func (*LinkMACVLANRaw) ToLinkConfig ¶ added in v0.43.0
func (r *LinkMACVLANRaw) ToLinkConfig() *LinkConfig
ToLinkConfig converts the raw link into a LinkConfig.
type LinkMgmtNetRaw ¶ added in v0.43.0
type LinkMgmtNetRaw struct { LinkCommonParams `yaml:",inline"` HostInterface string `yaml:"host-interface"` Endpoint *EndpointRaw `yaml:"endpoint"` }
func (*LinkMgmtNetRaw) ToLinkConfig ¶ added in v0.43.0
func (r *LinkMgmtNetRaw) ToLinkConfig() *LinkConfig
type LinkVEthRaw ¶ added in v0.43.0
type LinkVEthRaw struct { LinkCommonParams `yaml:",inline"` Endpoints []*EndpointRaw `yaml:"endpoints"` }
LinkVEthRaw is the raw (string) representation of a veth link as defined in the topology file.
func (*LinkVEthRaw) MarshalYAML ¶ added in v0.43.0
func (r *LinkVEthRaw) MarshalYAML() (interface{}, error)
func (*LinkVEthRaw) ToLinkConfig ¶ added in v0.43.0
func (r *LinkVEthRaw) ToLinkConfig() *LinkConfig
ToLinkConfig converts the raw link into a LinkConfig.
type MgmtNet ¶
type MgmtNet struct { Network string `yaml:"network,omitempty" json:"network,omitempty"` // container runtime network name Bridge string `yaml:"bridge,omitempty" json:"bridge,omitempty"` // linux bridge backing the runtime network IPv4Subnet string `yaml:"ipv4-subnet,omitempty" json:"ipv4-subnet,omitempty"` IPv4Gw string `yaml:"ipv4-gw,omitempty" json:"ipv4-gw,omitempty"` IPv4Range string `yaml:"ipv4-range,omitempty" json:"ipv4-range,omitempty"` IPv6Subnet string `yaml:"ipv6-subnet,omitempty" json:"ipv6-subnet,omitempty"` IPv6Gw string `yaml:"ipv6-gw,omitempty" json:"ipv6-gw,omitempty"` IPv6Range string `yaml:"ipv6-range,omitempty" json:"ipv6-range,omitempty"` MTU string `yaml:"mtu,omitempty" json:"mtu,omitempty"` ExternalAccess *bool `yaml:"external-access,omitempty" json:"external-access,omitempty"` }
MgmtNet struct defines the management network options.
func (*MgmtNet) UnmarshalYAML ¶ added in v0.41.1
UnmarshalYAML is a custom unmarshaller for MgmtNet that allows to map old attributes to new ones.
type NodeConfig ¶ added in v0.15.0
type NodeConfig struct { // name of the Node inside topology YAML ShortName string `json:"shortname,omitempty"` // containerlab-prefixed unique container name LongName string `json:"longname,omitempty"` Fqdn string `json:"fqdn,omitempty"` // LabDir is a directory related to the node, it contains config items and/or other persistent state LabDir string `json:"labdir,omitempty"` Index int `json:"index,omitempty"` Group string `json:"group,omitempty"` Kind string `json:"kind,omitempty"` // path to config template file that is used for startup config generation StartupConfig string `json:"startup-config,omitempty"` // optional delay (in seconds) to wait before creating this node StartupDelay uint `json:"startup-delay,omitempty"` // when set to true will enforce the use of startup-config, even when config is present in the lab directory EnforceStartupConfig bool `json:"enforce-startup-config,omitempty"` // when set to true will auto-remove a stopped/failed container AutoRemove *bool `json:"auto-remove,omitempty"` // path to config file that is actually mounted to the container and is a result of templation ResStartupConfig string `json:"startup-config-abs-path,omitempty"` Config *ConfigDispatcher `json:"config,omitempty"` // path to config file that is actually mounted to the container and is a result of templation ResConfig string `json:"config-abs-path,omitempty"` NodeType string `json:"type,omitempty"` Position string `json:"position,omitempty"` License string `json:"license,omitempty"` Image string `json:"image,omitempty"` ImagePullPolicy PullPolicyValue `json:"image-pull-policy,omitempty"` Sysctls map[string]string `json:"sysctls,omitempty"` User string `json:"user,omitempty"` Entrypoint string `json:"entrypoint,omitempty"` Cmd string `json:"cmd,omitempty"` // Exec is a list of commands to execute inside the container backing the node. Exec []string `json:"exec,omitempty"` Env map[string]string `json:"env,omitempty"` // Bind mounts strings (src:dest:options). Binds []string `json:"binds,omitempty"` // PortBindings define the bindings between the container ports and host ports PortBindings nat.PortMap `json:"portbindings,omitempty"` // ResultingPortBindings is a list of port bindings that are actually applied to the container ResultingPortBindings []*GenericPortBinding `json:"port-bindings,omitempty"` // PortSet define the ports that should be exposed on a container PortSet nat.PortSet `json:"portset,omitempty"` // NetworkMode defines container networking mode. // If set to `host` the host networking will be used for this node, else bridged network NetworkMode string `json:"networkmode,omitempty"` // MgmtNet is the name of the docker network this node is connected to with its first interface MgmtNet string `json:"mgmt-net,omitempty"` // MgmtIntf can be used to be rendered by the default node template MgmtIntf string `json:"mgmt-intf,omitempty"` MgmtIPv4Address string `json:"mgmt-ipv4-address,omitempty"` MgmtIPv4PrefixLength int `json:"mgmt-ipv4-prefix-length,omitempty"` MgmtIPv6Address string `json:"mgmt-ipv6-address,omitempty"` MgmtIPv6PrefixLength int `json:"mgmt-ipv6-prefix-length,omitempty"` MgmtIPv4Gateway string `json:"mgmt-ipv4-gateway,omitempty"` MgmtIPv6Gateway string `json:"mgmt-ipv6-gateway,omitempty"` MacAddress string `json:"mac-address,omitempty"` ContainerID string `json:"containerid,omitempty"` TLSCert string `json:"tls-cert,omitempty"` TLSKey string `json:"-"` // Do not marshal into JSON - highly sensitive data TLSAnchor string `json:"tls-anchor,omitempty"` // TLS Certificate configuration Certificate *CertificateConfig NSPath string `json:"nspath,omitempty"` // network namespace path for this node // list of ports to publish with mysocketctl Publish []string `json:"publish,omitempty"` // Extra /etc/hosts entries for all nodes. ExtraHosts []string `json:"extra-hosts,omitempty"` Labels map[string]string `json:"labels,omitempty"` // container labels // Slice of pointers to local endpoints, DO NOT marshal into JSON as it creates a cyclical error Endpoints []Endpoint `json:"-"` // List of Subject Alternative Names (SAN) to be added to the node's TLS certificate SANs []string `json:"SANs,omitempty"` // Ignite sandbox and kernel imageNames Sandbox string `json:"sandbox,omitempty"` Kernel string `json:"kernel,omitempty"` // Configured container runtime Runtime string `json:"runtime,omitempty"` // Resource limits CPU float64 `json:"cpu,omitempty"` CPUSet string `json:"cpuset,omitempty"` Memory string `json:"memory,omitempty"` // Extra node parameters Extras *Extras `json:"extras,omitempty"` WaitFor []string `json:"wait-for,omitempty"` DNS *DNSConfig `json:"dns,omitempty"` IsRootNamespaceBased bool }
NodeConfig is a struct that contains the information of a container element.
type NodeDefinition ¶ added in v0.15.0
type NodeDefinition struct { Kind string `yaml:"kind,omitempty"` Group string `yaml:"group,omitempty"` Type string `yaml:"type,omitempty"` StartupConfig string `yaml:"startup-config,omitempty"` StartupDelay uint `yaml:"startup-delay,omitempty"` EnforceStartupConfig bool `yaml:"enforce-startup-config,omitempty"` AutoRemove *bool `yaml:"auto-remove,omitempty"` Config *ConfigDispatcher `yaml:"config,omitempty"` Image string `yaml:"image,omitempty"` ImagePullPolicy string `yaml:"image-pull-policy,omitempty"` License string `yaml:"license,omitempty"` Position string `yaml:"position,omitempty"` Entrypoint string `yaml:"entrypoint,omitempty"` Cmd string `yaml:"cmd,omitempty"` // list of subject Alternative Names (SAN) to be added to the node's certificate SANs []string `yaml:"SANs,omitempty"` // list of commands to run in container Exec []string `yaml:"exec,omitempty"` // list of bind mount compatible strings Binds []string `yaml:"binds,omitempty"` // list of port bindings Ports []string `yaml:"ports,omitempty"` // user-defined IPv4 address in the management network MgmtIPv4 string `yaml:"mgmt-ipv4,omitempty"` // user-defined IPv6 address in the management network MgmtIPv6 string `yaml:"mgmt-ipv6,omitempty"` // list of ports to publish with mysocketctl Publish []string `yaml:"publish,omitempty"` // environment variables Env map[string]string `yaml:"env,omitempty"` // external file containing environment variables EnvFiles []string `yaml:"env-files,omitempty"` // linux user used in a container User string `yaml:"user,omitempty"` // container labels Labels map[string]string `yaml:"labels,omitempty"` // container networking mode. if set to `host` the host networking will be used for this node, else bridged network NetworkMode string `yaml:"network-mode,omitempty"` // Ignite sandbox and kernel imageNames Sandbox string `yaml:"sandbox,omitempty"` Kernel string `yaml:"kernel,omitempty"` // Override container runtime Runtime string `yaml:"runtime,omitempty"` // Set node CPU (cgroup or hypervisor) CPU float64 `yaml:"cpu,omitempty"` // Set node CPUs to use CPUSet string `yaml:"cpu-set,omitempty"` // Set node Memory (cgroup or hypervisor) Memory string `yaml:"memory,omitempty"` // Set the nodes Sysctl Sysctls map[string]string `yaml:"sysctls,omitempty"` // Extra options, may be kind specific Extras *Extras `yaml:"extras,omitempty"` // List of node names to wait for before satarting this particular node WaitFor []string `yaml:"wait-for,omitempty"` // DNS configuration DNS *DNSConfig `yaml:"dns,omitempty"` // Certificate Configuration Certificate *CertificateConfig `yaml:"certificate,omitempty"` }
NodeDefinition represents a configuration a given node can have in the lab definition file.
func (*NodeDefinition) GetAutoRemove ¶ added in v0.32.2
func (n *NodeDefinition) GetAutoRemove() *bool
func (*NodeDefinition) GetBinds ¶ added in v0.15.0
func (n *NodeDefinition) GetBinds() []string
func (*NodeDefinition) GetCertificateConfig ¶ added in v0.39.0
func (n *NodeDefinition) GetCertificateConfig() *CertificateConfig
func (*NodeDefinition) GetCmd ¶ added in v0.15.0
func (n *NodeDefinition) GetCmd() string
func (*NodeDefinition) GetConfigDispatcher ¶ added in v0.15.0
func (n *NodeDefinition) GetConfigDispatcher() *ConfigDispatcher
func (*NodeDefinition) GetDns ¶ added in v0.35.0
func (n *NodeDefinition) GetDns() *DNSConfig
func (*NodeDefinition) GetEnforceStartupConfig ¶ added in v0.17.0
func (n *NodeDefinition) GetEnforceStartupConfig() bool
func (*NodeDefinition) GetEntrypoint ¶ added in v0.18.0
func (n *NodeDefinition) GetEntrypoint() string
func (*NodeDefinition) GetEnv ¶ added in v0.15.0
func (n *NodeDefinition) GetEnv() map[string]string
func (*NodeDefinition) GetEnvFiles ¶ added in v0.26.0
func (n *NodeDefinition) GetEnvFiles() []string
func (*NodeDefinition) GetExec ¶ added in v0.18.0
func (n *NodeDefinition) GetExec() []string
func (*NodeDefinition) GetExtras ¶ added in v0.18.0
func (n *NodeDefinition) GetExtras() *Extras
func (*NodeDefinition) GetGroup ¶ added in v0.15.0
func (n *NodeDefinition) GetGroup() string
func (*NodeDefinition) GetImage ¶ added in v0.15.0
func (n *NodeDefinition) GetImage() string
func (*NodeDefinition) GetImagePullPolicy ¶ added in v0.36.0
func (n *NodeDefinition) GetImagePullPolicy() string
func (*NodeDefinition) GetKind ¶ added in v0.15.0
func (n *NodeDefinition) GetKind() string
func (*NodeDefinition) GetLabels ¶ added in v0.15.0
func (n *NodeDefinition) GetLabels() map[string]string
func (*NodeDefinition) GetLicense ¶ added in v0.15.0
func (n *NodeDefinition) GetLicense() string
func (*NodeDefinition) GetMgmtIPv4 ¶ added in v0.15.0
func (n *NodeDefinition) GetMgmtIPv4() string
func (*NodeDefinition) GetMgmtIPv6 ¶ added in v0.15.0
func (n *NodeDefinition) GetMgmtIPv6() string
func (*NodeDefinition) GetNetworkMode ¶ added in v0.15.0
func (n *NodeDefinition) GetNetworkMode() string
func (*NodeDefinition) GetNodeCPU ¶ added in v0.16.2
func (n *NodeDefinition) GetNodeCPU() float64
func (*NodeDefinition) GetNodeCPUSet ¶ added in v0.20.0
func (n *NodeDefinition) GetNodeCPUSet() string
func (*NodeDefinition) GetNodeKernel ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeKernel() string
func (*NodeDefinition) GetNodeMemory ¶ added in v0.20.0
func (n *NodeDefinition) GetNodeMemory() string
func (*NodeDefinition) GetNodeRuntime ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeRuntime() string
func (*NodeDefinition) GetNodeSandbox ¶ added in v0.15.0
func (n *NodeDefinition) GetNodeSandbox() string
func (*NodeDefinition) GetPorts ¶ added in v0.15.0
func (n *NodeDefinition) GetPorts() []string
func (*NodeDefinition) GetPostion ¶ added in v0.15.0
func (n *NodeDefinition) GetPostion() string
func (*NodeDefinition) GetPublish ¶ added in v0.15.0
func (n *NodeDefinition) GetPublish() []string
func (*NodeDefinition) GetSANs ¶ added in v0.31.0
func (n *NodeDefinition) GetSANs() []string
func (*NodeDefinition) GetStartupConfig ¶ added in v0.15.0
func (n *NodeDefinition) GetStartupConfig() string
func (*NodeDefinition) GetStartupDelay ¶ added in v0.17.0
func (n *NodeDefinition) GetStartupDelay() uint
func (*NodeDefinition) GetSysctls ¶ added in v0.26.0
func (n *NodeDefinition) GetSysctls() map[string]string
func (*NodeDefinition) GetType ¶ added in v0.15.0
func (n *NodeDefinition) GetType() string
func (*NodeDefinition) GetUser ¶ added in v0.15.0
func (n *NodeDefinition) GetUser() string
func (*NodeDefinition) GetWaitFor ¶ added in v0.32.0
func (n *NodeDefinition) GetWaitFor() []string
func (*NodeDefinition) ImportEnvs ¶ added in v0.17.0
func (n *NodeDefinition) ImportEnvs()
ImportEnvs imports all environment variales defined in the shell if __IMPORT_ENVS is set to true.
func (*NodeDefinition) UnmarshalYAML ¶ added in v0.41.1
func (n *NodeDefinition) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML is a custom unmarshaller for NodeDefinition type that allows to map old attributes to new ones.
type PullPolicyValue ¶ added in v0.36.0
type PullPolicyValue string
PullPolicyValue represents Image pull policy values.
const ( PullPolicyAlways PullPolicyValue = "Always" PullPolicyNever PullPolicyValue = "Never" PullPolicyIfNotPresent PullPolicyValue = "IfNotPresent" )
func ParsePullPolicyValue ¶ added in v0.36.0
func ParsePullPolicyValue(s string) PullPolicyValue
ParsePullPolicyValue parses the given string and tries to map it to a valid PullPolicyValue. Defaults to PullPolicyIfNotPresent.
type TopoPaths ¶ added in v0.37.0
type TopoPaths struct {
// contains filtered or unexported fields
}
TopoPaths creates all the required absolute paths and filenames for a topology. generally all these paths are deduced from two main paths. The topology file path and the lab dir path.
func NewCaTopoPaths ¶ added in v0.37.0
func NewTopoPaths ¶ added in v0.37.0
NewTopoPaths constructs a new TopoPaths instance.
func (*TopoPaths) AnsibleInventoryFileAbsPath ¶ added in v0.37.0
AnsibleInventoryFileAbsPath returns the absolute path to the ansible-inventory file.
func (*TopoPaths) AuthorizedKeysFilename ¶ added in v0.37.0
AuthorizedKeysFilename returns the path for the generated AuthorizedKeysFile.
func (*TopoPaths) CARootCertDir ¶ added in v0.37.0
CARootCertDir returns the directory that contains the root CA certificat and key.
func (*TopoPaths) CaDir ¶ added in v0.37.0
CaDir returns the dir name of the CA directory structure.
func (*TopoPaths) ClabTmpDir ¶ added in v0.38.0
ClabTmpDir returns the path to the temporary directory where clab stores temporary and/or downloaded files.
func (*TopoPaths) GraphFilename ¶ added in v0.37.0
GraphFilename returns the filename for a given graph file with the provided extension.
func (*TopoPaths) NodeCertAbsFilename ¶ added in v0.37.0
NodeCertAbsFilename returns the path to a cert file for the given identifier.
func (*TopoPaths) NodeCertCSRAbsFilename ¶ added in v0.37.0
NodeCertCSRAbsFilename returns the path to a csr file for the given identifier.
func (*TopoPaths) NodeCertKeyAbsFilename ¶ added in v0.37.0
NodeCertKeyAbsFilename returns the path to a key file for the given identifier.
func (*TopoPaths) NodeDir ¶ added in v0.37.0
NodeDir returns the directory in the labDir for the provided node.
func (*TopoPaths) NodeTLSDir ¶ added in v0.37.0
NodeTLSDir returns the directory that contains the certificat data for the given node.
func (*TopoPaths) SetTopologyFilePath ¶ added in v0.37.0
SetTopologyFilePath sets the topology file path.
func (*TopoPaths) StartupConfigDownloadFileAbsPath ¶ added in v0.38.0
StartupConfigDownloadFileAbsPath returns the absolute path to the startup-config file when it is downloaded from a remote location to the clab temp directory.
func (*TopoPaths) TLSBaseDir ¶ added in v0.37.0
TLSBaseDir returns the path of the TLS directory structure.
func (*TopoPaths) TopoExportFile ¶ added in v0.37.0
TopoExportFile returns the path for the topology-export file.
func (*TopoPaths) TopologyBakFileAbsPath ¶ added in v0.37.0
TopologyBakFileAbsPath returns the backup topology file name.
func (*TopoPaths) TopologyFileDir ¶ added in v0.37.0
TopologyFileDir returns the abs path to the topology file directory.
func (*TopoPaths) TopologyFileIsSet ¶ added in v0.37.0
func (*TopoPaths) TopologyFilenameAbsPath ¶ added in v0.37.0
TopologyFilenameAbsPath returns the absolute path to the topology file.
func (*TopoPaths) TopologyFilenameBase ¶ added in v0.37.0
TopologyFilenameBase returns the full filename of the topology file without any additional paths.
func (*TopoPaths) TopologyFilenameWithoutExt ¶ added in v0.37.0
TopologyFilenameWithoutExt returns the topology file name without the file extension.
func (*TopoPaths) TopologyLabDir ¶ added in v0.37.0
TopologyLabDir returns the lab directory.
type Topology ¶ added in v0.15.0
type Topology struct { Defaults *NodeDefinition `yaml:"defaults,omitempty"` Kinds map[string]*NodeDefinition `yaml:"kinds,omitempty"` Nodes map[string]*NodeDefinition `yaml:"nodes,omitempty"` Links []*LinkDefinition `yaml:"links,omitempty"` }
Topology represents a lab topology.
func NewTopology ¶ added in v0.15.0
func NewTopology() *Topology
func (*Topology) GetCertificateConfig ¶ added in v0.39.0
func (t *Topology) GetCertificateConfig(name string) *CertificateConfig
func (*Topology) GetDefaults ¶ added in v0.15.0
func (t *Topology) GetDefaults() *NodeDefinition
func (*Topology) GetKind ¶ added in v0.15.0
func (t *Topology) GetKind(kind string) *NodeDefinition
func (*Topology) GetKinds ¶ added in v0.15.0
func (t *Topology) GetKinds() map[string]*NodeDefinition
func (*Topology) GetNodeAutoRemove ¶ added in v0.32.2
func (*Topology) GetNodeBinds ¶ added in v0.15.0
func (*Topology) GetNodeCPU ¶ added in v0.16.2
func (*Topology) GetNodeCPUSet ¶ added in v0.20.0
func (*Topology) GetNodeCmd ¶ added in v0.15.0
func (*Topology) GetNodeConfigDispatcher ¶ added in v0.15.0
func (t *Topology) GetNodeConfigDispatcher(name string) *ConfigDispatcher
func (*Topology) GetNodeDns ¶ added in v0.35.0
func (*Topology) GetNodeEnforceStartupConfig ¶ added in v0.17.0
func (*Topology) GetNodeEntrypoint ¶ added in v0.18.0
func (*Topology) GetNodeEnv ¶ added in v0.15.0
func (*Topology) GetNodeEnvFiles ¶ added in v0.26.0
func (*Topology) GetNodeExec ¶ added in v0.18.0
func (*Topology) GetNodeExtras ¶ added in v0.18.0
GetNodeExtras returns the 'extras' section for the given node.
func (*Topology) GetNodeGroup ¶ added in v0.15.0
func (*Topology) GetNodeImage ¶ added in v0.15.0
func (*Topology) GetNodeImagePullPolicy ¶ added in v0.36.0
func (t *Topology) GetNodeImagePullPolicy(name string) PullPolicyValue
func (*Topology) GetNodeKernel ¶ added in v0.15.0
func (*Topology) GetNodeKind ¶ added in v0.15.0
func (*Topology) GetNodeLabels ¶ added in v0.15.0
func (*Topology) GetNodeLicense ¶ added in v0.15.0
func (*Topology) GetNodeMemory ¶ added in v0.20.0
func (*Topology) GetNodeNetworkMode ¶ added in v0.15.0
func (*Topology) GetNodePorts ¶ added in v0.15.0
func (*Topology) GetNodePosition ¶ added in v0.15.0
func (*Topology) GetNodePublish ¶ added in v0.15.0
func (*Topology) GetNodeRuntime ¶ added in v0.15.0
func (*Topology) GetNodeSandbox ¶ added in v0.15.0
func (*Topology) GetNodeStartupConfig ¶ added in v0.15.0
func (*Topology) GetNodeStartupDelay ¶ added in v0.17.0
func (*Topology) GetNodeType ¶ added in v0.15.0
func (*Topology) GetNodeUser ¶ added in v0.15.0
func (*Topology) GetSANs ¶ added in v0.31.0
GetSANs return the Subject Alternative Name configuration for the given node.
func (*Topology) GetSysCtl ¶ added in v0.26.0
GetSysCtl return the Sysctl configuration for the given node.
func (*Topology) GetWaitFor ¶ added in v0.32.0
GetWaitFor return the wait-for configuration for the given node.
func (*Topology) ImportEnvs ¶ added in v0.17.0
func (t *Topology) ImportEnvs()