config

package
v0.0.0-...-67ec6ba Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package config manages loading configuration from environment and command-line params

Package config manages loading configuration from environment and command-line params

Index

Constants

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

	OperatorModeBoth = OperatorModeWatchers | OperatorModeWebhooks
)

Variables

This section is empty.

Functions

func AddFlags

func AddFlags() error

AddFlags adds flags applicable to all services. Remember to call `flag.Parse()` in your main or TestMain.

func AppendRandomSuffix

func AppendRandomSuffix(prefix string) string

AppendRandomSuffix will append a suffix of five random characters to the specified prefix.

func AuthorizationServerURL

func AuthorizationServerURL() string

AuthorizationServerURL is the OAuth authorization server URL. Q: Can this be gotten from the `azure.Environment` in `Environment()`?

func BaseURI

func BaseURI() string

Base URI for provisioning

func ConfigString

func ConfigString() string

ConfigString returns the parts of the configuration file with are not secrets as a string for easy logging

func DefaultLocation

func DefaultLocation() string

DefaultLocation returns the default location wherein to create new resources. Some resource types are not available in all locations so another location might need to be chosen.

func Environment

func Environment() *azure.Environment

Environment returns an `azure.Environment{...}` for the current cloud.

func KeepResources

func KeepResources() bool

KeepResources specifies whether to keep resources created by samples.

func Location

func Location() string

deprecated: use DefaultLocation() instead Location returns the Azure location to be utilized.

func ParseBoolFromEnvironment

func ParseBoolFromEnvironment(variable string, defaultValue bool) bool

func ParseEnvironment

func ParseEnvironment() error

ParseEnvironment loads a sibling `.env` file then looks through all environment variables to set global configuration.

func ParseIntFromEnvironment

func ParseIntFromEnvironment(variable string) (int, error)

func ParseStringListFromEnvironment

func ParseStringListFromEnvironment(variable string) []string

func PodNamespace

func PodNamespace() string

PodNamespace returns the namespace the manager pod is running in

func PurgeDeletedKeyVaultSecrets

func PurgeDeletedKeyVaultSecrets() bool

PurgeDeletedKeyVaultSecrets determines if the operator should issue a secret Purge request in addition to Delete when deleting secrets in Azure Key Vault. This only applies to secrets that are stored in Azure Key Vault. It does nothing if the secret is stored in Kubernetes.

func RecoverSoftDeletedKeyVaultSecrets

func RecoverSoftDeletedKeyVaultSecrets() bool

RecoverSoftDeletedKeyVaultSecrets determines if the operator should issue a secret Recover request when it encounters an "ObjectIsDeletedButRecoverable" error from Azure Key Vault during secret creation. This error can occur when a Key Vault has soft delete enabled and an ASO resource was deleted and recreated with the same name. This only applies to secrets that are stored in Azure Key Vault. It does nothing if the secret is stored in Kubernetes.

func SecretNamingVersion

func SecretNamingVersion() secrets.SecretNamingVersion

SecretNamingVersion is the version of secret naming that the operator uses

func TargetNamespaces

func TargetNamespaces() []string

TargetNamespaces returns the namespaces the operator should watch for resources.

func TestResourcePrefix

func TestResourcePrefix() string

TestResourcePrefix specifies a string to prefix test resources with

func UseDeviceFlow

func UseDeviceFlow() bool

UseDeviceFlow specifies if interactive auth should be used. Interactive auth uses the OAuth Device Flow grant type.

func UserAgent

func UserAgent() string

UserAgent specifies a string to append to the agent identifier.

Types

type ConfigRequirementType

type ConfigRequirementType int
const (
	RequireClientID ConfigRequirementType = iota
	RequireClientSecret
	RequireTenantID
	RequireSubscriptionID
	OptionalClientID
)

func GetExpectedConfigurationVariables

func GetExpectedConfigurationVariables() []ConfigRequirementType

type Credentials

type Credentials interface {
	ClientID() string
	ClientSecret() string
	TenantID() string
	SubscriptionID() string
	UseManagedIdentity() bool
	OperatorKeyvault() string

	WithSubscriptionID(subscriptionID string) Credentials
}

Credentials is a read-only holder for information needed to authenticate to ARM.

func GlobalCredentials

func GlobalCredentials() Credentials

GlobalCredentials returns the configured credentials. TODO: get rid of all uses of this.

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 SelectedMode

func SelectedMode() OperatorMode

SelectedMode returns the mode configuration for the operator.

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.

Jump to

Keyboard shortcuts

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