azureutil

package
v0.1.72 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateEnvVarsForAzureManagedIdentity added in v0.1.52

func CreateEnvVarsForAzureManagedIdentity(azureCredentialsName string) []corev1.EnvVar

func CreateVolumeForAzureSecretStoreProviderClass added in v0.1.52

func CreateVolumeForAzureSecretStoreProviderClass(secretStoreVolumeName, secretProviderClassName string) corev1.Volume

func CreateVolumeMountForAzureSecretStoreProviderClass added in v0.1.52

func CreateVolumeMountForAzureSecretStoreProviderClass(secretStoreVolumeName string) corev1.VolumeMount

func CreateVolumeMountForKMSAzureSecretStoreProviderClass added in v0.1.58

func CreateVolumeMountForKMSAzureSecretStoreProviderClass(secretStoreVolumeName string) corev1.VolumeMount

func GetAzureCloudConfiguration added in v0.1.70

func GetAzureCloudConfiguration(cloudName string) (cloud.Configuration, error)

GetAzureCloudConfiguration converts a cloud name string to the Azure SDK cloud.Configuration. This function maps the cloud names used in the HyperShift API to the corresponding Azure SDK cloud configurations. Valid cloud names are: AzurePublicCloud, AzureUSGovernmentCloud, AzureChinaCloud, and empty string (defaults to AzurePublicCloud). Returns an error if the cloud name is not recognized.

func GetKeyVaultAuthorizedUser added in v0.1.50

func GetKeyVaultAuthorizedUser() string

func GetKeyVaultDNSSuffixFromCloudType added in v0.1.58

func GetKeyVaultDNSSuffixFromCloudType(cloud string) (string, error)

GetKeyVaultDNSSuffixFromCloudType simply mimics the functionality in environments.go from the Azure SDK, github.com/Azure/go-autorest. This function is used to get the DNS suffix for the Key Vault based on the cloud type.

func GetNameAndResourceGroupFromNetworkSecurityGroupID

func GetNameAndResourceGroupFromNetworkSecurityGroupID(nsgID string) (string, string, error)

GetNameAndResourceGroupFromNetworkSecurityGroupID extracts the network security group (nsg) name and its resourrce group name from a nsg ID Example nsg ID: /subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/networkSecurityGroups/<nsgName>

func GetNetworkSecurityGroupInfo added in v0.1.53

func GetNetworkSecurityGroupInfo(ctx context.Context, nsgID string, subscriptionID string, azureCreds azcore.TokenCredential) (armnetwork.SecurityGroupsClientGetResponse, error)

GetNetworkSecurityGroupInfo gets the full information on a network security group based on its ID

func GetResourceGroupInfo added in v0.1.53

func GetResourceGroupInfo(ctx context.Context, rgName string, subscriptionID string, azureCreds azcore.TokenCredential) (armresources.ResourceGroupsClientGetResponse, error)

GetResourceGroupInfo gets the full information on a resource group based on its name

func GetServicePrincipalScopes added in v0.1.58

func GetServicePrincipalScopes(subscriptionID, managedResourceGroupName, nsgResourceGroupName, vnetResourceGroupName, dnsZoneResourceGroupName, component string, assignCustomHCPRoles bool) (string, []string)

func GetSubnetNameFromSubnetID

func GetSubnetNameFromSubnetID(subnetID string) (string, error)

GetSubnetNameFromSubnetID extracts the subnet name from a subnet ID Example subnet ID: /subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>/subnets/<subnetName>

func GetVnetInfoFromVnetID

func GetVnetInfoFromVnetID(ctx context.Context, vnetID string, subscriptionID string, azureCreds azcore.TokenCredential) (armnetwork.VirtualNetworksClientGetResponse, error)

GetVnetInfoFromVnetID extracts the full information on a VNET from a VNET ID by first getting the VNET name and its resource group's name and then using those parameters to query the full information on the VNET using Azure's SDK

func GetVnetNameAndResourceGroupFromVnetID

func GetVnetNameAndResourceGroupFromVnetID(vnetID string) (string, string, error)

GetVnetNameAndResourceGroupFromVnetID extracts the VNET name and its resource group from a VNET ID Example VNET ID: /subscriptions/<subscriptionID>/resourceGroups/<resourceGroupName>/providers/Microsoft.Network/virtualNetworks/<vnetName>

func IsAroHCP added in v0.1.50

func IsAroHCP() bool

IsAroHCP returns true if the managed service environment variable is set to ARO-HCP

func IsSelfManagedAzure added in v0.1.69

func IsSelfManagedAzure(platform hyperv1.PlatformType) bool

IsSelfManagedAzure returns true when the platform is Azure and the managed service is not ARO-HCP

func ReconcileAzureCredentials added in v0.1.69

func ReconcileAzureCredentials(
	ctx context.Context,
	client client.Client,
	createOrUpdate upsert.CreateOrUpdateFN,
	baseSecretData map[string][]byte,
	configs []AzureCredentialConfig,
	capabilities *hyperv1.Capabilities,
) []error

ReconcileAzureCredentials creates or updates Azure credential secrets based on the provided configurations

func SetAsAroHCPTest added in v0.1.66

func SetAsAroHCPTest(t *testing.T)

SetAsAroHCPTest sets the proper environment variable for the test, designating this is an ARO-HCP environment

Types

type AzureCredentialConfig added in v0.1.69

type AzureCredentialConfig struct {
	Name              string
	ManifestFunc      func() *corev1.Secret
	ClientID          string
	CapabilityChecker func(*hyperv1.Capabilities) bool
	ErrorContext      string
}

AzureCredentialConfig defines the configuration for creating an Azure credential secret

type AzureEncryptionKey added in v0.1.69

type AzureEncryptionKey struct {
	KeyVaultName string
	KeyName      string
	KeyVersion   string
}

AzureEncryptionKey represents the information needed to access an encryption key in Azure Key Vault This information comes from the encryption key ID, which is in the form of https://<vaultName>.vault.azure.net/keys/<keyName>/<keyVersion>

func GetAzureEncryptionKeyInfo added in v0.1.69

func GetAzureEncryptionKeyInfo(encryptionKeyID string) (*AzureEncryptionKey, error)

GetAzureEncryptionKeyInfo extracts the key vault name, key name, and key version from an encryption key ID The encryption key ID is in the form of https://<vaultName>.vault.azure.net/keys/<keyName>/<keyVersion>

Jump to

Keyboard shortcuts

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