Skip to content

Commit

Permalink
Fix Docker runtime check to happen only during install (#8667)
Browse files Browse the repository at this point in the history
Closes #8583 

Even though #7468 removed the Docker container runtime check from `linkerd check --pre` to `linkerd install` runtime error, we still do a dry run of the installation so that we can render the control plane manifests. Therefore, we still hit this check which results in not being able to run `linkerd check --pre` when nodes are using the Docker container runtime. This fixes the issue by introducing a `dryRun` flag that we check beforehand.

```shell
❯ kubectl get nodes docker-desktop -o jsonpath='{.status.nodeInfo.containerRuntimeVersion}'
docker://20.10.16

❯ bin/linkerd check --pre
Linkerd core checks
===================
...
```

Signed-off-by: Kevin Leimkuhler <kleimkuhler@icloud.com>
  • Loading branch information
kleimkuhler committed Jun 22, 2022
1 parent 3695eb9 commit 7e8167b
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions cli/cmd/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@ import (
"strings"
"time"

"github.com/linkerd/linkerd2/cli/flag"
charts "github.com/linkerd/linkerd2/pkg/charts/linkerd2"
pkgcmd "github.com/linkerd/linkerd2/pkg/cmd"
"github.com/linkerd/linkerd2/pkg/healthcheck"
"github.com/linkerd/linkerd2/pkg/k8s"
"github.com/linkerd/linkerd2/pkg/version"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
valuespkg "helm.sh/helm/v3/pkg/cli/values"
)

type checkOptions struct {
Expand Down Expand Up @@ -268,20 +266,25 @@ func getExtensionCheckFlags(lf *pflag.FlagSet) []string {
}

func renderInstallManifest(ctx context.Context) (*charts.Values, string, error) {
// Create the default values.
k8sAPI, err := k8s.NewAPI(kubeconfigPath, kubeContext, impersonate, impersonateGroup, 30*time.Second)
if err != nil {
return nil, "", err
}
values, err := charts.NewValues()
if err != nil {
return nil, "", err
}

k8sAPI, err := k8s.NewAPI(kubeconfigPath, kubeContext, impersonate, impersonateGroup, 30*time.Second)
err = initializeIssuerCredentials(ctx, k8sAPI, values)
if err != nil {
return values, "", err
return nil, "", err
}

// Use empty valuesOverrides because there are no option values to merge.
var b strings.Builder
err = installControlPlane(ctx, k8sAPI, &b, values, []flag.Flag{}, valuespkg.Options{})
err = renderControlPlane(&b, values, map[string]interface{}{})
if err != nil {
return values, "", err
return nil, "", err
}
return values, b.String(), nil
}

0 comments on commit 7e8167b

Please sign in to comment.