kubernetes/staging/src/k8s.io/component-helpers/node/util/sysctl/namespace.go

type Namespace

const IPCNamespace

const NetNamespace

const UnknownNamespace

var nameToNamespace

var prefixToNamespace

// namespaceOf returns the namespace of the Linux kernel for a sysctl, or
// unknownNamespace if the sysctl is not known to be namespaced.
// The second return is prefixed bool.
// It returns true if the key is prefixed with a key in the prefix map
func namespaceOf(val string) Namespace {}

// GetNamespace extracts information from a sysctl string. It returns:
//  1. The sysctl namespace, which can be one of the following: IPC, Net, or unknown.
//  2. sysctlOrPrefix: the prefix of the sysctl parameter until the first '*'.
//     If there is no '*', it will be the original string.
//  3. 'prefixed' is set to true if the sysctl parameter contains '*' or it is in the prefixToNamespace key list, in most cases, it is a suffix *.
//
// For example, if the input sysctl is 'net.ipv6.neigh.*', GetNamespace will return:
// - The Net namespace
// - The sysctlOrPrefix as 'net.ipv6.neigh'
// - 'prefixed' set to true
//
// For the input sysctl 'net.ipv6.conf.all.disable_ipv6', GetNamespace will return:
// - The Net namespace
// - The sysctlOrPrefix as 'net.ipv6.conf.all.disable_ipv6'
// - 'prefixed' set to false.
func GetNamespace(sysctl string) (ns Namespace, sysctlOrPrefix string, prefixed bool) {}