Help us shape the future of Go! Take the 2026 Go Developer Survey

dataio

package
v0.30.22 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTTL                = "2m"
	PersistentVolumeClaimKind = "PersistentVolumeClaim"
	VolumeSnapshotKind        = "VolumeSnapshot"
	VirtualDiskKind           = "VirtualDisk"
	VirtualDiskSnapshotKind   = "VirtualDiskSnapshot"
	Namespace                 = "d8-storage-volume-data-manager"
)
View Source
const (
	ProbeTimeout = 3 * time.Second
)

Variables

View Source
var ErrAutoDetectWithHint = errors.New("cannot auto-detect publish mode, specify --publish=true or --publish=false")
View Source
var (
	ErrUnsupportedVolumeMode = errors.New("invalid volume mode")
)

Functions

func AskYesNoWithTimeout

func AskYesNoWithTimeout(prompt string, timeout time.Duration) bool

func DetectPublish added in v0.29.8

func DetectPublish(
	ctx context.Context,
	rtClient ctrlrtclient.Client,
	sClient *safeClient.SafeClient,
	log *slog.Logger,
) (bool, error)

DetectPublish decides default publish mode when user did not set --publish.

Detection strategy:

  1. Read Service default/kubernetes via the normal kubeconfig endpoint.
  2. Read the same Service via https://<ClusterIP>:443 with ServerName override.
  3. Compare UIDs of both objects.

Decision matrix:

  • same UID: internal path is reachable -> publish=false
  • UID mismatch: ClusterIP reached a different cluster (e.g. local minikube/kind) -> publish=true
  • network-unreachable on probe: internal path is not reachable -> publish=true
  • TLS/auth rejection on probe: ClusterIP reached a different server -> publish=true
  • any other probe error (transient 5xx, cancellation, deserialization): ambiguous -> fail fast with hint

func ParseArgs

func ParseArgs(args []string) (string, string, error)

func ResolvePublish added in v0.29.8

func ResolvePublish(
	ctx context.Context,
	publishFlag PublishFlag,
	rtClient ctrlrtclient.Client,
	sClient *safeClient.SafeClient,
	log *slog.Logger,
) (bool, error)

ResolvePublish returns explicit publish value if user set the flag, otherwise runs autodetection.

func ShouldCleanup added in v0.29.16

func ShouldCleanup(cleanup, cleanupExplicit bool) bool

ShouldCleanup decides whether to delete an auto-created DataExport. When the --cleanup flag was explicitly set by the user, its value is used directly. Otherwise the decision is delegated to an interactive prompt with a timeout.

Types

type PublishFlag added in v0.29.8

type PublishFlag struct {
	Explicit bool
	Value    bool
}

PublishFlag represents the three-state publish flag:

  • Explicit=true, Value=true: user explicitly requested public (published) access
  • Explicit=true, Value=false: user explicitly requested internal (in-cluster) access
  • Explicit=false: auto-detect mode (Value is meaningless)

func ParsePublishFlag added in v0.29.8

func ParsePublishFlag(flags *pflag.FlagSet) (PublishFlag, error)

ParsePublishFlag reads --publish as a three-state value. Explicit is true only when user provided --publish/--publish=true/--publish=false.

Directories

Path Synopsis
dataexport
cmd
dataimport
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL