component-basek8s.io/component-base/cli/globalflag Index | Files

package globalflag

import "k8s.io/component-base/cli/globalflag"

Index

Functions

func AddGlobalFlags

func AddGlobalFlags(fs *pflag.FlagSet, name string, opts ...logs.Option)

AddGlobalFlags explicitly registers flags that libraries (klog, verflag, etc.) register against the global flagsets from "flag" and "k8s.io/klog/v2". We do this in order to prevent unwanted flags from leaking into the component's flagset.

k8s.io/component-base/logs.SkipLoggingConfigurationFlags must be used as option when the program also uses a LoggingConfiguration struct for configuring logging. Then only flags not covered by that get added.

func Register

func Register(local *pflag.FlagSet, globalName string)

Register adds a flag to local that targets the Value associated with the Flag named globalName in flag.CommandLine.

Source Files

globalflags.go

Version
v0.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
4 packages
Last checked
4 hours ago

Tools for package owners.