Skip to content

Commit

Permalink
Adding privateLink flag to support private AKS clusters that use priv…
Browse files Browse the repository at this point in the history
…ate link.
  • Loading branch information
scottboring authored and adamjensenbot committed Sep 13, 2023
1 parent 60e8e0b commit 6b74ecc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/installation/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ Alternatively, you can manually set a different name with the `--cluster-name` *
```{admonition} Note
If you are running an [AKS private cluster](https://learn.microsoft.com/en-us/azure/aks/private-clusters), you may need to set the `--disable-api-server-sanity-check` *liqoctl* flag, since the API Server in your kubeconfig may be different from the one retrieved from the Azure APIs.
If the private cluster uses private link, you can set the `--private-link` *liqoctl* flag to use the private FQDN for the API server.
Additionally, since your API Server is not accessible from the public Internet, you shall leverage the [in-band peering approach](FeaturesPeeringInBandControlPlane) towards the clusters not attached to the same Azure Virtual Network.
```
Expand Down
7 changes: 7 additions & 0 deletions pkg/liqoctl/install/aks/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ type Options struct {
resourceGroupName string
resourceName string
vnetResourceGroupName string
privateLink bool
fqdn string

authorizer *autorest.Authorizer
Expand Down Expand Up @@ -76,6 +77,7 @@ func (o *Options) RegisterFlags(cmd *cobra.Command) {
cmd.Flags().StringVar(&o.vnetResourceGroupName, "vnet-resource-group-name", "",
"The Azure ResourceGroup name of the Virtual Network (defaults to --resource-group-name if not provided)")
cmd.Flags().StringVar(&o.fqdn, "fqdn", "", "The private AKS cluster fqdn")
cmd.Flags().BoolVar(&o.privateLink, "private-link", false, "Use the private FQDN for the API server")

utilruntime.Must(cmd.MarkFlagRequired("resource-group-name"))
utilruntime.Must(cmd.MarkFlagRequired("resource-name"))
Expand Down Expand Up @@ -159,6 +161,11 @@ func (o *Options) parseClusterOutput(ctx context.Context, cluster *containerserv
}

switch {
case o.privateLink:
if cluster.PrivateFQDN == nil {
return fmt.Errorf("private FQDN not found on cluster")
}
o.APIServer = *cluster.PrivateFQDN
case cluster.Fqdn != nil:
o.APIServer = *cluster.Fqdn
case len(o.fqdn) > 0:
Expand Down

0 comments on commit 6b74ecc

Please sign in to comment.