Documentation
¶
Index ¶
- Constants
- func BindCreateIAMProductFlags(opts *CreateIAMOptions, flags *pflag.FlagSet)
- func BindDestroyIAMProductFlags(opts *DestroyIAMOptions, flags *pflag.FlagSet)
- func BindDestroyProductFlags(opts *DestroyInfraOptions, flags *pflag.FlagSet)
- func BindProductFlags(opts *CreateInfraOptions, flags *pflag.FlagSet)
- func NewCreateCommand() *cobra.Command
- func NewCreateIAMCommand() *cobra.Command
- func NewDestroyCommand() *cobra.Command
- func NewDestroyIAMCommand() *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 CreateIAMOptions
- type CreateInfraOptions
- type CreateInfraOutput
- type DestroyIAMOptions
- type DestroyInfraOptions
- type FederatedCredentialConfig
- type IdentityManager
- func (i *IdentityManager) CreateWorkloadIdentitiesFromIAMOptions(ctx context.Context, l logr.Logger, opts *CreateIAMOptions, ...) (*hyperv1.AzureWorkloadIdentities, error)
- func (i *IdentityManager) DestroyWorkloadIdentities(ctx context.Context, l logr.Logger, clusterName string, infraID string, ...) error
- 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
- func (r *RBACManager) CleanupRoleAssignments(ctx context.Context, l logr.Logger, infraID string, ...) error
- type ResourceGroupManager
- type ServicePrincipal
- type ServicePrincipalResponse
- type WorkloadIdentityDefinition
Constants ¶
const ( VirtualNetworkAddressPrefix = "10.0.0.0/16" VirtualNetworkLinkLocation = "global" VirtualNetworkSubnetAddressPrefix = "10.0.0.0/24" )
Variables ¶
This section is empty.
Functions ¶
func BindCreateIAMProductFlags ¶ added in v0.1.74
func BindCreateIAMProductFlags(opts *CreateIAMOptions, flags *pflag.FlagSet)
BindCreateIAMProductFlags binds flags for the product CLI (hcp) IAM create azure command
func BindDestroyIAMProductFlags ¶ added in v0.1.74
func BindDestroyIAMProductFlags(opts *DestroyIAMOptions, flags *pflag.FlagSet)
BindDestroyIAMProductFlags binds flags for the product CLI (hcp) IAM destroy azure command
func BindDestroyProductFlags ¶ added in v0.1.74
func BindDestroyProductFlags(opts *DestroyInfraOptions, flags *pflag.FlagSet)
BindDestroyProductFlags binds flags for the product CLI (hcp) infra destroy azure command. This exposes only the self-managed Azure flags relevant for the productized CLI.
func BindProductFlags ¶ added in v0.1.74
func BindProductFlags(opts *CreateInfraOptions, flags *pflag.FlagSet)
BindProductFlags binds flags for the product CLI (hcp) infra create azure command. This exposes only the self-managed Azure flags relevant for the productized CLI.
func NewCreateCommand ¶
NewCreateCommand creates a new cobra command for creating Azure infrastructure resources for a HostedCluster
func NewCreateIAMCommand ¶ added in v0.1.74
NewCreateIAMCommand creates a new cobra command for creating Azure IAM resources (managed identities and federated credentials) for a HostedCluster
func NewDestroyCommand ¶
func NewDestroyIAMCommand ¶ added in v0.1.74
NewDestroyIAMCommand creates a new cobra command for destroying Azure IAM resources (managed identities and federated credentials) for a HostedCluster
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 CreateIAMOptions ¶ added in v0.1.74
type CreateIAMOptions struct {
Name string
Location string
InfraID string
CredentialsFile string
Credentials *util.AzureCreds
ResourceGroupName string
OIDCIssuerURL string
OutputFile string
Cloud string
}
CreateIAMOptions holds options for creating Azure IAM resources (managed identities and federated credentials)
func DefaultCreateIAMOptions ¶ added in v0.1.74
func DefaultCreateIAMOptions() *CreateIAMOptions
DefaultCreateIAMOptions returns CreateIAMOptions with default values
func (*CreateIAMOptions) Run ¶ added in v0.1.74
Run creates the Azure IAM resources (managed identities and federated credentials)
func (*CreateIAMOptions) Validate ¶ added in v0.1.74
func (o *CreateIAMOptions) Validate() error
Validate validates the CreateIAMOptions
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
Cloud string
}
func DefaultOptions ¶ added in v0.1.74
func DefaultOptions() *CreateInfraOptions
DefaultOptions returns CreateInfraOptions with default values for self-managed Azure
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.
func (*CreateInfraOptions) Validate ¶ added in v0.1.74
func (o *CreateInfraOptions) Validate() error
Validate validates the CreateInfraOptions before running the command
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"`
NATSubnetID string `json:"natSubnetID,omitempty"`
ControlPlaneMIs *hyperv1.AzureResourceManagedIdentities `json:"controlPlaneMIs"`
DataPlaneIdentities hyperv1.DataPlaneManagedIdentities `json:"dataPlaneIdentities"`
WorkloadIdentities *hyperv1.AzureWorkloadIdentities `json:"workloadIdentities"`
}
type DestroyIAMOptions ¶ added in v0.1.74
type DestroyIAMOptions struct {
Name string
InfraID string
WorkloadIdentitiesFile string
CredentialsFile string
Credentials *util.AzureCreds
ResourceGroupName string
DNSZoneRG string
Cloud string
}
DestroyIAMOptions holds options for destroying Azure IAM resources
func DefaultDestroyIAMOptions ¶ added in v0.1.74
func DefaultDestroyIAMOptions() *DestroyIAMOptions
DefaultDestroyIAMOptions returns DestroyIAMOptions with default values
func (*DestroyIAMOptions) Run ¶ added in v0.1.74
Run destroys the Azure IAM resources (managed identities and federated credentials)
func (*DestroyIAMOptions) Validate ¶ added in v0.1.74
func (o *DestroyIAMOptions) Validate() error
Validate validates the DestroyIAMOptions
type DestroyInfraOptions ¶
type DestroyInfraOptions struct {
Name string
Location string
InfraID string
CredentialsFile string
Credentials *util.AzureCreds
ResourceGroupName string
PreserveResourceGroup bool
Cloud string
}
func DefaultDestroyOptions ¶ added in v0.1.74
func DefaultDestroyOptions() *DestroyInfraOptions
DefaultDestroyOptions returns DestroyInfraOptions with default values for self-managed Azure
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.
func (*DestroyInfraOptions) Validate ¶ added in v0.1.74
func (o *DestroyInfraOptions) Validate() error
Validate validates the DestroyInfraOptions before running the destroy operation.
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, cloud string) *IdentityManager
NewIdentityManager creates a new IdentityManager
func (*IdentityManager) CreateWorkloadIdentitiesFromIAMOptions ¶ added in v0.1.74
func (i *IdentityManager) CreateWorkloadIdentitiesFromIAMOptions(ctx context.Context, l logr.Logger, opts *CreateIAMOptions, resourceGroupName string) (*hyperv1.AzureWorkloadIdentities, error)
CreateWorkloadIdentitiesFromIAMOptions creates all managed identities and federated credentials for workload identity using CreateIAMOptions. This is used by the standalone IAM create command.
func (*IdentityManager) DestroyWorkloadIdentities ¶ added in v0.1.74
func (i *IdentityManager) DestroyWorkloadIdentities(ctx context.Context, l logr.Logger, clusterName string, infraID string, resourceGroupName string) error
DestroyWorkloadIdentities deletes all managed identities and their federated credentials for a cluster. Federated credentials are explicitly deleted first, then the managed identity is deleted. The method continues deleting remaining identities even if some fail, logging errors as it goes.
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. It is idempotent: if the link already exists, it returns successfully.
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
AssignWorkloadIdentities assigns roles to workload identity managed identities
func (*RBACManager) CleanupRoleAssignments ¶ added in v0.1.76
func (r *RBACManager) CleanupRoleAssignments(ctx context.Context, l logr.Logger, infraID string, resourceGroupName, nsgResourceGroupName, vnetResourceGroupName, dnsZoneRG string, assignCustomHCPRoles bool) error
CleanupRoleAssignments deletes all role assignments created for a cluster's workload identities. It regenerates the deterministic role assignment names from the infraID, component names, and scopes, then deletes each one. This must be called before destroying managed identities to avoid orphaned role assignments that cause naming collisions on re-creation.
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
type WorkloadIdentityDefinition ¶ added in v0.1.74
type WorkloadIdentityDefinition struct {
ComponentName string // e.g., "disk", "file", "ingress"
IdentityNameSuffix string // e.g., "-disk", "-file"
FederatedCredentials []FederatedCredentialConfig
}
WorkloadIdentityDefinition defines a workload identity component with its federated credentials
func GetWorkloadIdentityDefinitions ¶ added in v0.1.74
func GetWorkloadIdentityDefinitions(clusterName string, topology string) []WorkloadIdentityDefinition
GetWorkloadIdentityDefinitions returns all workload identity definitions for a cluster. This is the single source of truth for identity names and their federated credentials, used by both create and destroy operations. The topology parameter controls whether private-topology-only identities (e.g., controlPlaneOperator) are included.