azure

package
v1.4.15 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: Apache-2.0 Imports: 37 Imported by: 22

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHyperVGenerationVersion

func GetHyperVGenerationVersion(capabilities map[string]string, imageHyperVGen string) (string, error)

GetHyperVGenerationVersion returns a HyperVGeneration version compatible with that of the image's. If imageHyperVGen is empty, it returns the highest supported version.

func GetHyperVGenerationVersions

func GetHyperVGenerationVersions(capabilities map[string]string) (sets.Set[string], error)

GetHyperVGenerationVersions returns all the HyperVGeneration versions supported by the instance type according to its capabilities as a string set V = {"V1", "V2", ...}

func GetVMNetworkingCapability

func GetVMNetworkingCapability(capabilities map[string]string) bool

GetVMNetworkingCapability returns true if Accelerated networking is supported by the instance type according to its capabilities or false, otherwise

func Platform

func Platform() (*azure.Platform, error)

Platform collects azure-specific configuration.

func Validate

func Validate(client API, ic *types.InstallConfig) error

Validate executes platform-specific validation.

func ValidateDiskEncryptionSet

func ValidateDiskEncryptionSet(client API, ic *types.InstallConfig) field.ErrorList

ValidateDiskEncryptionSet ensures the disk encryption set exists and is valid.

func ValidateForProvisioning

func ValidateForProvisioning(client API, ic *types.InstallConfig) error

ValidateForProvisioning validates if the install config is valid for provisioning the cluster.

func ValidateInstanceType

func ValidateInstanceType(client API, fieldPath *field.Path, region, instanceType, diskType string, req resourceRequirements, ultraSSDEnabled bool, vmNetworkingType string, icZones []string, architecture types.Architecture, securityType aztypes.SecurityTypes) field.ErrorList

ValidateInstanceType ensures the instance type has sufficient Vcpu, Memory, and a valid family type.

func ValidatePublicDNS

func ValidatePublicDNS(ic *types.InstallConfig, azureDNS *DNSConfig) error

ValidatePublicDNS checks DNS for CNAME, A, and AAA records for api.zoneName. If a record exists, it's likely a cluster already exists.

func ValidateSecurityProfileDiskEncryptionSet added in v0.9.153

func ValidateSecurityProfileDiskEncryptionSet(client API, ic *types.InstallConfig) field.ErrorList

ValidateSecurityProfileDiskEncryptionSet ensures the security profile disk encryption set exists and is valid.

Types

type API

type API interface {
	GetVirtualNetwork(ctx context.Context, resourceGroupName, virtualNetwork string) (*aznetwork.VirtualNetwork, error)
	GetComputeSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subnet string) (*aznetwork.Subnet, error)
	GetControlPlaneSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subnet string) (*aznetwork.Subnet, error)
	ListLocations(ctx context.Context) (*[]azsubs.Location, error)
	GetResourcesProvider(ctx context.Context, resourceProviderNamespace string) (*azres.Provider, error)
	GetVirtualMachineSku(ctx context.Context, name, region string) (*azsku.ResourceSku, error)
	GetVirtualMachineFamily(ctx context.Context, name, region string) (string, error)
	GetDiskSkus(ctx context.Context, region string) ([]azsku.ResourceSku, error)
	GetGroup(ctx context.Context, groupName string) (*azres.Group, error)
	ListResourceIDsByGroup(ctx context.Context, groupName string) ([]string, error)
	GetStorageEndpointSuffix(ctx context.Context) (string, error)
	GetDiskEncryptionSet(ctx context.Context, subscriptionID, groupName string, diskEncryptionSetName string) (*azenc.DiskEncryptionSet, error)
	GetHyperVGenerationVersion(ctx context.Context, instanceType string, region string, imageHyperVGen string) (string, error)
	GetMarketplaceImage(ctx context.Context, region, publisher, offer, sku, version string) (azenc.VirtualMachineImage, error)
	AreMarketplaceImageTermsAccepted(ctx context.Context, publisher, offer, sku string) (bool, error)
	GetVMCapabilities(ctx context.Context, instanceType, region string) (map[string]string, error)
	GetAvailabilityZones(ctx context.Context, region string, instanceType string) ([]string, error)
	GetLocationInfo(ctx context.Context, region string, instanceType string) (*azenc.ResourceSkuLocationInfo, error)
}

API represents the calls made to the API.

type AuthenticationType added in v0.9.153

type AuthenticationType int

AuthenticationType identifies the authentication method used.

const (
	ClientSecretAuth AuthenticationType = iota
	ClientCertificateAuth
	ManagedIdentityAuth
)

The authentication types supported by the installer.

type Client

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

Client makes calls to the Azure API.

func NewClient

func NewClient(ssn *Session) *Client

NewClient initializes a client with a session.

func (*Client) AreMarketplaceImageTermsAccepted

func (c *Client) AreMarketplaceImageTermsAccepted(ctx context.Context, publisher, offer, sku string) (bool, error)

