azure

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Group                  = "infrastructure.cluster.x-k8s.io"
	KindCluster            = "AzureCluster"
	VersionCluster         = "v1beta1"
	KindClusterIdentity    = "AzureClusterIdentity"
	VersionClusterIdentity = "v1beta1"
	ClientSecretKeyName    = "clientSecret"
)
View Source
const (
	LifecycleRuleName = "ExpirationLogging"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AzureAccessServiceAdapter

type AzureAccessServiceAdapter struct {
}

func NewAzureAccessService

func NewAzureAccessService() AzureAccessServiceAdapter

func (AzureAccessServiceAdapter) ConfigureRole

func (s AzureAccessServiceAdapter) ConfigureRole(ctx context.Context, bucket *v1alpha1.Bucket) error

func (AzureAccessServiceAdapter) DeleteRole

func (s AzureAccessServiceAdapter) DeleteRole(ctx context.Context, bucket *v1alpha1.Bucket) error

type AzureCluster

type AzureCluster struct {
	Client      client.Client
	Name        string
	Namespace   string
	BaseDomain  string
	Region      string
	Tags        map[string]string
	Credentials AzureCredentials
}

AzureCluster implements Cluster Interface with Azure data

func (AzureCluster) GetBaseDomain

func (c AzureCluster) GetBaseDomain() string

func (AzureCluster) GetCredentials

func (c AzureCluster) GetCredentials() cluster.Credentials

func (AzureCluster) GetName

func (c AzureCluster) GetName() string

func (AzureCluster) GetNamespace

func (c AzureCluster) GetNamespace() string

func (AzureCluster) GetRegion

func (c AzureCluster) GetRegion() string

func (AzureCluster) GetResourceGroup

func (c AzureCluster) GetResourceGroup() string

func (AzureCluster) GetTags

func (c AzureCluster) GetTags() map[string]string

type AzureClusterGetter

type AzureClusterGetter struct {
	Client            client.Client
	ManagementCluster flags.ManagementCluster
}

AzureClusterGetter implements ClusterGetter Interface It creates an AzureCluster object

func (AzureClusterGetter) GetCluster

func (c AzureClusterGetter) GetCluster(ctx context.Context) (cluster.Cluster, error)

type AzureCredentials

type AzureCredentials struct {
	ResourceGroup  string
	SubscriptionID string
	TypeIdentity   string
	ClientID       string
	TenantID       string
	SecretRef      corev1.Secret
}

type AzureObjectStorageAdapter

type AzureObjectStorageAdapter struct {
	// contains filtered or unexported fields
}

func NewAzureStorageService

func NewAzureStorageService(storageAccountClient *armstorage.AccountsClient, blobContainerClient *armstorage.BlobContainersClient, managementPoliciesClient *armstorage.ManagementPoliciesClient, logger logr.Logger, cluster AzureCluster, client client.Client) AzureObjectStorageAdapter

NewAzureStorageService creates a new instance of AzureObjectStorageAdapter. It takes in the necessary parameters to initialize the adapter and returns the created instance. The storageAccountClient, blobContainerClient, and managementPoliciesClient are clients for interacting with Azure storage resources. The logger is used for logging purposes. The cluster represents the Azure cluster. The client is the Kubernetes client used for interacting with the Kubernetes API. The listStorageAccountName is a list of storage account names.

func (AzureObjectStorageAdapter) ConfigureBucket

func (s AzureObjectStorageAdapter) ConfigureBucket(ctx context.Context, bucket *v1alpha1.Bucket) error

ConfigureBucket set lifecycle rules (expiration on blob) and tags on the Storage Container

func (AzureObjectStorageAdapter) CreateBucket

func (s AzureObjectStorageAdapter) CreateBucket(ctx context.Context, bucket *v1alpha1.Bucket) error

CreateBucket creates the Storage Account if it not exists AND the Storage Container CreateBucket creates a bucket in Azure Object Storage. It checks if the storage account exists, and if not, it creates it. Then, it creates a storage container within the storage account. Finally, it retrieves the access key for 'key1' and creates a K8S Secret to store the storage account access key. The Secret is created in the same namespace as the bucket. The function returns an error if any of the operations fail.

func (AzureObjectStorageAdapter) DeleteBucket

func (s AzureObjectStorageAdapter) DeleteBucket(ctx context.Context, bucket *v1alpha1.Bucket) error

DeleteBucket deletes the Storage Account (Storage Container will be deleted by cascade) Here, we decided to have a Storage Account dedicated to a Storage Container (relation 1 - 1) We want to prevent the Storage Account from being used by anyone

func (AzureObjectStorageAdapter) ExistsBucket

func (s AzureObjectStorageAdapter) ExistsBucket(ctx context.Context, bucket *v1alpha1.Bucket) (bool, error)

ExistsBucket checks if a bucket exists in the Azure Object Storage. It first checks if the storage account exists on Azure. If the storage account does not exist, it means the bucket does not exist either, so it returns false. If the storage account exists, it then checks if the BlobContainer with the specified name exists in the storage account. If the BlobContainer does not exist, it returns false. Otherwise, it returns true.

type AzureObjectStorageService

type AzureObjectStorageService struct {
}

func (AzureObjectStorageService) NewAccessRoleService

func (s AzureObjectStorageService) NewAccessRoleService(ctx context.Context, logger logr.Logger, cluster cluster.Cluster) (objectstorage.AccessRoleService, error)

func (AzureObjectStorageService) NewObjectStorageService

func (s AzureObjectStorageService) NewObjectStorageService(ctx context.Context, logger logr.Logger, cluster cluster.Cluster, client client.Client) (objectstorage.ObjectStorageService, error)

Jump to

Keyboard shortcuts

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