app

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 7 Imported by: 5 modules, 20 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	KubeClientQpsDefault   = "5"  // DefaultQPS from k8s.io/client-go/rest/config.go
	KubeClientBurstDefault = "10" // DefaultBurst from k8s.io/client-go/rest/config.go
)
View Source
const (
	ObjectPatcherKubeClientQpsDefault     = "5"  // DefaultQPS from k8s.io/client-go/rest/config.go
	ObjectPatcherKubeClientBurstDefault   = "10" // DefaultBurst from k8s.io/client-go/rest/config.go
	ObjectPatcherKubeClientTimeoutDefault = "10s"
)
View Source
const (
	ForcedDurationForDebugLevel = 30 * time.Minute
	ProxyJsonLogKey             = "proxyJsonLog"
)

ForcedDurationForDebugLevel - force expiration for debug level.

View Source
const (
	ValidatingServerCertPathDefault    = "/validating-certs/tls.crt"
	ValidatingServerKeyPathDefault     = "/validating-certs/tls.key"
	ValidatingServiceNameDefault       = "shell-operator-validating-svc"
	ValidatingListenAddrDefault        = "0.0.0.0"
	ValidatingListenPortDefault        = "9680"
	ValidatingCAPathDefault            = "/validating-certs/ca.crt"
	ValidatingConfigurationNameDefault = "shell-operator-hooks"
	ValidatingFailurePolicyTypeDefault = "Fail"
)

Default values for validating webhook configuration

View Source
const (
	ConversionServerCertPathDefault = "/conversion-certs/tls.crt"
	ConversionServerKeyPathDefault  = "/conversion-certs/tls.key"
	ConversionServiceNameDefault    = "shell-operator-conversion-svc"
	ConversionListenAddrDefault     = "0.0.0.0"
	ConversionListenPortDefault     = "9681"
	ConversionCAPathDefault         = "/conversion-certs/ca.crt"
)

Default values for conversion webhook configuration

Variables

View Source
var (
	AppName         = "shell-operator"
	AppDescription  = "Run your custom cluster-wide scripts in reaction to Kubernetes events or on schedule."
	AppStartMessage = "shell-operator"
)
View Source
var (
	HooksDir = "hooks"
	TempDir  = "/tmp/shell-operator"
)
View Source
var (
	Namespace     = ""
	ListenAddress = "0.0.0.0"
	ListenPort    = "9115"
)
View Source
var (
	KubeContext            = ""
	KubeConfig             = ""
	KubeServer             = ""
	KubeClientFieldManager = ""
)
View Source
var (
	KubeClientQps   float32
	KubeClientBurst int
)
View Source
var (
	ObjectPatcherKubeClientQps     float32
	ObjectPatcherKubeClientBurst   int
	ObjectPatcherKubeClientTimeout time.Duration
)
View Source
var (
	LogLevel         = "info"
	LogNoTime        = false
	LogType          = "text"
	LogProxyHookJSON = false
)

Use info level with timestamps and a text output by default

View Source
var (
	ValidatingWebhookConfigurationName string
	ValidatingWebhookServiceName       string
	ValidatingWebhookServerCert        string
	ValidatingWebhookServerKey         string
	ValidatingWebhookCA                string
	ValidatingWebhookClientCA          []string
	ValidatingWebhookFailurePolicy     string
	ValidatingWebhookListenPort        string
	ValidatingWebhookListenAddress     string
)

Validating webhook flag variables - exported so they can be used after parsing

View Source
var (
	ConversionWebhookServiceName   string
	ConversionWebhookServerCert    string
	ConversionWebhookServerKey     string
	ConversionWebhookCA            string
	ConversionWebhookClientCA      []string
	ConversionWebhookListenPort    string
	ConversionWebhookListenAddress string
)

Conversion webhook flag variables - exported so they can be used after parsing