AreMarketplaceImageTermsAccepted tests whether the terms have been accepted for the specified marketplace VM image.

func (*Client) GetAvailabilityZones

func (c *Client) GetAvailabilityZones(ctx context.Context, region string, instanceType string) ([]string, error)

GetAvailabilityZones retrieves a list of availability zones for the given region, and instance type.

func (*Client) GetComputeSubnet

func (c *Client) GetComputeSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subNetwork string) (*aznetwork.Subnet, error)

GetComputeSubnet gets the Azure compute subnet

func (*Client) GetControlPlaneSubnet

func (c *Client) GetControlPlaneSubnet(ctx context.Context, resourceGroupName, virtualNetwork, subNetwork string) (*aznetwork.Subnet, error)

GetControlPlaneSubnet gets the Azure control plane subnet

func (*Client) GetDiskEncryptionSet

func (c *Client) GetDiskEncryptionSet(ctx context.Context, subscriptionID, groupName, diskEncryptionSetName string) (*azenc.DiskEncryptionSet, error)

GetDiskEncryptionSet retrieves the specified disk encryption set.

func (*Client) GetDiskSkus

func (c *Client) GetDiskSkus(ctx context.Context, region string) ([]azsku.ResourceSku, error)

GetDiskSkus returns all the disk SKU pages for a given region.

func (*Client) GetGroup

func (c *Client) GetGroup(ctx context.Context, groupName string) (*azres.Group, error)

GetGroup returns resource group for the groupName.

func (*Client) GetHyperVGenerationVersion

func (c *Client) GetHyperVGenerationVersion(ctx context.Context, instanceType string, region string, imageHyperVGen string) (version string, err error)

GetHyperVGenerationVersion gets the HyperVGeneration version for the given instance type and marketplace image version, if specified. Defaults to V2 if either V1 or V2 available.

func (*Client) GetLocationInfo

func (c *Client) GetLocationInfo(ctx context.Context, region string, instanceType string) (*azenc.ResourceSkuLocationInfo, error)

GetLocationInfo retrieves the location info associated with the instance type in region

func (*Client) GetMarketplaceImage

func (c *Client) GetMarketplaceImage(ctx context.Context, region, publisher, offer, sku, version string) (azenc.VirtualMachineImage, error)

GetMarketplaceImage get the specified marketplace VM image.

func (*Client) GetResourcesProvider

func (c *Client) GetResourcesProvider(ctx context.Context, resourceProviderNamespace string) (*azres.Provider, error)

GetResourcesProvider gets the Azure resource provider

func (*Client) GetStorageEndpointSuffix

func (c *Client) GetStorageEndpointSuffix(ctx context.Context) (string, error)

GetStorageEndpointSuffix retrieves the StorageEndpointSuffix from the session environment

func (*Client) GetVMCapabilities

func (c *Client) GetVMCapabilities(ctx context.Context, instanceType, region string) (map[string]string, error)

GetVMCapabilities retrieves the capabilities of an instant type in a specific region. Returns these values in a map with the capability name as the key and the corresponding value.

func (*Client) GetVirtualMachineFamily

func (c *Client) GetVirtualMachineFamily(ctx context.Context, name, region string) (string, error)

GetVirtualMachineFamily retrieves the VM family of an instance type.

func (*Client) GetVirtualMachineSku

func (c *Client) GetVirtualMachineSku(ctx context.Context, name, region string) (*azsku.ResourceSku, error)

GetVirtualMachineSku retrieves the resource SKU of a specified virtual machine SKU in the specified region.

func (*Client) GetVirtualNetwork

func (c *Client) GetVirtualNetwork(ctx context.Context, resourceGroupName, virtualNetwork string) (*aznetwork.VirtualNetwork, error)

GetVirtualNetwork gets an Azure virtual network by name

func (*Client) ListLocations

func (c *Client) ListLocations(ctx context.Context) (*[]azsubs.Location, error)

ListLocations lists the Azure regions dir the given subscription

func (*Client) ListResourceIDsByGroup

func (c *Client) ListResourceIDsByGroup(ctx context.Context, groupName string) ([]string, error)

ListResourceIDsByGroup returns a list of resource IDs for resource group groupName.

type Credentials

type Credentials struct {
	SubscriptionID            string `json:"subscriptionId,omitempty"`
	ClientID                  string `json:"clientId,omitempty"`
	ClientSecret              string `json:"clientSecret,omitempty"`
	TenantID                  string `json:"tenantId,omitempty"`
	ClientCertificatePath     string `json:"clientCertificate,omitempty"`
	ClientCertificatePassword string `json:"clientCertificatePassword,omitempty"`
}

Credentials is the data type for credentials as understood by the azure sdk

type DNSConfig

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

DNSConfig exposes functions to choose the DNS settings

func NewDNSConfig

func NewDNSConfig(ssn *Session) *DNSConfig

