Documentation
¶
Index ¶
- Constants
- Variables
- func AskYesNoWithTimeout(prompt string, timeout time.Duration) bool
- func DetectPublish(ctx context.Context, rtClient ctrlrtclient.Client, ...) (bool, error)
- func ParseArgs(args []string) (string, string, error)
- func ResolvePublish(ctx context.Context, publishFlag PublishFlag, rtClient ctrlrtclient.Client, ...) (bool, error)
- type PublishFlag
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 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:
- Read Service default/kubernetes via the normal kubeconfig endpoint.
- Read the same Service via https://<ClusterIP>:443 with ServerName override.
- 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 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.
Types ¶
type PublishFlag ¶ added in v0.29.8
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.
Click to show internal directories.
Click to hide internal directories.