{"modulePath":"github.com/cloudweav/cloudweav-network-controller","version":"v0.5.5","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package utils\n\n## Constants\n\n```go\nconst (\n\tKeyVlanLabel = network.GroupName + \"/vlan-id\"\n\t// KeyLastVlanLabel is used to record the last VLAN id to support changing the VLAN id of the VLAN networks\n\tKeyLastVlanLabel       = network.GroupName + \"/last-vlan-id\"\n\tKeyVlanConfigLabel     = network.GroupName + \"/vlanconfig\"\n\tKeyClusterNetworkLabel = network.GroupName + \"/clusternetwork\"\n\t// KeyLastClusterNetworkLabel is used to record the last cluster network to support changing the cluster network of NADs\n\tKeyLastClusterNetworkLabel = network.GroupName + \"/last-clusternetwork\"\n\tKeyNodeLabel               = network.GroupName + \"/node\"\n\tKeyNetworkType             = network.GroupName + \"/type\"\n\tKeyLastNetworkType         = network.GroupName + \"/last-type\"\n\tKeyNetworkReady            = network.GroupName + \"/ready\"\n\tKeyNetworkRoute            = network.GroupName + \"/route\"\n\n\tKeyMatchedNodes = network.GroupName + \"/matched-nodes\"\n\n\tValueTrue  = \"true\"\n\tValueFalse = \"false\"\n\n\tCloudweavWitnessNodeLabelKey = \"node-role.cloudweavhci.io/witness\"\n)\n```\n\n```go\nconst ManagementClusterNetworkName = \"mgmt\"\n```\n\n## Functions\n\n```go\nfunc EnsureSysctlValue(name, value string) error\n```\n\n```go\nfunc IsVlanNad(nad *nadv1.NetworkAttachmentDefinition) bool\n```\n\n```go\nfunc Name(prefix string, s ...string) string\n```\nName function joints prefix with all other strings and crc32 checksum\n\n```go\nfunc NewSelector(selector map[string]string) (labels.Selector, error)\n```\n\n## Types\n\n```go\ntype Connectivity string\n```\n\n```go\nconst (\n\tConnectable   Connectivity = \"true\"\n\tUnconnectable Connectivity = \"false\"\n\tDHCPFailed    Connectivity = \"DHCP failed\"\n\tPingFailed    Connectivity = \"ping failed\"\n)\n```\n\n```go\ntype Layer3NetworkConf struct {\n\tMode         Mode         `json:\"mode,omitempty\"`\n\tCIDR         string       `json:\"cidr,omitempty\"`\n\tGateway      string       `json:\"gateway,omitempty\"`\n\tServerIPAddr string       `json:\"serverIPAddr,omitempty\"`\n\tConnectivity Connectivity `json:\"connectivity,omitempty\"`\n\tOutdated     bool         `json:\"outdated,omitempty\"`\n}\n```\n\n```go\nfunc NewLayer3NetworkConf(conf string) (*Layer3NetworkConf, error)\n```\n\n```go\nfunc (c *Layer3NetworkConf) ToString() (string, error)\n```\n\n```go\ntype Mode string\n```\n\n```go\nconst (\n\tAuto   Mode = \"auto\"\n\tManual Mode = \"manual\"\n)\n```\n\n```go\ntype NadSelectedNetworks []nadv1.NetworkSelectionElement\n```\n\n```go\nfunc NewNADSelectedNetworks(conf string) (NadSelectedNetworks, error)\n```\n\n```go\nfunc (n NadSelectedNetworks) ToString() (string, error)\n```\n\n```go\ntype NetConf struct {\n\tcniv1.NetConf\n\tBrName       string `json:\"bridge\"`\n\tIsGW         bool   `json:\"isGateway\"`\n\tIsDefaultGW  bool   `json:\"isDefaultGateway\"`\n\tForceAddress bool   `json:\"forceAddress\"`\n\tIPMasq       bool   `json:\"ipMasq\"`\n\tMTU          int    `json:\"mtu\"`\n\tHairpinMode  bool   `json:\"hairpinMode\"`\n\tPromiscMode  bool   `json:\"promiscMode\"`\n\tVlan         int    `json:\"vlan\"`\n}\n```\n\n```go\ntype NetworkType string\n```\n\n```go\nconst (\n\tL2VlanNetwork   NetworkType = \"L2VlanNetwork\"\n\tUntaggedNetwork NetworkType = \"UntaggedNetwork\"\n)\n```\n\n```go\ntype VmiGetter struct {\n\tVmiCache ctlkubevirtv1.VirtualMachineInstanceCache\n}\n```\n\n```go\nfunc (v *VmiGetter) WhoUseNad(nad *nadv1.NetworkAttachmentDefinition, nodesFilter mapset.Set[string]) ([]*kubevirtv1.VirtualMachineInstance, error)\n```\nWhoUseNad requires adding network indexer to the vmi cache before invoking it\n\n","path":"github.com/cloudweav/cloudweav-network-controller/pkg/utils","name":"utils","synopsis":"","isRedistributable":true}