NewDNSConfig returns a new DNSConfig struct that helps configuring the DNS by querying your subscription and letting you choose which domain you wish to use for the cluster

func (DNSConfig) GetDNSRecordSet

func (config DNSConfig) GetDNSRecordSet(rgName string, zoneName string, relativeRecordSetName string, recordType azdns.RecordType) (*azdns.RecordSet, error)

GetDNSRecordSet gets a record set for the zone identified by publicZoneID

func (DNSConfig) GetDNSZone

func (config DNSConfig) GetDNSZone() (*Zone, error)

GetDNSZone returns a DNS zone selected by survey

func (DNSConfig) GetDNSZoneID

func (config DNSConfig) GetDNSZoneID(rgName string, zoneName string) string

GetDNSZoneID returns the Azure DNS zone resourceID by interpolating the subscriptionID, the resource group and the zone name

func (DNSConfig) GetPrivateDNSZoneID

func (config DNSConfig) GetPrivateDNSZoneID(rgName string, zoneName string) string

GetPrivateDNSZoneID returns the Azure Private DNS zone resourceID by interpolating the subscriptionID, the resource group and the zone name

type Metadata

type Metadata struct {

	// CloudName indicates the Azure cloud environment (e.g. public, gov't).
	CloudName typesazure.CloudEnvironment `json:"cloudName,omitempty"`

	// ARMEndpoint indicates the resource management API endpoint used by AzureStack.
	ARMEndpoint string `json:"armEndpoint,omitempty"`

	// Credentials hold prepopulated Azure credentials.
	// At the moment the installer doesn't use it and reads credentials
	// from the file system, but external consumers of the package can
	// provide credentials. This is useful when we run the installer
	// as a service (Azure Red Hat OpenShift, for example): in this case
	// we do not want to rely on the filesystem or user input as we
	// serve multiple users with different credentials via a web server.
	Credentials *Credentials `json:"credentials,omitempty"`
	// contains filtered or unexported fields
}

Metadata holds additional metadata for InstallConfig resources that does not need to be user-supplied (e.g. because it can be retrieved from external APIs).

func NewMetadata

func NewMetadata(cloudName typesazure.CloudEnvironment, armEndpoint string) *Metadata

NewMetadata initializes a new Metadata object.

func NewMetadataWithCredentials

func NewMetadataWithCredentials(cloudName typesazure.CloudEnvironment, armEndpoint string, credentials *Credentials) *Metadata

NewMetadataWithCredentials initializes a new Metadata object with prepopulated Azure credentials.

func (*Metadata) Client

func (m *Metadata) Client() (*Client, error)

Client holds an Azure Client that implements calls to the Azure API.

func (*Metadata) DNSConfig

func (m *Metadata) DNSConfig() (*DNSConfig, error)

DNSConfig holds an Azure DNSConfig Client that implements calls to the Azure API.

func (*Metadata) Session

func (m *Metadata) Session() (*Session, error)

Session holds an Azure session which can be used for Azure API calls during asset generation.

type RecordSetsClient

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

RecordSetsClient wraps the azure RecordSetsClient internal

func (*RecordSetsClient) GetRecordSet

func (client *RecordSetsClient) GetRecordSet(rgName string, zoneName string, relativeRecordSetName string, recordType azdns.RecordType) (*azdns.RecordSet, error)

GetRecordSet gets an Azure DNS recordset by zone, name and recordset type

type Session

type Session struct {
	Authorizer   autorest.Authorizer
	Credentials  Credentials
	Environment  azureenv.Environment
	AuthProvider *azurekiota.AzureIdentityAuthenticationProvider
	TokenCreds   azcore.TokenCredential
	CloudConfig  cloud.Configuration
	AuthType     AuthenticationType
}

Session is an object representing session for subscription

func GetSession

func GetSession(cloudName azure.CloudEnvironment, armEndpoint string) (*Session, error)

GetSession returns an azure session by using credentials found in ~/.azure/osServicePrincipal.json and, if no creds are found, asks for them and stores them on disk in a config file

func GetSessionWithCredentials

func GetSessionWithCredentials(cloudName azure.CloudEnvironment, armEndpoint string, credentials *Credentials) (*Session, error)

GetSessionWithCredentials returns an Azure session by using prepopulated credentials. If there are no prepopulated credentials it falls back to reading credentials from file system or from user input.

type Zone

type Zone struct {
	ID   string
	Name string
}

Zone represents an Azure DNS Zone

func (Zone) String

func (z Zone) String() string

type ZonesClient

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

ZonesClient wraps the azure ZonesClient internal

func (*ZonesClient) GetAllPublicZones

func (client *ZonesClient) GetAllPublicZones() (map[string]string, error)

GetAllPublicZones get all public zones from the current subscription

type ZonesGetter

type ZonesGetter interface {
	GetAllPublicZones() (map[string]string, error)
}

ZonesGetter fetches the DNS zones available for the installer

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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