func DetectNodeProvider() (ProviderOption, error) {
	if docker.IsAvailable() {
		return ProviderWithDocker(), nil
	}
	if podman.IsAvailable() {
		return ProviderWithPodman(), nil
	}
	return nil, errors.WithStack(NoNodeProviderDetectedError)
}
DetectNodeProvider allows callers to autodetect the node provider
*without* fallback to the default.

Pass the returned ProviderOption to NewProvider to pass the auto-detect Docker
or Podman option explicitly (in the future there will be more options)

NOTE: The kind *cli* also checks `KIND_EXPERIMENTAL_PROVIDER` for "podman" or
"docker" currently and does not auto-detect / respects this if set.

This will be replaced with some other mechanism in the future (likely when
podman support is GA), in the meantime though your tool may wish to match this.

In the future when this is not considered experimental,
that logic will be in a public API as well.
package cluster
import (
	"io/ioutil"
	"os"
	"path/filepath"
	"sort"
	"sigs.k8s.io/kind/pkg/cmd/kind/version"
	"sigs.k8s.io/kind/pkg/cluster/constants"
	"sigs.k8s.io/kind/pkg/cluster/nodes"
	"sigs.k8s.io/kind/pkg/cluster/nodeutils"
	"sigs.k8s.io/kind/pkg/errors"
	"sigs.k8s.io/kind/pkg/log"
	internalcreate "sigs.k8s.io/kind/pkg/cluster/internal/create"
	internaldelete "sigs.k8s.io/kind/pkg/cluster/internal/delete"
	"sigs.k8s.io/kind/pkg/cluster/internal/kubeconfig"
	internalproviders "sigs.k8s.io/kind/pkg/cluster/internal/providers"
	"sigs.k8s.io/kind/pkg/cluster/internal/providers/docker"
	"sigs.k8s.io/kind/pkg/cluster/internal/providers/podman"
)
const DefaultName = constants.DefaultClusterName
func defaultName(name string) string {
	if name == "" {
		name = DefaultName
	}
	return name
}
type Provider struct {
	provider internalproviders.Provider
	logger   log.Logger
}
func NewProvider(options ...ProviderOption) *Provider {
	p := &Provider{
		logger: log.NoopLogger{},
	}
	sort.SliceStable(options, func(i, j int) bool {
		_, iIsLogger := options[i].(providerLoggerOption)
		_, jIsLogger := options[j].(providerLoggerOption)
		return iIsLogger && !jIsLogger
	})
	for _, o := range options {
		if o != nil {
			o.apply(p)
		}
	}
	if p.provider == nil {
		providerOpt, _ := DetectNodeProvider()
		if providerOpt == nil {
			providerOpt = ProviderWithDocker()
		}
		providerOpt.apply(p)
	}
	return p
}
var NoNodeProviderDetectedError = errors.NewWithoutStack("failed to detect any supported node provider")