Documentation
¶
Index ¶
- Constants
- func NewCreateCommand() *cobra.Command
- func NewDestroyCommand() *cobra.Command
- func NewLoadBalancer(location string, infraID string, idPrefix string, loadBalancerName string, ...) armnetwork.LoadBalancer
- func NewPublicIPAddress(name string, location string) armnetwork.PublicIPAddress
- func NewVirtualNetwork(location string, vnetAddrPrefix string) armnetwork.VirtualNetwork
- func NewVirtualNetworkLink(location string, vnetID string, registrationEnabled bool) armprivatedns.VirtualNetworkLink
- type CreateInfraOptions
- type CreateInfraOutput
- type DestroyInfraOptions
- type FederatedCredentialConfig
- type IdentityManager
- type NetworkManager
- func (n *NetworkManager) CreateLoadBalancer(ctx context.Context, resourceGroupName string, infraID string, location string, ...) error
- func (n *NetworkManager) CreatePrivateDNSZone(ctx context.Context, resourceGroupName string, name string, baseDomain string) (string, string, error)
- func (n *NetworkManager) CreatePrivateDNSZoneLink(ctx context.Context, resourceGroupName string, name string, infraID string, ...) error
- func (n *NetworkManager) CreatePublicIPAddressForLB(ctx context.Context, resourceGroupName string, infraID string, location string) (*armnetwork.PublicIPAddress, error)
- func (n *NetworkManager) CreateSecurityGroup(ctx context.Context, resourceGroupName string, name string, infraID string, ...) (string, error)
- func (n *NetworkManager) CreateVirtualNetwork(ctx context.Context, resourceGroupName string, name string, infraID string, ...) (armnetwork.VirtualNetworksClientCreateOrUpdateResponse, error)
- func (n *NetworkManager) GetBaseDomainID(ctx context.Context, baseDomain string) (string, error)
- type RBACManager
- func (r *RBACManager) AssignControlPlaneRoles(ctx context.Context, opts *CreateInfraOptions, ...) error
- func (r *RBACManager) AssignDataPlaneRoles(ctx context.Context, opts *CreateInfraOptions, ...) error
- func (r *RBACManager) AssignWorkloadIdentities(ctx context.Context, opts *CreateInfraOptions, ...) error
- type ResourceGroupManager
- type ServicePrincipal
- type ServicePrincipalResponse
Constants ¶
const ( VirtualNetworkAddressPrefix = "10.0.0.0/16" VirtualNetworkLinkLocation = "global" VirtualNetworkSubnetAddressPrefix = "10.0.0.0/24" )
Variables ¶
This section is empty.
Functions ¶
func NewCreateCommand ¶
NewCreateCommand creates a new cobra command for creating Azure infrastructure resources for a HostedCluster
func NewDestroyCommand ¶
func NewLoadBalancer ¶ added in v0.1.69
func NewLoadBalancer(location string, infraID string, idPrefix string, loadBalancerName string, publicIPAddress *armnetwork.PublicIPAddress) armnetwork.LoadBalancer
NewLoadBalancer creates a LoadBalancer struct configured for guest cluster egress traffic. This load balancer is used to provide outbound internet connectivity for nodes in the hosted cluster. The Azure cloud provider can later reuse this load balancer to add additional public IP addresses and load balancing rules for services of type LoadBalancer.
The load balancer includes:
- Frontend IP configuration with a public IP address
- Backend address pool for guest cluster nodes
- Health probe for monitoring node health
- Outbound rule for explicit egress SNAT configuration
Parameters:
- location: Azure region where the load balancer will be created
- infraID: Infrastructure identifier used for naming components
- idPrefix: Azure resource ID prefix for constructing component references
- loadBalancerName: Name for the load balancer resource
- publicIPAddress: Public IP address to use for the frontend configuration
Returns a fully configured armnetwork.LoadBalancer with Standard SKU.
func NewPublicIPAddress ¶ added in v0.1.69
func NewPublicIPAddress(name string, location string) armnetwork.PublicIPAddress
NewPublicIPAddress creates a PublicIPAddress struct configured for use with a load balancer. The IP address is configured as a static IPv4 address with the Standard SKU, suitable for production load balancers that require consistent, non-changing IP addresses.
Parameters:
- name: Name for the public IP address resource
- location: Azure region where the IP address will be allocated (e.g., "eastus")
Returns an armnetwork.PublicIPAddress with:
- Static allocation method (IP doesn't change)
- IPv4 address version
- Standard SKU (required for Standard Load Balancers)
- 4-minute idle timeout
func NewVirtualNetwork ¶ added in v0.1.69
func NewVirtualNetwork(location string, vnetAddrPrefix string) armnetwork.VirtualNetwork
NewVirtualNetwork creates a VirtualNetwork struct with the given address prefix. It initializes an empty virtual network with the specified location and address space, ready to have subnets added to it.
Parameters:
- location: Azure region where the virtual network will be created (e.g., "eastus")
- vnetAddrPrefix: CIDR notation for the virtual network address space (e.g., "10.0.0.0/16")
Returns an armnetwork.VirtualNetwork with an empty Subnets slice that can be populated later.
func NewVirtualNetworkLink ¶ added in v0.1.69
func NewVirtualNetworkLink(location string, vnetID string, registrationEnabled bool) armprivatedns.VirtualNetworkLink
NewVirtualNetworkLink creates a VirtualNetworkLink struct for linking a VNet to a Private DNS Zone. This allows resources in the virtual network to resolve DNS records from the private DNS zone.
Parameters:
- location: Azure region, typically "global" for private DNS zone links
- vnetID: Full resource ID of the virtual network to link (e.g., "/subscriptions/.../virtualNetworks/...")
- registrationEnabled: If true, enables automatic DNS record registration for VMs in the VNet
Returns an armprivatedns.VirtualNetworkLink ready to be created via the Azure API.
Types ¶
type CreateInfraOptions ¶
type CreateInfraOptions struct {
Name string
BaseDomain string
Location string
InfraID string
CredentialsFile string
Credentials *util.AzureCreds
OutputFile string
ResourceGroupName string
VnetID string
NetworkSecurityGroupID string
ResourceGroupTags map[string]string
SubnetID string
ManagedIdentitiesFile string
DataPlaneIdentitiesFile string
WorkloadIdentitiesFile string
AssignServicePrincipalRoles bool
DNSZoneRG string
AssignCustomHCPRoles bool
DisableClusterCapabilities []string
OIDCIssuerURL string
GenerateManagedIdentities bool
WorkloadIdentitiesOutputFile string
Cloud string
}
func (*CreateInfraOptions) Run ¶
func (o *CreateInfraOptions) Run(ctx context.Context, l logr.Logger) (*CreateInfraOutput, error)
Run is the main function responsible for creating the Azure infrastructure resources for a HostedCluster.
type CreateInfraOutput ¶
type CreateInfraOutput struct {
BaseDomain string `json:"baseDomain"`
PublicZoneID string `json:"publicZoneID"`
PrivateZoneID string `json:"privateZoneID"`
Location string `json:"region"`
ResourceGroupName string `json:"resourceGroupName"`
VNetID string `json:"vnetID"`
SubnetID string `json:"subnetID"`
BootImageID string `json:"bootImageID"`
InfraID string `json:"infraID"`
SecurityGroupID string `json:"securityGroupID"`
ControlPlaneMIs *hyperv1.AzureResourceManagedIdentities `json:"controlPlaneMIs"`
DataPlaneIdentities hyperv1.DataPlaneManagedIdentities `json:"dataPlaneIdentities"`
WorkloadIdentities *hyperv1.AzureWorkloadIdentities `json:"workloadIdentities"`
}
type DestroyInfraOptions ¶
type DestroyInfraOptions struct {
Name string
Location string
InfraID string
CredentialsFile string
Credentials *util.AzureCreds
ResourceGroupName string
PreserveResourceGroup bool
Cloud string
}
func (*DestroyInfraOptions) GetResourceGroupName ¶ added in v0.1.23
func (o *DestroyInfraOptions) GetResourceGroupName() string
GetResourceGroupName returns the resource group name to use for destroy operations. If a custom resource group name was provided, it is returned; otherwise, the default name format of {name}-{infraID} is used.
type FederatedCredentialConfig ¶ added in v0.1.69
FederatedCredentialConfig holds configuration for creating federated identity credentials
type IdentityManager ¶ added in v0.1.69
type IdentityManager struct {
// contains filtered or unexported fields
}
IdentityManager handles Azure managed identity and federated credential operations
func NewIdentityManager ¶ added in v0.1.69
func NewIdentityManager(subscriptionID string, creds azcore.TokenCredential) *IdentityManager
NewIdentityManager creates a new IdentityManager
func (*IdentityManager) CreateWorkloadIdentities ¶ added in v0.1.69
func (i *IdentityManager) CreateWorkloadIdentities(ctx context.Context, l logr.Logger, opts *CreateInfraOptions, resourceGroupName string) (*hyperv1.AzureWorkloadIdentities, error)
CreateWorkloadIdentities creates all managed identities and federated credentials for workload identity
type NetworkManager ¶ added in v0.1.69
type NetworkManager struct {
// contains filtered or unexported fields
}
NetworkManager handles Azure networking operations
func NewNetworkManager ¶ added in v0.1.69
func NewNetworkManager(subscriptionID string, creds azcore.TokenCredential, cloud string) *NetworkManager
NewNetworkManager creates a new NetworkManager
func (*NetworkManager) CreateLoadBalancer ¶ added in v0.1.69
func (n *NetworkManager) CreateLoadBalancer(ctx context.Context, resourceGroupName string, infraID string, location string, publicIPAddress *armnetwork.PublicIPAddress) error
CreateLoadBalancer creates a load balancer (LB) with an outbound rule for guest cluster egress; azure cloud provider will reuse this LB to add a public ip address and the load balancer rules
func (*NetworkManager) CreatePrivateDNSZone ¶ added in v0.1.69
func (n *NetworkManager) CreatePrivateDNSZone(ctx context.Context, resourceGroupName string, name string, baseDomain string) (string, string, error)
CreatePrivateDNSZone creates the private DNS zone
func (*NetworkManager) CreatePrivateDNSZoneLink ¶ added in v0.1.69
func (n *NetworkManager) CreatePrivateDNSZoneLink(ctx context.Context, resourceGroupName string, name string, infraID string, vnetID string, privateDNSZoneName string) error
CreatePrivateDNSZoneLink creates the private DNS Zone network link
func (*NetworkManager) CreatePublicIPAddressForLB ¶ added in v0.1.69
func (n *NetworkManager) CreatePublicIPAddressForLB(ctx context.Context, resourceGroupName string, infraID string, location string) (*armnetwork.PublicIPAddress, error)
CreatePublicIPAddressForLB creates a public IP address to use for the outbound rule in the load balancer
func (*NetworkManager) CreateSecurityGroup ¶ added in v0.1.69
func (n *NetworkManager) CreateSecurityGroup(ctx context.Context, resourceGroupName string, name string, infraID string, location string) (string, error)
CreateSecurityGroup creates the security group the virtual network will use
func (*NetworkManager) CreateVirtualNetwork ¶ added in v0.1.69
func (n *NetworkManager) CreateVirtualNetwork(ctx context.Context, resourceGroupName string, name string, infraID string, location string, subnetID string, securityGroupID string) (armnetwork.VirtualNetworksClientCreateOrUpdateResponse, error)
CreateVirtualNetwork creates the virtual network
func (*NetworkManager) GetBaseDomainID ¶ added in v0.1.69
GetBaseDomainID gets the resource group ID for the resource group containing the base domain
type RBACManager ¶ added in v0.1.69
type RBACManager struct {
// contains filtered or unexported fields
}
RBACManager handles Azure RBAC operations
func NewRBACManager ¶ added in v0.1.69
func NewRBACManager(subscriptionID string, creds azcore.TokenCredential) *RBACManager
NewRBACManager creates a new RBACManager
func (*RBACManager) AssignControlPlaneRoles ¶ added in v0.1.69
func (r *RBACManager) AssignControlPlaneRoles(ctx context.Context, opts *CreateInfraOptions, controlPlaneMIs *hyperv1.AzureResourceManagedIdentities, resourceGroupName, nsgResourceGroupName, vnetResourceGroupName string) error
AssignControlPlaneRoles assigns roles to control plane managed identities
func (*RBACManager) AssignDataPlaneRoles ¶ added in v0.1.69
func (r *RBACManager) AssignDataPlaneRoles(ctx context.Context, opts *CreateInfraOptions, dataPlaneIdentities hyperv1.DataPlaneManagedIdentities, resourceGroupName string) error
AssignDataPlaneRoles assigns roles to data plane managed identities
func (*RBACManager) AssignWorkloadIdentities ¶ added in v0.1.69
func (r *RBACManager) AssignWorkloadIdentities(ctx context.Context, opts *CreateInfraOptions, workloadIdentities *hyperv1.AzureWorkloadIdentities, resourceGroupName, nsgResourceGroupName, vnetResourceGroupName string) error
AssignControlPlaneRoles assigns roles to control plane managed identities
type ResourceGroupManager ¶ added in v0.1.69
type ResourceGroupManager struct {
// contains filtered or unexported fields
}
ResourceGroupManager handles Azure resource group operations
func NewResourceGroupManager ¶ added in v0.1.69
func NewResourceGroupManager(subscriptionID string, creds azcore.TokenCredential, cloud string) *ResourceGroupManager
NewResourceGroupManager creates a new ResourceGroupManager
func (*ResourceGroupManager) CreateOrGetResourceGroup ¶ added in v0.1.69
func (r *ResourceGroupManager) CreateOrGetResourceGroup(ctx context.Context, opts *CreateInfraOptions, rgName string) (string, string, error)
CreateOrGetResourceGroup creates the three resource groups needed for the cluster: 1. The resource group for the cluster's infrastructure 2. The resource group for the virtual network 3. The resource group for the network security group
type ServicePrincipal ¶ added in v0.1.69
type ServicePrincipal struct {
ID string `json:"id"`
}
ServicePrincipal represents a service principal from Microsoft Graph API
type ServicePrincipalResponse ¶ added in v0.1.58
type ServicePrincipalResponse struct {
Value []ServicePrincipal `json:"value"`
}
ServicePrincipalResponse represents the response from Microsoft Graph API