fix(CLI): Print specific command when prompting to install the Gateway API

If the user runs `linkerd install --crds` when the Gateway API CRDs are not already present on the cluster, Linkerd will print an error prompting the user to first install the gateway API.

To make this a more streamlined user experience, we update the message to include a specific command for installing the Gateway API instead of merely linking to the Gateway API documentation.

```console
> linkerd install --crds                                                                                     
The Gateway API CRDs must be installed prior to installing Linkerd. Run:

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml

or see https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api for more options.
```

Signed-off-by: Alex Leong <alex@buoyant.io>
This commit is contained in:
Alex Leong 2025-04-11 16:15:25 -07:00 committed by GitHub
parent 7edd886c91
commit b4bffda34b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 1 deletions

View File

@ -394,7 +394,11 @@ func validateFinalValues(installed GatewayAPICRDs, finalValues map[string]interf
if installed == Absent {
if !installing {
// if we are not installing GW API Resources and they are not present, error
return errors.New("The Gateway API CRDs must be installed prior to installing Linkerd: https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api")
return errors.New(`The Gateway API CRDs must be installed prior to installing Linkerd. Run:
kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.1/standard-install.yaml
or see https://gateway-api.sigs.k8s.io/guides/#installing-gateway-api for more options.`)
}
} else if installed == Linkerd {
if !installing {