Skip to content

Commit

Permalink
Adding nil check and updating flag name for consistency with other flags
Browse files Browse the repository at this point in the history
  • Loading branch information
scottboring authored and aleoli committed Sep 11, 2023
1 parent 3414443 commit ebe3f7d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/installation/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ 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 `--privateLink` *liqoctl* flag to use the private FQDN for the API server.
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
5 changes: 4 additions & 1 deletion pkg/liqoctl/install/aks/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +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, "privateLink", false, "Use the private FQDN for the API server")
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 @@ -162,6 +162,9 @@ 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
Expand Down

0 comments on commit ebe3f7d

Please sign in to comment.