constants

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CertificateDirectory is the root directory containing all certificates generated by
	// clabernetes manager.
	CertificateDirectory = "/clabernetes/certificates"

	// CertificateAuthoritySubDir is the subdirectory where certificate authority certs are stored.
	CertificateAuthoritySubDir = "ca"

	// ClientCertificateSubDir is the subdirectory where client certs are stored.
	ClientCertificateSubDir = "client"

	// WebhookCertificateSubDir is the subdirectory where webhook/http certs are stored.
	WebhookCertificateSubDir = "webhook"
)
View Source
const (
	// Clabernetes is the name... clabernetes.
	Clabernetes = "clabernetes"

	// Clabverter is a constant for the lovely name "clabverter".
	Clabverter = "clabverter"

	// True is a constant representing the string "true".
	True = "true"

	// False is a constant representing the string "false".
	False = "false"

	// Default is a constant for the string default -- often used for keys in clabernetes maps.
	Default = "default"

	// AppNameDefault is the default name for the "app" (the helm value appName) -- "clabernetes".
	AppNameDefault = "clabernetes"

	// VXLANServicePort is the port number for vxlan that we use in the kubernetes service.
	VXLANServicePort = 14789

	// SlurpeethServicePort is the port number for slurpeeth that we use in the kubernetes service.
	SlurpeethServicePort = 4799

	// TCP is... TCP.
	TCP = "TCP"

	// UDP is... UDP.
	UDP = "UDP"

	// FileModeRead is "read". Used for configmap mount permissions in the
	// TopologySpec/FilesFromConfigMap.
	FileModeRead = "read"

	// FileModeExecute is "execute". Used for configmap mount permissions in the
	// TopologySpec/FilesFromConfigMap.
	FileModeExecute = "execute"
)
View Source
const (
	// AppNameEnv is the environment variable name of the "appName" as supplied to helm
	// if not set the default will always be AppNameDefault.
	AppNameEnv = "APP_NAME"

	// ManagerLoggerLevelEnv is the environment variable name that can be used to set the
	// clabernetes manager logger level. This is the logger for the "main" process, not the
	// individual controllers.
	ManagerLoggerLevelEnv = "MANAGER_LOGGER_LEVEL"

	// ControllerLoggerLevelEnv is the environment variable name that can be used to set the
	// clabernetes controllers logger level.
	ControllerLoggerLevelEnv = "CONTROLLER_LOGGER_LEVEL"

	// ClientOperationTimeoutMultiplierEnv is the multiplier applied to the default client
	// operation timeout.
	ClientOperationTimeoutMultiplierEnv = "CLIENT_OPERATION_TIMEOUT_MULTIPLIER"
)
View Source
const (
	// NodeNameEnv is the env var name that holds the name of the node a pod is on -- this comes
	// from the field object selector in a deployment/pod spec.
	NodeNameEnv = "NODE_NAME"
	// PodNameEnv is the env var name that holds the name of the pod.
	PodNameEnv = "POD_NAME"
	// PodNamespaceEnv is the env var name that holds the namespace of the pod.
	PodNamespaceEnv = "POD_NAMESPACE"
	// ManagerNamespaceEnv is the environment variable that holds the namespace that the manager is
	// running in.
	ManagerNamespaceEnv = "MANAGER_NAMESPACE"
)
View Source
const (
	// LauncherLoggerLevelEnv is the environment variable name that can be used to set the
	// clabernetes launcher logger level.
	LauncherLoggerLevelEnv = "LAUNCHER_LOGGER_LEVEL"

	// LauncherContainerlabDebug is the environment variable name that can be used to enable the
	// debug flag of clabernetes when invoked on the launcher pod.
	LauncherContainerlabDebug = "LAUNCHER_CONTAINERLAB_DEBUG"

	// LauncherContainerlabTimeout is the environment variable name that can be used to set the
	// value of the timeout flag of clabernetes when invoked on the launcher pod.
	LauncherContainerlabTimeout = "LAUNCHER_CONTAINERLAB_TIMEOUT"

	// LauncherImageEnv env var that tells the controllers what image to use for clabernetes
	// (launcher) pods.
	LauncherImageEnv = "LAUNCHER_IMAGE"

	// LauncherPrivilegedEnv is an envar that indicates if the launcher is launched with
	// privileged mode or our "not so privileged mode".
	LauncherPrivilegedEnv = "LAUNCHER_PRIVILEGED"

	// LauncherInsecureRegistries env var that tells the launcher pods which registries are
	// insecure. Should be set by the controller via the topology spec.
	LauncherInsecureRegistries = "LAUNCHER_INSECURE_REGISTRIES"

	// LauncherImagePullThroughModeEnv env var tells the manager how to configure the launcher,
	// which in turn tells the launcher how it should attempt to pull images for the node it
	// represents.
	LauncherImagePullThroughModeEnv = "LAUNCHER_IMAGE_PULL_THROUGH_MODE"

	// LauncherCRIKindEnv env var tells the launcher what CRI sock is mounted in it (if configured).
	LauncherCRIKindEnv = "LAUNCHER_CRI_KIND"

	// LauncherTopologyNameEnv is the env var that holds the name of the topology that a given
	// launcher is responsible for.
	LauncherTopologyNameEnv = "LAUNCHER_TOPOLOGY_NAME"

	// LauncherNodeNameEnv is the env var that holds the name of the node in the original topology
	// that a given launcher is responsible for.
	LauncherNodeNameEnv = "LAUNCHER_NODE_NAME"

	// LauncherNodeImageEnv is the env var that holds the image name of the node in the original
	// topology that a given launcher is responsible for.
	LauncherNodeImageEnv = "LAUNCHER_NODE_IMAGE"

	// LauncherConnectivityKind is the env var that holds the flavor cf connectivity the launcher
	// should run (vxlan/slurpeeth).
	LauncherConnectivityKind = "LAUNCHER_CONNECTIVITY_KIND"

	// LauncherContainerlabVersion is the env var that holds the possibly user specified version of
	// containerlab to download and use in the launcher.
	LauncherContainerlabVersion = "LAUNCHER_CONTAINERLAB_VERSION"

	// LauncherTCPProbePort is the env var that holds the port to use in the tcp probe (if
	// configured).
	LauncherTCPProbePort = "LAUNCHER_TCP_PROBE_PORT"

	// LauncherSSHProbePort is the env var that holds the port to use in the ssh probe (if
	// configured).
	LauncherSSHProbePort = "LAUNCHER_SSH_PROBE_PORT"

	// LauncherSSHProbeUsername is the env var that holds the username to use in the ssh probe (if
	// configured).
	LauncherSSHProbeUsername = "LAUNCHER_SSH_PROBE_USERNAME"

	// LauncherSSHProbePassword is the env var that holds the password to use in the ssh probe (if
	// configured).
	LauncherSSHProbePassword = "LAUNCHER_SSH_PROBE_PASSWORD" //nolint:gosec
)
View Source
const (
	// ClickerLoggerLevelEnv is the environment variable name that can be used to set the
	// cl(abernetes t)ick(l)er logger level.
	ClickerLoggerLevelEnv = "CLICKER_LOGGER_LEVEL"

	// ClickerWorkerImage is the environment variable name that can be used to set the
	// cl(abernetes t)ick(l)er worker image -- that is, the image that is deployed in a pod on all
	// target nodes, by default this is simply 'busybox'.
	ClickerWorkerImage = "CLICKER_WORKER_IMAGE"

	// ClickerWorkerCommand is the command for the worker -- defaults to "/bin/sh".
	ClickerWorkerCommand = "CLICKER_WORKER_COMMAND"

	// ClickerWorkerScript is the script for the clicker worker -- defaults to 'echo "hello, there"'
	// since we can't know what users will need here.
	ClickerWorkerScript = "CLICKER_WORKER_SCRIPT"

	// ClickerWorkerResources -- see also ClickerGlobalAnnotations -- same thing just for the worker
	// pod resources, we'll just unmarshal to k8scorev1.ResourceRequirements.
	ClickerWorkerResources = "CLICKER_WORKER_RESOURCES"

	// ClickerGlobalAnnotations is the env var where we store the global annotations from the helm
	// deployment -- these annotations need to be stored such that they can be set on the actual
	// "worker" pods as well. In "normal" clabernetes operations this is stored in the configmap
	// where other config things are stored, but in context of the clicker this configmap may not
	// exist, so we'll just stuff these into env vars.
	ClickerGlobalAnnotations = "CLICKER_GLOBAL_ANNOTATIONS"

	// ClickerGlobalLabels -- see also ClickerGlobalAnnotations -- same thing just for labels.
	ClickerGlobalLabels = "CLICKER_GLOBAL_LABELS"
)
View Source
const (
	// KubernetesConfigMap is a const to use for "configmap".
	KubernetesConfigMap = "configmap"

	// KubernetesService is a const to use for "service".
	KubernetesService = "service"

	// KubernetesPVC is a const to use for "persistentvolumeclaim".
	KubernetesPVC = "persistentvolumeclaim"

	// KubernetesDeployment is a const to use for "deployment".
	KubernetesDeployment = "deployment"

	// KubernetesServiceClusterIPType is a const to use for "ClusterIP".
	KubernetesServiceClusterIPType = "ClusterIP"

	// KubernetesServiceLoadBalancerType is a const to use for "LoadBalancer".
	KubernetesServiceLoadBalancerType = "LoadBalancer"
)
View Source
const (
	// KubernetesCRIUnknown is a const for when we dont know what the CRI type is in a cluster.
	KubernetesCRIUnknown = "unknown"
	// KubernetesCRIContainerd is a const for the "containerd" type of CRI in a cluster.
	KubernetesCRIContainerd = "containerd"
	// KubernetesCRICrio is a const for the "cri-o" type of CRI in a cluster.
	KubernetesCRICrio = "crio"
)
View Source
const (
	// KubernetesCRISockContainerdPath is the path where the containerd sock lives.
	KubernetesCRISockContainerdPath = "/run/containerd"
	// KubernetesCRISockContainerd is the containerd sock filename.
	KubernetesCRISockContainerd = "containerd.sock"
)
View Source
const (
	// LabelKubernetesName is the key for the standard kubernetes app.kubernetes.io/name label --
	// some tools use this label so we want to put it on all the deployments we spawn.
	LabelKubernetesName = "app.kubernetes.io/name"

	// LabelApp is the label key for the simple app name.
	LabelApp = "clabernetes/app"

	// LabelName is the label key for the name of the project/application.
	LabelName = "clabernetes/name"

	// LabelComponent is the label key for the component label, it should define the component/tier
	// in the app, i.e. "manager".
	LabelComponent = "clabernetes/component"

	// LabelTopologyOwner is the label indicating the topology that owns the given resource.
	LabelTopologyOwner = "clabernetes/topologyOwner"

	// LabelTopologyNode is the label indicating the node the deployment represents in a topology.
	LabelTopologyNode = "clabernetes/topologyNode"

	// LabelTopologyKind is the label indicating the resource *kind* the object is associated with.
	// For example, a "containerlab" kind, or a "kne" kind.
	LabelTopologyKind = "clabernetes/topologyKind"

	// LabelTopologyServiceType is a label that identifies what flavor of service a given service
	// is -- that is, it is either a "connectivity" service, or an "expose" service; note that
	// this is strictly a clabernetes concept, obviously not a kubernetes one!
	LabelTopologyServiceType = "clabernetes/topologyServiceType"
)
View Source
const (
	// TopologyServiceTypeFabric is one of the allowed values for the LabelTopologyServiceType label
	// type -- this indicates that this service is of the type that facilitates the connectivity
	// between containerlab devices in the cluster.
	TopologyServiceTypeFabric = "fabric"
	// TopologyServiceTypeExpose is one of the allowed values for the LabelTopologyServiceType label
	// type -- this indicates that this service is of the type that is used for exposing ports on
	// a containerlab node via a LoadBalancer service.
	TopologyServiceTypeExpose = "expose"
)
View Source
const (
	// LabelClickerNodeConfigured is a label that is set on nodes that have been tickled via the
	// clabernetes clicker tool -- the value is the unix timestamp that the node was tickled.
	LabelClickerNodeConfigured = "clabernetes/clickerNodeConfigured"
	// LabelClickerNodeTarget is the target node for the clicker job.
	LabelClickerNodeTarget = "clabernetes/clickerNodeTarget"
)
View Source
const (
	// LabelIgnoreReconcile indicates that controller should ignore reconciling a given topology.
	// Note that this basically ignored during deletion since our controller doest do anything in
	// the delete case (owner reference handles clean up).
	LabelIgnoreReconcile = "clabernetes/ignoreReconcile"

	// LabelDisableDeployments indicates that controller should reconcile normally but not create
	// update or delete any deployments.
	LabelDisableDeployments = "clabernetes/disableDeployments"
)
View Source
const (
	// LabelPullerImageHash is a label that holds the (shortened) hash of the image tag that the
	// puller is trying to pull onto a node.
	LabelPullerImageHash = "clabernetes/pullerImageHash"

	// LabelPullerNodeTarget is a label that holds the node name that is being targeted by the
	// puller pod.
	LabelPullerNodeTarget = "clabernetes/pullerNodeTarget"
)
View Source
const (
	// ImagePullThroughModeAlways a constant representing the "always" image pull through mode for
	// the launcher pods.
	ImagePullThroughModeAlways = "always"

	// ImagePullThroughModeNever a constant representing the "never" image pull through mode for
	// the launcher pods.
	ImagePullThroughModeNever = "never"

	// ImagePullThroughModeAuto a constant representing the "auto" image pull through mode for
	// the launcher pods.
	ImagePullThroughModeAuto = "auto"

	// NamingModePrefixed is a constant representing the "prefixed" enum(ish) value for the naming
	// field of a Topology.
	NamingModePrefixed = "prefixed"

	// NamingModeNonPrefixed is a constant representing the "non-prefixed" enum(ish) value for the
	// naming field of a Topology.
	NamingModeNonPrefixed = "non-prefixed"

	// NamingModeGlobal is a constant representing the (default) "global" enum(ish) value for the
	// naming field of a Topology.
	NamingModeGlobal = "global"

	// ConnectivityVXLAN is a constant for the vxlan connectivity flavor.
	ConnectivityVXLAN = "vxlan"

	// ConnectivitySlurpeeth is a constant for the slurpeeth connectivity flavor.
	ConnectivitySlurpeeth = "slurpeeth"

	// NodeStatusFile is the file we write the node status to for launchers -- this is also used
	// by the deployment for startup/liveness probes.
	NodeStatusFile = "/clabernetes/.nodestatus"

	// NodeStatusHealthy is the content of hte NodeStatuesFile when/if the node in the launcher is
	// healthy.
	NodeStatusHealthy = "healthy"

	// NodeStatusReady is reported in the topology.status.nodereadiness map for nodes that have
	// their startup/readiness probes in a succeeding state.
	NodeStatusReady = "ready"

	// NodeStatusNotReady is reported in the topology.status.nodereadiness map for nodes that have
	// deployments running but do not report ready (via startup/readiness probes).
	NodeStatusNotReady = "notready"

	// NodeStatusUnknown is reported in the topology.status.nodereadiness map for nodes that have
	// no deployment available for whatever reason.
	NodeStatusUnknown = "unknown"

	// NodeStatusDeploymentDisabled is reported in the topology.status.nodereadiness map when the
	// parent topology has the "clabernetes/disableDeployments" label set.
	NodeStatusDeploymentDisabled = "deploymentDisabled"
)
View Source
const (
	// Debug is the debug log level.
	Debug = "debug"
	// Info is the info(rmational) log level.
	Info = "info"
	// Warn is the warning log level.
	Warn = "warn"
	// Critical is the critical log level.
	Critical = "critical"
	// Fatal is the fatal log level.
	Fatal = "fatal"
	// Disabled is the disabled (no logging) log level.
	Disabled = "disabled"
)
View Source
const (
	// ExitCode is the exit code used for a graceful exit of the program.
	ExitCode = 0

	// ExitCodeError is the generic exit code used when the program exits in an errored state.
	ExitCodeError = 1

	// ExitCodeSigint is the exit code used when the program is interrupted by a SIGINT/SIGTERM.
	ExitCodeSigint = 130

	// PermissionsEveryoneAllPermissions is 0777 permissions for files/directories -- everyone has
	// read, write, and execute permissions.
	PermissionsEveryoneAllPermissions = 0o777

	// PermissionsEveryoneReadWriteOwnerExecute is 0755 permissions for files/directories --
	// everyone can read, and execute, and owner can write.
	PermissionsEveryoneReadWriteOwnerExecute = 0o755

	// PermissionsEveryoneReadWrite is 0666 permissions for files/directories -- everyone has read
	// and write permissions.
	PermissionsEveryoneReadWrite = 0o666

	// PermissionsEveryoneReadExecute is 0555 permissions for files/directories -- everyone has read
	// and execute permissions.
	PermissionsEveryoneReadExecute = 0o555

	// PermissionsEveryoneRead is 0444 permissions for files/directories -- everyone has read
	// permissions.
	PermissionsEveryoneRead = 0o444
)
View Source
const (
	// PortFTP is the FTP port number.
	PortFTP = 21

	// PortSSH is the SSH port number.
	PortSSH = 22

	// PortTelnet is the telnet port number.
	PortTelnet = 23

	// PortHTTP is the HTTP port number.
	PortHTTP = 80

	// PortSNMP is the SNMP port number.
	PortSNMP = 161

	// PortHTTPS is the HTTPS port number.
	PortHTTPS = 443

	// PortNETCONF is the NETCONF (over ssh) port number.
	PortNETCONF = 830

	// PortQemuTelnet is the Qemu management telnet (for vrnetlab generally) port number.
	PortQemuTelnet = 5000

	// PortVNC is the VNC port number.
	PortVNC = 5900

	// PortGNMIArista is the Arista default GNMI port number.
	PortGNMIArista = 6030

	// PortGNMI is the GNMI default port number.
	PortGNMI = 9339

	// PortGRIBI is the GRIBI port number.
	PortGRIBI = 9340

	// PortP4RT is the p4 runtime port number.
	PortP4RT = 9559

	// PortGNMINokia is the Nokia default GNMI port number.
	PortGNMINokia = 57400

	// HealthProbePort is the port number for kubernetes health endpoints to run on.
	HealthProbePort = 8080
)
View Source
const (
	// DefaultClientOperationTimeout is the default timeout to use for all kubernetes client
	// operations (i.e. Get, Create, etc.).
	DefaultClientOperationTimeout = 2 * time.Second

	// PullerPodTimeout is the max time to wait for puller pod spawning in both the http server
	// where we handle puller pod requests and in the launcher when we wait for the image to be
	// available.
	PullerPodTimeout = 5 * time.Minute
)
View Source
const (
	// GitHubTokenEnv is the env var that holds (optionally of course) a GitHub token -- this is
	// useful for the clabverter tool as well as the launcher where we *may* need to use the
	// GitHub api to list contents of a directory (this is specifically for dealing with large files
	// that don't fit in configmaps).
	GitHubTokenEnv = "GITHUB_TOKEN" //nolint:gosec
)
View Source
const (
	// KeySize is the default rsa key size.
	KeySize = 4096
)
View Source
const (
	// KubernetesDefaultInClusterDNSSuffix is the default in cluster dns suffix (duh).
	KubernetesDefaultInClusterDNSSuffix = "svc.cluster.local"
)
View Source
const (
	// KubernetesImagePullIfNotPresent holds the constant for "IfNotPresent" image pull policy.
	KubernetesImagePullIfNotPresent = "IfNotPresent"
)
View Source
const (
	// LauncherCRISockPath is the path where, if configured, the CRI sock is mounted in launcher
	// pods.
	LauncherCRISockPath = "/clabernetes/.node"
)

Variables

View Source
var Version = "0.0.0" //nolint: gochecknoglobals

Version of the clabernetes manager. Set with build flags, so leave at 0.0.0.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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