View Source
var CommonFlagsInfo = map[string]FlagInfo{
	"hooks-dir": {
		"hooks-dir",
		"A path to a hooks file structure. Can be set with $SHELL_OPERATOR_HOOKS_DIR.",
		"SHELL_OPERATOR_HOOKS_DIR",
		true,
	},
	"tmp-dir": {
		"tmp-dir",
		"A path to store temporary files with data for hooks. Can be set with $SHELL_OPERATOR_TMP_DIR.",
		"SHELL_OPERATOR_TMP_DIR",
		true,
	},
	"listen-address": {
		"listen-address",
		"Address to use to serve metrics to Prometheus. Can be set with $SHELL_OPERATOR_LISTEN_ADDRESS.",
		"SHELL_OPERATOR_LISTEN_ADDRESS",
		true,
	},
	"listen-port": {
		"listen-port",
		"Port to use to serve metrics to Prometheus. Can be set with $SHELL_OPERATOR_LISTEN_PORT.",
		"SHELL_OPERATOR_LISTEN_PORT",
		true,
	},
	"prometheus-metrics-prefix": {
		"prometheus-metrics-prefix",
		"Prefix for Prometheus metrics. Can be set with $SHELL_OPERATOR_PROMETHEUS_METRICS_PREFIX.",
		"SHELL_OPERATOR_PROMETHEUS_METRICS_PREFIX",
		true,
	},
	"hook-metrics-listen-port": {
		"hook-metrics-listen-port",
		"Port to use to serve hooks’ custom metrics to Prometheus. Can be set with $SHELL_OPERATOR_HOOK_METRICS_LISTEN_PORT. Equal to listen-port if empty.",
		"SHELL_OPERATOR_HOOK_METRICS_LISTEN_PORT",
		true,
	},
	"namespace": {
		"namespace",
		"A namespace of a shell-operator. Used to setup validating webhooks. Can be set with $SHELL_OPERATOR_NAMESPACE.",
		"SHELL_OPERATOR_NAMESPACE",
		true,
	},
}
View Source
var DebugHttpServerAddr = ""
View Source
var DebugKeepTmpFiles = false
View Source
var DebugKubernetesAPI = false
View Source
var DebugUnixSocket = "/var/run/shell-operator/debug.socket"
View Source
var PrometheusMetricsPrefix = "shell_operator_"
View Source
var Version = "v1.2.0-dev"

Functions

func CommandWithDefaultUsageTemplate

func CommandWithDefaultUsageTemplate(kpApp *kingpin.Application, name, help string) *kingpin.CmdClause

CommandWithDefaultUsageTemplate is used to workaround an absence of per-command usage templates

func DefineConversionWebhookFlags

func DefineConversionWebhookFlags(cmd *kingpin.CmdClause)

DefineConversionWebhookFlags defines flags for ConversionWebhook server.

func DefineDebugFlags

func DefineDebugFlags(kpApp *kingpin.Application, cmd *kingpin.CmdClause)

DefineDebugFlags init global command line flags for debug.

func DefineDebugUnixSocketFlag

func DefineDebugUnixSocketFlag(cmd *kingpin.CmdClause)

func DefineKubeClientFlags

func DefineKubeClientFlags(cmd *kingpin.CmdClause)

func DefineLoggingFlags

func DefineLoggingFlags(cmd *kingpin.CmdClause)

DefineLoggingFlags defines flags for logger settings.

func DefineStartCommandFlags

func DefineStartCommandFlags(kpApp *kingpin.Application, cmd *kingpin.CmdClause)

DefineStartCommandFlags set shell-operator flags for cmd

func DefineValidatingWebhookFlags

func DefineValidatingWebhookFlags(cmd *kingpin.CmdClause)

DefineValidatingWebhookFlags defines flags for ValidatingWebhook server.

func OperatorUsageTemplate

func OperatorUsageTemplate(appName string) string

func SetupLogging

func SetupLogging(runtimeConfig Registerer, logger *log.Logger)

SetupLogging sets logger formatter and level.

Types

type FlagInfo

type FlagInfo struct {
	Name   string
	Help   string
	Envar  string
	Define bool
}

type Registerer added in v1.12.3

type Registerer interface {
	Register(key string, help string, defaultValue string,
		setter func(key string, newValue string) error,
		expirer func(key string, newValue string) time.Duration)
}

Jump to

Keyboard shortcuts

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