env

package
v3.0.0-rc67 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 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

This section is empty.

Variables

View Source
var (
	ActionOriginVar                          = "OSVC_ACTION_ORIGIN"
	ActionOriginUser            ActionOrigin = "user"
	ActionOriginDaemonAPI       ActionOrigin = "daemon/api"
	ActionOriginDaemonMonitor   ActionOrigin = "daemon/monitor"
	ActionOriginDaemonScheduler ActionOrigin = "daemon/scheduler"

	NameVar      = "OSVC_NAME"
	NamespaceVar = "OSVC_NAMESPACE"
	KindVar      = "OSVC_KIND"
	ContextVar   = "OSVC_CONTEXT"

	NoLogFileVar = "OSVC_NO_LOG_FILE"

	// JoinTokenVar is the environment variable the "cluster join" command
	// reads the join token from when --token is not set. The daemon uses it
	// to hand a token to the join it forks, so the token never appears in the
	// process command line, which any user can read.
	JoinTokenVar = "OSVC_JOIN_TOKEN"

	// CredentialVar is the environment variable the "cluster leave" command
	// reads the <username>:<password> of the user to create on the leaving
	// node from. The daemon uses it to hand a credential to the leave it
	// forks. There is no flag carrying the value itself, for the same reason
	// the join token has none: the process command line is world readable.
	CredentialVar = "OSVC_CREDENTIAL"

	// CollectorCredentialVar is the environment variable the collector
	// registration commands read the <username>:<password> of the collector
	// user from when --credential is not set. It is separate from
	// CredentialVar because it names a user of the collector, not of the
	// cluster, and an operator can hold one without the other.
	CollectorCredentialVar = "OSVC_COLLECTOR_CREDENTIAL"

	// FreezeScopeVar is the environment variable the node monitor sets to
	// "cluster" on the "node freeze" it forks for a freeze of the cluster,
	// so the frozen flag records it, and the peers that missed the freeze
	// adopt it when they come back.
	FreezeScopeVar = "OSVC_FREEZE_SCOPE"

	// ResourceRestartVar marks the start of resources the daemon runs to
	// restart them, as their restart keyword asks, apart from the starts
	// an orchestration asks: a restart is the node trying to get back
	// what it lost, not a takeover fencing a node gone.
	ResourceRestartVar = "OSVC_RESOURCE_RESTART"
)

Functions

func Context

func Context() string

Context returns the identifier of a remote cluster endpoint and credentials configuration via the OSVC_CONTEXT variable.

func HasDaemonMonitorOrigin

func HasDaemonMonitorOrigin() bool

HasDaemonMonitorOrigin returns true if the environment variable OSVC_ACTION_ORIGIN is set to "daemon/monitor". The opensvc daemon sets this variable on every command it executes.

func HasDaemonOrigin

func HasDaemonOrigin() bool

HasDaemonOrigin returns true if the environment variable OSVC_ACTION_ORIGIN is set to one of the daemon origins: "daemon/monitor", "daemon/api" or "daemon/scheduler". The opensvc daemon sets this variable on every command it executes.

func HasDaemonSchedulerOrigin

func HasDaemonSchedulerOrigin() bool

HasDaemonSchedulerOrigin returns true if the environment variable OSVC_ACTION_ORIGIN is set to "daemon/scheduler", which the daemon sets on the commands its scheduler runs.

func IsResourceRestart

func IsResourceRestart() bool

IsResourceRestart says the command is a restart of resources the daemon runs, see ResourceRestartVar.

func Kind

func Kind() string

Kind returns the object kind filter forced via the OSVC_NAMESPACE environment variable.

func Namespace

func Namespace() string

Namespace returns the namespace filter forced via the OSVC_NAMESPACE environment variable.

func NoLogFile

func NoLogFile() bool

func NoLogFileSetenvArg

func NoLogFileSetenvArg() string

Types

type ActionOrigin

type ActionOrigin string

func Origin

func Origin() ActionOrigin

Origin returns the action origin using a env var that the daemon sets when executing a CRM action.

func (ActionOrigin) Var

func (t ActionOrigin) Var() string

Var returns the arg to pass to environment variable setter functions to hint the called CRM command was launched from a daemon policy.

Jump to

Keyboard shortcuts

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