Documentation
¶
Index ¶
- Constants
- func ClientDebugLoggerMiddleware(log *logrus.Entry) policy.Policy
- func DBAccountName() (string, error)
- func DBName(c Core) (string, error)
- func FeatureStrings() []string
- func IsCI() bool
- func IsLocalDevelopmentMode() bool
- func LoggerForService(service ServiceName, logger *logrus.Entry) *logrus.Entry
- func MockMSIResponses(aadHost string, msiResourceId *arm.ResourceID) dataplane.ClientFactory
- func ValidateVars(vars ...string) error
- type ARMHelper
- type CertificateRefresher
- type Core
- type Feature
- type Interface
- type MSIContext
- type ServiceName
Constants ¶
const ( RPDevARMSecretName = "dev-arm" RPFirstPartySecretName = "rp-firstparty" RPServerSecretName = "rp-server" ClusterLoggingSecretName = "cluster-mdsd" EncryptionSecretName = "encryption-key" EncryptionSecretV2Name = "encryption-key-v2" FrontendEncryptionSecretName = "fe-encryption-key" FrontendEncryptionSecretV2Name = "fe-encryption-key-v2" PortalServerSecretName = "portal-server" PortalServerClientSecretName = "portal-client" PortalServerSessionKeySecretName = "portal-session-key" PortalServerSSHKeySecretName = "portal-sshkey" ClusterKeyvaultSuffix = "-cls" GatewayKeyvaultSuffix = "-gwy" PortalKeyvaultSuffix = "-por" ServiceKeyvaultSuffix = "-svc" ClusterMsiKeyVaultSuffix = "-msi" RPPrivateEndpointPrefix = "rp-pe-" ProxyHostName = "PROXY_HOSTNAME" )
const ( EnvDatabaseName = "DATABASE_NAME" EnvDatabaseAccountName = "DATABASE_ACCOUNT_NAME" )
const ( KeyvaultPrefix = "KEYVAULT_PREFIX" OIDCAFDEndpoint = "OIDC_AFD_ENDPOINT" OIDCStorageAccountName = "OIDC_STORAGE_ACCOUNT_NAME" OtelAuditQueueSize = "OTEL_AUDIT_QUEUE_SIZE" ARMCABundlePath = "/etc/aro-rp/arm-ca-bundle.pem" AdminCABundlePath = "/etc/aro-rp/admin-ca-bundle.pem" )
const EnvUseWorkloadIdentity = "ARO_RP_WORKLOAD_IDENTITY"
const (
)
Variables ¶
This section is empty.
Functions ¶
func DBAccountName ¶
Fetch the database account name from the environment.
func FeatureStrings ¶
func FeatureStrings() []string
FeatureStrings returns a slice of all String values of the enum
func IsLocalDevelopmentMode ¶
func IsLocalDevelopmentMode() bool
func LoggerForService ¶
func LoggerForService(service ServiceName, logger *logrus.Entry) *logrus.Entry
func MockMSIResponses ¶
func MockMSIResponses(aadHost string, msiResourceId *arm.ResourceID) dataplane.ClientFactory
func ValidateVars ¶
ValidateVars iterates over all the elements of vars and if it does not exist an environment variable with that name, it will return an error. Otherwise it returns nil.
Types ¶
type CertificateRefresher ¶
type CertificateRefresher interface {
Start(context.Context) error
GetCertificates() (*rsa.PrivateKey, []*x509.Certificate)
}
type Core ¶
type Core interface {
IsLocalDevelopmentMode() bool
IsCI() bool
NewMSITokenCredential() (azcore.TokenCredential, error)
NewMSIAuthorizer(scope string) (autorest.Authorizer, error)
NewLiveConfigManager(context.Context) (liveconfig.Manager, error)
instancemetadata.InstanceMetadata
Service() string
Logger() *logrus.Entry
LoggerForComponent(string) *logrus.Entry
// for ease of faking, load time in a consistent place everywhere
Now() time.Time
}
Core collects basic configuration information which is expected to be available on any PROD service VMSS (i.e. instance metadata, MSI authorizer, etc.)
func NewCoreForCI ¶
NewCoreForCI returns an env.Core which respects RP_MODE but always uses AZURE_* environment variables instead of IMDS. This is used for entrypoints which may run on CI VMs. CI VMs don't currently have MSI and hence cannot resolve their tenant ID, and also may access resources in a different tenant (e.g. AME).
type Feature ¶
type Feature int
const ( FeatureDisableDenyAssignments Feature = iota FeatureDisableSignedCertificates FeatureEnableDevelopmentAuthorizer FeatureRequireD2sWorkers FeatureDisableReadinessDelay FeatureRequireOIDCStorageWebEndpoint FeatureUseMockMsiRp FeatureEnableMISE FeatureEnforceMISE // Expanded Availability Zones are AZs in zonal regions above 3. This // affects whether we allow it for created clusters, it does not affect the // RP's deployments. FeatureEnableClusterExpandedAvailabilityZones )
RP Features are boolean options with defined on/off behaviour that is required at the RP level. Most of them are only relevant for development environments.
func FeatureString ¶
FeatureString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.
func (Feature) IsAFeature ¶
IsAFeature returns "true" if the value is listed in the enum definition. "false" otherwise
type Interface ¶
type Interface interface {
Core
proxy.Dialer
ARMHelper
InitializeAuthorizers() error
ArmClientAuthorizer() clientauthorizer.ClientAuthorizer
AdminClientAuthorizer() clientauthorizer.ClientAuthorizer
MISEAuthorizer() miseadapter.MISEAdapter
ClusterGenevaLoggingAccount() string
ClusterGenevaLoggingConfigVersion() string
ClusterGenevaLoggingEnvironment() string
ClusterGenevaLoggingNamespace() string
ClusterGenevaLoggingSecret() (*rsa.PrivateKey, *x509.Certificate)
ClusterKeyvault() azsecrets.Client
ClusterMsiKeyVaultName() string
Domain() string
FeatureIsSet(Feature) bool
// TODO: Delete FPAuthorizer once the replace from track1 to track2 is done.
FPAuthorizer(string, []string, ...string) (autorest.Authorizer, error)
FPNewClientCertificateCredential(string, []string) (*azidentity.ClientCertificateCredential, error)
FPClientID() string
Listen() (net.Listener, error)
GatewayDomains() []string
GatewayResourceGroup() string
ServiceKeyvault() azsecrets.Client
ACRResourceID() string
ACRDomain() string
OIDCStorageAccountName() string
OIDCEndpoint() string
OIDCKeyBitSize() int
OtelAuditQueueSize() (int, error)
MsiRpEndpoint() string
MsiDataplaneClientOptions(correlationData *api.CorrelationData) (*policy.ClientOptions, error)
MockMSIResponses(msiResourceId *arm.ResourceID) dataplane.ClientFactory
AROOperatorImage() string
LiveConfig() liveconfig.Manager
ClusterCertificates() azcertificates.Client
}
Interface is clunky and somewhat legacy and only used in the RP codebase (not monitor/portal/gateway, etc.). It is a grab-bag of items which modify RP behaviour depending on where it is running (dev, prod, etc.) Outside of the RP codebase, use Core. Ideally we might break Interface into smaller pieces, either closer to their point of use, or maybe using dependency injection. Try to remove methods, not add more. A refactored approach to configuration is generally necessary across all of the ARO services; dealing with Interface should be part of that.
type MSIContext ¶
type MSIContext string
const ( MSIContextRP MSIContext = "RP" MSIContextGateway MSIContext = "GATEWAY" )
type ServiceName ¶
type ServiceName string
ServiceName is the name of the runtime service (e.g. gateway, monitor)
const ( SERVICE_RP ServiceName = "RP" SERVICE_GATEWAY ServiceName = "GATEWAY" SERVICE_MONITOR ServiceName = "MONITOR" SERVICE_OPERATOR ServiceName = "OPERATOR" SERVICE_MIRROR ServiceName = "MIRROR" SERVICE_PORTAL ServiceName = "PORTAL" SERVICE_UPDATE_OCP_VERSIONS ServiceName = "UPDATE_OCP_VERSIONS" SERVICE_UPDATE_ROLE_SETS ServiceName = "UPDATE_ROLE_SETS" SERVICE_DEPLOY ServiceName = "DEPLOY" SERVICE_TOOLING ServiceName = "TOOLING" SERVICE_MIMO_SCHEDULER ServiceName = "MIMO_SCHEDULER" SERVICE_MIMO_ACTUATOR ServiceName = "MIMO_ACTUATOR" SERVICE_E2E ServiceName = "E2E" )