Files
nvke/cli/internal/deploypath/registry.go
Lia 97ca3ab273 feat: install the controller stack from an NVKR release (#1428)
* feat: install the controller stack from an NVKR release

nvkectl render deploy-path takes the release description nvkr release
verify prints (nvkr.dev/release/v4) beside the site spec: charts the
release carries are pulled by digest into charts/<item>/ and verified,
image artifacts become a release-images.yaml values file or a
kustomization, images.txt lists the images the result runs, and with
--nvkr-run-dir everything comes out of a local Run's OCI layouts. Each
item's release.yaml binds the NVKR artifacts it uses by name. The
executor applies the result: an archive chart.path skips the dependency
build, a kustomization.yaml is applied through kubectl kustomize, and
images.txt layouts are imported into the node's containerd first.
--chart-override is gone; the release is the single chart source.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* refactor(cli): pull release charts with oras-go instead of the oras binary

The render resolves and fetches chart manifests and archives through
oras-go v2: a registry and an OCI layout are the same read-only target,
digests are verified by the store, and the --oras flag goes away. The
operator no longer needs oras to render.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* chore(cli): regenerate third-party notices for the OCI dependencies

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(cli): name release images repository@digest in images.txt

A release may reference an image as repository:tag@digest. The inventory
drops the tag, so the imported name matches the one the values and the
kustomization ask containerd for.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(deploy): import images with containerd's local path and check the digest alias

ctr images import --local names every manifest of the layout
<repository>@<digest>; the transfer import keeps an annotated name and
skips that alias. The executor checks the alias exists after the import.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(cli): cancel registry requests with the command context

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* fix(deploy): read images.txt before importing, so docker exec cannot eat the list

CTR may be `docker exec -i`; inside a while-read loop its stdin is the
list, and the post-import check consumed every line after the first.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

* test(cli): rename the node image fixture artifact to nvke-node-image

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Lia Campbell <liac@nvidia.com>

---------

Signed-off-by: Lia Campbell <liac@nvidia.com>
2026-10-12 17:20:35 -07:00

35 lines
1.2 KiB
Go

// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package deploypath
import (
"fmt"
"slices"
"oras.land/oras-go/v2"
"oras.land/oras-go/v2/registry/remote"
"oras.land/oras-go/v2/registry/remote/auth"
"oras.land/oras-go/v2/registry/remote/credentials"
"oras.land/oras-go/v2/registry/remote/retry"
)
// Registries opens repositories over the network. Hosts listed in plainHTTP
// are used in the clear; nothing is probed. Credentials come from the Docker
// config, as helm and oras read them.
func Registries(plainHTTP []string) func(repository string) (oras.ReadOnlyTarget, error) {
return func(repository string) (oras.ReadOnlyTarget, error) {
repo, err := remote.NewRepository(repository)
if err != nil {
return nil, err
}
repo.PlainHTTP = slices.Contains(plainHTTP, repo.Reference.Registry)
store, err := credentials.NewStoreFromDocker(credentials.StoreOptions{})
if err != nil {
return nil, fmt.Errorf("docker credentials: %w", err)
}
repo.Client = &auth.Client{Client: retry.DefaultClient, Cache: auth.NewCache(), Credential: credentials.Credential(store)}
return repo, nil
}
}