Documentation
¶
Index ¶
- Variables
- func CheckUploadProgress(ctx context.Context, httpClient *safeClient.SafeClient, targetURL string) (int64, error)
- func CreateDataImport(ctx context.Context, backend dataapi.Backend, name, namespace, ttl string, ...) error
- func DeleteDataImport(ctx context.Context, diName, namespace string, rtClient ctrlrtclient.Client) error
- func EnsureDataImportPublish(ctx context.Context, diObj *v1alpha1.DataImport, publish bool, ...) error
- func GetDataImport(ctx context.Context, diName, namespace string, rtClient ctrlrtclient.Client) (*v1alpha1.DataImport, error)
- func GetDataImportWithRestart(ctx context.Context, backend dataapi.Backend, diName, namespace string, ...) (*v1alpha1.DataImport, error)
- func PostFinished(ctx context.Context, httpClient *safeClient.SafeClient, baseURL string) error
- func PrepareUpload(ctx context.Context, backend dataapi.Backend, diName, namespace string, ...) (string, string, string, *safeClient.SafeClient, error)
- func ResolveClient(ctx context.Context, sClient *safeClient.SafeClient, namespace string, ...) (dataapi.Backend, ctrlrtclient.Client, error)
Constants ¶
This section is empty.
Variables ¶
var ResolveClientFunc = ResolveClient
ResolveClientFunc is a function pointer for test stubbing: resolution is the first thing a command does and the only step that contacts the API server before any of the work under test.
Functions ¶
func CheckUploadProgress ¶
func CheckUploadProgress(ctx context.Context, httpClient *safeClient.SafeClient, targetURL string) (int64, error)
func CreateDataImport ¶
func CreateDataImport( ctx context.Context, backend dataapi.Backend, name, namespace, ttl string, publish, waitForFirstConsumer bool, pvcTpl *v1alpha1.PersistentVolumeClaimTemplateSpec, rtClient ctrlrtclient.Client, ) error
CreateDataImport creates a DataImport that streams the uploaded bytes into a newly created PVC, in the request shape the resolved backend understands.
backend selects that shape, and there is no shape that satisfies both producers: whichever one is addressed rejects a body written for the other. storage-foundation requires spec.mode plus a spec.pvcTemplate at the root and has no targetRef property; storage-volume-data-manager requires spec.targetRef carrying the same template and has no mode.
func DeleteDataImport ¶
func EnsureDataImportPublish ¶ added in v0.29.8
func EnsureDataImportPublish( ctx context.Context, diObj *v1alpha1.DataImport, publish bool, rtClient ctrlrtclient.Client, ) error
EnsureDataImportPublish patches DataImport.Spec.Publish to match the resolved value. Only upgrades publish: false -> true is patched, true -> false is intentionally skipped to avoid downgrading already-published resources.
func GetDataImport ¶
func GetDataImport(ctx context.Context, diName, namespace string, rtClient ctrlrtclient.Client) (*v1alpha1.DataImport, error)
func PostFinished ¶ added in v0.32.5
func PostFinished(ctx context.Context, httpClient *safeClient.SafeClient, baseURL string) error
PostFinished signals end-of-upload to the importer (POST <baseURL>/api/v1/finished), which flips the DataImport's serverState to Finished. This is mandatory: the last data chunk (a PUT that fills the device / writes the final file) does NOT finalise on its own, and the controller only sets UploadFinished=True — the gate for rebinding the target and reaching Completed — once serverState is Finished. baseURL is the importer base (status.url / status.publicURL), the same base the /api/v1/{files,block} data endpoint hangs off of.
func PrepareUpload ¶
func PrepareUpload( ctx context.Context, backend dataapi.Backend, diName, namespace string, publish bool, sClient *safeClient.SafeClient, log *slog.Logger, ) (string, string, string, *safeClient.SafeClient, error)
PrepareUpload waits for the import to be usable and returns the data-plane URL, the importer base URL, the volume mode and a client trusting the importer's CA. backend is the group resolved for this run; it builds this function's own control-plane client, which would otherwise default to storage-foundation's group regardless of what the cluster serves.
func ResolveClient ¶ added in v0.33.14
func ResolveClient( ctx context.Context, sClient *safeClient.SafeClient, namespace string, log *slog.Logger, ) (dataapi.Backend, ctrlrtclient.Client, error)
ResolveClient resolves which of the two producers serves DataImport to this user in this namespace, and returns both the answer and a control-plane client bound to it.
Every `d8 data import` subcommand starts here rather than registering a fixed group, because the same binary ships to clusters that serve only storage-foundation's group, only storage-volume-data-manager's, or both with the user authorized for one of them. The resolved backend is returned alongside the client because the request body differs between the two producers (see CreateDataImport) and because callers that build their own client later (PrepareUpload) must bind it to the same group.
Types ¶
This section is empty.