config

package
v2.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperatorModeWatchers = OperatorMode(1 << iota)
	OperatorModeWebhooks

	OperatorModeBoth = OperatorModeWatchers | OperatorModeWebhooks
)

Variables

View Source
var (
	DefaultEndpoint         = "https://management.azure.com"
	DefaultAudience         = "https://management.core.windows.net/"
	DefaultAADAuthorityHost = "https://login.microsoftonline.com/"
)

Functions

This section is empty.

Types

type OperatorMode

type OperatorMode int

OperatorMode determines whether we'll run watchers and/or webhooks.

func ParseOperatorMode

func ParseOperatorMode(value string) (OperatorMode, error)

ParseOperatorMode converts a string value into the corresponding operator mode.

func (OperatorMode) IncludesWatchers

func (m OperatorMode) IncludesWatchers() bool

IncludesWatchers returns whether an operator running in this mode should register reconcilers.

func (OperatorMode) IncludesWebhooks

func (m OperatorMode) IncludesWebhooks() bool

IncludesWebhooks returns whether an operator running in this mode should register webhooks.

func (OperatorMode) String

func (m OperatorMode) String() string

String converts the mode into a readable value.

type Values

type Values struct {
	// SubscriptionID is the Azure subscription the operator will use
	// for ARM communication.
	SubscriptionID string

	// TenantID is the Azure tenantID the operator will use
	// for ARM communication.
	TenantID string

	// ClientID is the Azure clientID the operator will use
	// for ARM communication.
	ClientID string

	// PodNamespace is the namespace the operator pods are running in.
	PodNamespace string

	// OperatorMode determines whether the operator should run
	// watchers, webhooks or both.
	OperatorMode OperatorMode

	// TargetNamespaces lists the namespaces the operator will watch
	// for Azure resources (if the mode includes running watchers). If
	// it's empty the operator will watch all namespaces.
	TargetNamespaces []string

	// SyncPeriod is the frequency at which resources are re-reconciled with Azure
	// when there have been no triggering changes in the Kubernetes resources. This sync
	// exists to detect and correct changes that happened in Azure that Kubernetes is not
	// aware about. BE VERY CAREFUL setting this value low - even a modest number of resources
	// can cause subscription level throttling if they are re-synced frequently.
	// If nil, no sync is performed. Durations are specified as "1h", "15m", or "60s". See
	// https://pkg.go.dev/time#ParseDuration for more details.
	//
	// This can be set to nil by specifying empty string for AZURE_SYNC_PERIOD explicitly in
	// the config.
	SyncPeriod *time.Duration

	// ResourceManagerEndpoint is the Azure Resource Manager endpoint.
	// If not specified, the default is the Public cloud resource manager endpoint.
	// See https://docs.microsoft.com/cli/azure/manage-clouds-azure-cli#list-available-clouds for details
	// about how to find available resource manager endpoints for your cloud. Note that the resource manager
	// endpoint is referred to as "resourceManager" in the Azure CLI.
	ResourceManagerEndpoint string

	// ResourceManagerAudience is the Azure Resource Manager AAD audience.
	// If not specified, the default is the Public cloud resource manager audience https://management.core.windows.net/.
	// See https://docs.microsoft.com/cli/azure/manage-clouds-azure-cli#list-available-clouds for details
	// about how to find available resource manager audiences for your cloud. Note that the resource manager
	// audience is referred to as "activeDirectoryResourceId" in the Azure CLI.
	ResourceManagerAudience string

	// AzureAuthorityHost is the URL of the AAD authority. If not specified, the default
	// is the AAD URL for the public cloud: https://login.microsoftonline.com/. See
	// https://docs.microsoft.com/azure/active-directory/develop/authentication-national-cloud
	AzureAuthorityHost string

	// UseWorkloadIdentityAuth boolean is used to determine if we're using Workload Identity authentication for global credential
	UseWorkloadIdentityAuth bool

	// UserAgentSuffix is appended to the default User-Agent for Azure HTTP clients.
	UserAgentSuffix string
}

Values stores configuration values that are set for the operator.

func ReadAndValidate

func ReadAndValidate() (Values, error)

ReadAndValidate loads the configuration values and checks that they're consistent.

func ReadFromEnvironment

func ReadFromEnvironment() (Values, error)

ReadFromEnvironment loads configuration values from the AZURE_* environment variables.

func (Values) Cloud

func (v Values) Cloud() cloud.Configuration

Cloud returns the cloud the configuration is using

func (Values) String

func (v Values) String() string

Returns the configuration as a string

func (Values) Validate

func (v Values) Validate() error

Validate checks whether the configuration settings are consistent.

Jump to

Keyboard shortcuts

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