azure

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

View Source
const ProviderName = "azure"

ProviderName is the name of the Azure authentication provider.

Variables

This section is empty.

Functions

func NewTokenCredential added in v0.11.0

func NewTokenCredential(ctx context.Context, opts ...auth.Option) azcore.TokenCredential

NewTokenCredential creates a new token credential for the given options.

Types

type AKSClient added in v0.21.0

AKSClient provides the required methods of the AKS client.

type Environment added in v0.24.0

type Environment struct {
	ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix,omitempty"`
	ResourceManagerEndpoint    string `json:"resourceManagerEndpoint,omitempty"`
	TokenAudience              string `json:"tokenAudience,omitempty"`
}

Environment is used to read the Azure environment configuration from a JSON file, it is a subset of the struct defined in https://github.com/kubernetes-sigs/cloud-provider-azure/blob/e68bd888a7616d52f45f39238691f32821884120/pkg/azclient/cloud.go#L152-L185 with exact same field names and json annotations. We define this struct here for two reasons:

  1. We are not aware of any libraries we could import this struct from.
  2. We don't use all the fields defined in the original struct.

type Implementation added in v0.11.0

type Implementation interface {
	NewDefaultAzureCredential(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
	NewDefaultAzureCredentialWithoutShellOut(options *azidentity.DefaultAzureCredentialOptions) (azcore.TokenCredential, error)
	NewClientAssertionCredential(tenantID string, clientID string, getAssertion func(context.Context) (string, error), options *azidentity.ClientAssertionCredentialOptions) (azcore.TokenCredential, error)
	ExchangeAADAccessTokenForACRRefreshToken(ctx context.Context, client *azcontainerregistry.AuthenticationClient, grantType azcontainerregistry.PostContentSchemaGrantType, service string, options *azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenOptions) (azcontainerregistry.AuthenticationClientExchangeAADAccessTokenForACRRefreshTokenResponse, error)
	NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (AKSClient, error)
}

Implementation provides the required methods of the Azure libraries.

type Provider added in v0.11.0

type Provider struct{ Implementation }

Provider implements the auth.Provider interface for Azure authentication.

func (Provider) GetAccessTokenOptionsForArtifactRepository added in v0.21.0

func (p Provider) GetAccessTokenOptionsForArtifactRepository(artifactRepository string) ([]auth.Option, error)

GetAccessTokenOptionsForArtifactRepository implements auth.Provider.

func (Provider) GetAccessTokenOptionsForCluster added in v0.21.0

func (Provider) GetAccessTokenOptionsForCluster(opts ...auth.Option) ([][]auth.Option, error)

GetAccessTokenOptionsForCluster implements auth.Provider.

func (Provider) GetAudiences added in v0.21.0

GetAudiences implements auth.Provider.

func (Provider) GetIdentity added in v0.11.0

func (Provider) GetIdentity(serviceAccount corev1.ServiceAccount) (string, error)

GetIdentity implements auth.Provider.

func (Provider) GetName added in v0.11.0

func (Provider) GetName() string

GetName implements auth.Provider.

func (Provider) NewArtifactRegistryCredentials added in v0.12.0

func (p Provider) NewArtifactRegistryCredentials(ctx context.Context, registry string,
	accessToken auth.Token, opts ...auth.Option) (*auth.ArtifactRegistryCredentials, error)

NewArtifactRegistryCredentials implements auth.Provider.

func (Provider) NewControllerToken added in v0.12.0

func (p Provider) NewControllerToken(ctx context.Context, opts ...auth.Option) (auth.Token, error)

NewControllerToken implements auth.Provider.

func (Provider) NewRESTConfig added in v0.21.0

func (p Provider) NewRESTConfig(ctx context.Context, accessTokens []auth.Token,
	opts ...auth.Option) (*auth.RESTConfig, error)

NewRESTConfig implements auth.Provider.

func (Provider) NewTokenForServiceAccount added in v0.11.0

func (p Provider) NewTokenForServiceAccount(ctx context.Context, oidcToken string,
	serviceAccount corev1.ServiceAccount, opts ...auth.Option) (auth.Token, error)

NewTokenForServiceAccount implements auth.Provider.

func (Provider) ParseArtifactRepository added in v0.12.0

func (Provider) ParseArtifactRepository(artifactRepository string) (string, error)

ParseArtifactRepository implements auth.Provider. ParseArtifactRepository returns the ACR registry host.

type Token added in v0.11.0

type Token struct{ azcore.AccessToken }

Token is the Azure token.

func (*Token) GetDuration added in v0.11.0

func (t *Token) GetDuration() time.Duration

GetDuration implements auth.Token.

Jump to

Keyboard shortcuts

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