Help us shape the future of Go! Take the 2026 Go Developer Survey

features

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package features declares Mokka's feature gates on top of the Kubernetes component-base feature gate, so operators use the same syntax and lifecycle they know from Kubernetes components.

Index

Constants

View Source
const (
	// FlagName is the command-line flag of the services that apply gates:
	// node-agent, nri-plugin and control-plane.
	FlagName = "feature-gates"
	// EnvName is the environment variable those services read when the flag
	// is not set.
	EnvName = "MOKKA_FEATURE_GATES"
)
View Source
const (
	// issue: https://github.com/NVIDIA/k8s-test-infra/issues/821
	//
	// Lets the node agent download the IMEX archive it pins from NVIDIA into
	// a node cache when no archive is provided. To be deprecated once Mokka
	// publishes the IMEX binaries image.
	IMEXDownload featuregate.Feature = "IMEXDownload"
)

Declare each gate as a featuregate.Feature constant here and add its lifecycle to versionedSpecs below. node-agent, nri-plugin and control-plane apply every gate, so the chart can pass one list to all of them. No other process applies gates: nvml-mock-ctl and the mock NVML and CUDA libraries always see the defaults, so code they share with the services must receive the decision as a value rather than call Enabled.

Example:

// owner: @github-handle
// issue: https://github.com/NVIDIA/k8s-test-infra/issues/1234
//
// Selects the alternate placement planner.
AlternatePlanner featuregate.Feature = "AlternatePlanner"

Variables

This section is empty.

Functions

func CLIFlag

func CLIFlag() cli.Flag

CLIFlag returns the --feature-gates flag of the services that apply gates. Like the Kubernetes components' flag, its help lists the alpha and beta gates with their defaults.

func ConfigureFromCLI

func ConfigureFromCLI(cmd *cli.Command, logger *zap.Logger) error

ConfigureFromCLI applies the --feature-gates value and logs the resulting state. Call it once, before starting any workers.

func Enabled

func Enabled(f featuregate.Feature) bool

Enabled reports whether a feature gate is enabled in this process.

func SetFeatureGateDuringTest

func SetFeatureGateDuringTest(tb testing.TB, f featuregate.Feature, value bool)

SetFeatureGateDuringTest overrides a gate for the duration of a test and restores it on cleanup. Tests that call it must not run in parallel with other tests that read the same gate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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