Documentation
¶
Index ¶
- Constants
- func IsIMDSAvailable(ctx context.Context) bool
- func NewClientCertificateCredential(tenantID string, clientID string, clientCertificate, password []byte, ...) (*azidentity.ClientCertificateCredential, error)
- func ResolveFederatedTokenFilePath(override string) string
- type Credential
- func (c *Credential) AdditionalTenants() []string
- func (c *Credential) CloudConfig() *cloud.Configuration
- func (c *Credential) CredentialFrom() types.NamespacedName
- func (c *Credential) SecretsEqual(other *Credential) bool
- func (c *Credential) SubscriptionID() string
- func (c *Credential) TokenCredential() azcore.TokenCredential
- type CredentialProvider
- type CredentialProviderOptions
- type ServiceAccountTokenProvider
- type TokenCredentialProvider
Constants ¶
const ( // #nosec NamespacedSecretName = "aso-credential" // #nosec FederatedTokenFilePath = "/var/run/secrets/tokens/azure-identity" DefaultWorkloadIdentityServiceAccount = "aso-workload" )
Variables ¶
This section is empty.
Functions ¶
func IsIMDSAvailable ¶
IsIMDSAvailable reports whether the Azure Instance Metadata Service answers within one second. Any HTTP response counts as available. A timeout or connection error does not.
func NewClientCertificateCredential ¶
func NewClientCertificateCredential( tenantID string, clientID string, clientCertificate, password []byte, options *azidentity.ClientCertificateCredentialOptions, ) (*azidentity.ClientCertificateCredential, error)
func ResolveFederatedTokenFilePath ¶
ResolveFederatedTokenFilePath returns the path to the projected federated token file used for Workload Identity authentication. It honours override when non-empty (whitespace-trimmed), falling back to the default FederatedTokenFilePath otherwise. override is expected to come from config.Values.FederatedTokenFilePath (read once, from AZURE_FEDERATED_TOKEN_FILE, alongside the rest of the operator's configuration).
Types ¶
type Credential ¶
type Credential struct {
// contains filtered or unexported fields
}
Credential describes a credential used to connect to Azure
func NewDefaultCredential ¶
func NewDefaultCredential( tokenCred azcore.TokenCredential, namespace string, subscriptionID string, additionalTenants []string, ) *Credential
NewDefaultCredential creates a Credential representing the default/global credential from aso-controller-settings.
func (*Credential) AdditionalTenants ¶ added in v2.13.0
func (c *Credential) AdditionalTenants() []string
func (*Credential) CloudConfig ¶ added in v2.18.0
func (c *Credential) CloudConfig() *cloud.Configuration
func (*Credential) CredentialFrom ¶
func (c *Credential) CredentialFrom() types.NamespacedName
func (*Credential) SecretsEqual ¶
func (c *Credential) SecretsEqual(other *Credential) bool
func (*Credential) SubscriptionID ¶
func (c *Credential) SubscriptionID() string
func (*Credential) TokenCredential ¶
func (c *Credential) TokenCredential() azcore.TokenCredential
type CredentialProvider ¶
type CredentialProvider interface {
GetCredential(ctx context.Context, obj genruntime.MetaObject) (*Credential, error)
}
func NewCredentialProvider ¶
func NewCredentialProvider( globalCredential *Credential, kubeClient kubeclient.Client, opts *CredentialProviderOptions, ) CredentialProvider
type CredentialProviderOptions ¶ added in v2.8.0
type CredentialProviderOptions struct {
TokenProvider TokenCredentialProvider
ServiceAccountTokenProvider ServiceAccountTokenProvider
WorkloadIdentityAuthMode internalconfig.WorkloadIdentityAuthMode
Cloud *cloud.Configuration
AllowMultiEnvManagement bool
// FederatedTokenFilePath overrides the default projected token file path used for per-credential
// Workload Identity authentication (see ResolveFederatedTokenFilePath). Typically sourced from
// config.Values.FederatedTokenFilePath.
FederatedTokenFilePath string
}
type ServiceAccountTokenProvider ¶
type ServiceAccountTokenProvider interface {
GetAssertion(
ctx context.Context,
namespace string,
serviceAccountName string,
audience string,
requestedLifetime time.Duration,
) (string, error)
}
func NewServiceAccountTokenProvider ¶
func NewServiceAccountTokenProvider(kubeClient kubeclient.Client, clk clock.Clock) ServiceAccountTokenProvider
type TokenCredentialProvider ¶ added in v2.8.0
type TokenCredentialProvider interface {
NewClientSecretCredential(
tenantID string,
clientID string,
clientSecret string,
options *azidentity.ClientSecretCredentialOptions,
) (*azidentity.ClientSecretCredential, error)
NewClientCertificateCredential(
tenantID string,
clientID string,
clientCertificate,
password []byte,
options *azidentity.ClientCertificateCredentialOptions,
) (*azidentity.ClientCertificateCredential, error)
NewManagedIdentityCredential(options *azidentity.ManagedIdentityCredentialOptions) (*azidentity.ManagedIdentityCredential, error)
NewWorkloadIdentityCredential(options *azidentity.WorkloadIdentityCredentialOptions) (*azidentity.WorkloadIdentityCredential, error)
NewUserAssignedIdentityCredentials(ctx context.Context, credentialPath string, opts ...dataplane.Option) (azcore.TokenCredential, error)
NewClientAssertionCredential(
tenantID string,
clientID string,
getAssertion func(context.Context) (string, error),
options *azidentity.ClientAssertionCredentialOptions,
) (*azidentity.ClientAssertionCredential, error)
}
func DefaultTokenCredentialProvider ¶ added in v2.8.0
func DefaultTokenCredentialProvider() TokenCredentialProvider