WIP azure: serve cluster assets from a kOps-managed container registry - #18603
WIP azure: serve cluster assets from a kOps-managed container registry#18603hakman wants to merge 7 commits into
Conversation
|
Skipping CI for Draft Pull Request. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/test pull-kops-e2e-azure-cni-cilium |
c46779d to
3f36f95
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
3e07459 to
9600a69
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
9600a69 to
586a130
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
586a130 to
b159da0
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
1 similar comment
|
/test pull-kops-e2e-azure-cni-cilium |
b159da0 to
566183f
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
1 similar comment
|
/test pull-kops-e2e-azure-cni-cilium |
566183f to
1895888
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
1895888 to
71bb57a
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
1 similar comment
|
/test pull-kops-e2e-azure-cni-cilium |
71bb57a to
53e298e
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
53e298e to
640908c
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
640908c to
00bb70a
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
An oci:// assets.fileRepository serves file assets from an OCI registry. With assets.managed enabled, kOps creates and manages the Azure Container Registry holding the cluster's file and image assets, as part of the cluster's cloud resources. When fileRepository and containerRegistry are not set, they default to a registry name derived from the subscription ID and the cluster name; registry names are global and cluster names alone are not unique. The AssetBuilder is created before defaulting runs, so the defaulted locations are propagated to it for asset remapping. Asset paths are sanitized to valid OCI repository names, and the sideloaded kops images of development builds are not remapped.
Adds the ContainerRegistry task (Basic SKU, in the cluster's resource group), an AcrPull role assignment for all instance groups, the RegistryAssets task that pushes assets during kops update cluster, and delete-cluster enumeration of the registry. The full list of assets is only known once all the bootstrap configs and the addon manifests have been built, so the push runs after the BootstrapScript and AddonManifest tasks; the RunsAfterAddonManifests marker excludes the push from the addon tasks' wait-for-everything dependencies. A newly created registry can reject data-plane requests for several minutes while permissions propagate, so the push retries failures for up to 15 minutes. Deleting a role assignment whose scope is already deleted is treated as success.
File assets are pushed as single-layer OCI artifacts whose blob digest is the file's sha256 hash, so nodes can download blobs directly by hash. Azure Container Registries are authenticated by exchanging an Entra ID token for a registry refresh token; kops update cluster pushes assets via the injected assetcopy.Copy so that only the CLI links the registry client libraries.
The bootstrap script and nodeup's asset store fetch OCI blobs by digest, authenticating with the instance's managed identity. Pod images are pulled through the acr-credential-provider kubelet plugin. containerd pulls the sandbox image itself, without kubelet's image credential providers, so nodeup pre-pulls it with the instance's managed identity.
Do not merge; drop before merging.
|
/test pull-kops-e2e-azure-cni-cilium |
00bb70a to
4a8e680
Compare
|
/test pull-kops-e2e-azure-cni-cilium |
|
@hakman: The following test failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
|
PR needs rebase. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
This adds support for serving all of a cluster's assets, both files (nodeup, kubelet, containerd, CNI) and container images, from a dedicated per-cluster Azure Container Registry that kOps creates and manages.
Motivation
Nodes currently download file assets from public mirrors and pull images from public registries. A dedicated per-cluster registry removes the public egress dependency, keeps all pulls same-region (free on Azure), and gives content-addressed integrity: OCI blob digests are the sha256 of the content, so the hash kOps already embeds in the bootstrap script doubles as the download address, with no manifest parsing needed on the node.
Usage
With only
managed: true, the registry name is derived from the subscription ID and the cluster name (registry names are global, and cluster names such asmy.k8sare not unique across users). The derivedfileRepositoryandcontainerRegistryvalues are visible withkops get cluster -o yaml --full, and both can also be set explicitly. An existing registry can be referenced withoutmanagedby setting anoci://fileRepositorydirectly.Implementation
assets.managedfield (*bool) and support for theoci://scheme inassets.fileRepository, validated as Azure-only for now.ContainerRegistrytask creates the registry (Basic SKU, admin user disabled, no anonymous pull) in the cluster's resource group, sokops delete clustercleans it up; the registry is also enumerated for the deletion preview. All instance groups get anAcrPullrole assignment scoped to the registry.kops update clusterpushes the assets via aRegistryAssetstask ordered after registry creation. Files are pushed as single-layer OCI artifacts whose blob digest equals the file hash; images reuse the existing assetcopy machinery with an Entra ID keychain. The push function is injected by the CLI so that runtime binaries (nodeup, kops-controller) do not link the registry client libraries.kops get assets --copyalso supportsoci://targets, which is the flow for the terraform target.acr-credential-providerkubelet plugin from cloud-provider-azure.Notes