|
| 1 | +--- |
| 2 | +hip: 9999 |
| 3 | +title: "registries.conf support for OCI registry management" |
| 4 | +authors: [ "George Jenkins <[email protected]>" ] |
| 5 | +created: "2025-02-16" |
| 6 | +type: "feature" |
| 7 | +status: "draft" |
| 8 | +--- |
| 9 | + |
| 10 | +## Abstract |
| 11 | + |
| 12 | +This HIP proposes adding support for `registries.conf`[1] for managing OCI registry configuration. |
| 13 | + |
| 14 | +This HIP focuces on the implementation of supporting `registries.conf`. Further HIPs to be created for exposing functionality based on utilzing `registries.conf`. |
| 15 | + |
| 16 | +## Motivation |
| 17 | + |
| 18 | +`registries.conf` provides much more flexibible support for OCI registry management, than the current Docker CLIs based configuration format Helm uses today. |
| 19 | + |
| 20 | +Including support for authenication prefixes and registry "aliasing". Two features Helm would like to introduce. But is currenly blocked |
| 21 | + |
| 22 | +(in particular, the existing registry configuration Helm uses, Docker’s `$HOME/.docker/config.json`, etc do not support registry aliases nor prefixes) |
| 23 | + |
| 24 | +## Rationale |
| 25 | + |
| 26 | +Utilizing an existing specification / libraries enables Helm immediate build upon an existing standard. |
| 27 | + |
| 28 | +`registries.conf` was picked as being a format intended for consumption beyond the Docker application container ecosystem. |
| 29 | + |
| 30 | +## Specification |
| 31 | + |
| 32 | +Helm will utilize the `registries.conf` specification when determinging OCI registry information (authentication credentials, etc): |
| 33 | +https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md#remapping-and-mirroring-registries |
| 34 | + |
| 35 | + |
| 36 | +`registries.conf` will be preferred, either when a `registries.conf` file already exists on the users system. |
| 37 | +Or when in the future Helm exposes functionality that can not be supported by Docker's comnfigurtation file. |
| 38 | + |
| 39 | +<!-- The usage of `registries.conf` will be forced, when in the future --> |
| 40 | + |
| 41 | +For example, a registry login command: |
| 42 | +```bash |
| 43 | +helm registry login “oci.example.com --username foo --password bar" |
| 44 | +``` |
| 45 | +
|
| 46 | +Will result in the configration exerpt (if, and only if, `registries.conf` exists on the users local system): |
| 47 | +```toml |
| 48 | +# registries.conf |
| 49 | +[[registry]] |
| 50 | +prefix = "oci.example.com" |
| 51 | +``` |
| 52 | +
|
| 53 | +```toml |
| 54 | +# auth.json |
| 55 | + "auths": { |
| 56 | + ... |
| 57 | + "oci.example.com": { |
| 58 | + "auth": "Zm9vOmJhcgo=" |
| 59 | + }, |
| 60 | + } |
| 61 | +[[registry]] |
| 62 | +prefix = "oci.example.com" |
| 63 | +username = "foo" |
| 64 | +password = "bar" |
| 65 | +``` |
| 66 | +
|
| 67 | +Helm will use the package TBD for updating (and reading) `registries.conf`. |
| 68 | +
|
| 69 | +If when reading a registries configation from `registries.conf` results in configuration Helm doesn't support (e.g. `location` or non-empty URI path in prefix), Helm must error. |
| 70 | +
|
| 71 | +An error reading `registries.conf` must result in an error for the user (otherwise, users who expect configration from `registries.conf` to be effected, will have a unspected fallback) |
| 72 | +
|
| 73 | +To account for existing configration in Docker’s registry configuration, Helm will prefer `registries.conf` when resolving OCI registries (including credentials). |
| 74 | +And fall back to the existing store mechanism if `registries.conf` does not contain an entry for the required OCI registry (including if `registries.conf` does not exist). |
| 75 | +
|
| 76 | +Helm must expect (and even encourage) users to utilize other tooling to manage `registries.conf`. |
| 77 | +
|
| 78 | +## Backwards compatibility |
| 79 | +
|
| 80 | +Helm's fallback to Docker's registry configuration ensures the vast majority of existing user workflows remain the same. |
| 81 | +
|
| 82 | +However, there are three potential incompatibility scenarios: |
| 83 | +2. A corrupt `registries.conf` will cause an error for existing workflows |
| 84 | +1. An invalid or incompatible with Helm `registries.conf` entry for the given OCI registry will cause the users workflow to fail |
| 85 | +3. Helm’s preference for `registries.conf` will break users who assume credentials are stored in Docker’s registry configuration |
| 86 | +
|
| 87 | +The first two can mitigated by users ensuring their systems `registries.conf` is valid, and only includes configuration options Helm supports for the registries they plan to use with Helm. |
| 88 | +
|
| 89 | +The last is mitigated by not using `registries.conf` initially unless it exists on the users system. |
| 90 | +
|
| 91 | +## Security implications |
| 92 | +
|
| 93 | +registries.conf introduces a new mechanism for storing OCI credentials, which may introduce credential management vulnerabilities specific to `registries.conf` / `auth.json` |
| 94 | +
|
| 95 | +Transitive dependencies of the TBD package for managing registries.conf may introduce security scanner noise (which tends to be a problem in the container library ecosystem) |
| 96 | +
|
| 97 | +
|
| 98 | +## How to teach this |
| 99 | +
|
| 100 | +How to teach users, new and experienced, how to apply the HIP to their work. |
| 101 | +
|
| 102 | +## Reference implementation |
| 103 | +
|
| 104 | +Link to any existing implementation and details about its state, e.g. |
| 105 | +proof-of-concept. |
| 106 | +
|
| 107 | +## Rejected ideas |
| 108 | +
|
| 109 | +### Falling back to Docker’s config upon error reading registries.conf |
| 110 | +
|
| 111 | +Falling back upon error means users who expect their configuration to be taken from `registries.conf` will unexpectedly have OCI configuration taken from Docker. |
| 112 | +Potentially resulting in difficult to diagnose failures authenticating to the repository. |
| 113 | +
|
| 114 | +Rather than "failing fast" and requring users to ensure their configuration to be valid. |
| 115 | +
|
| 116 | +## Open issues |
| 117 | +
|
| 118 | +Any points that are still being decided/discussed. |
| 119 | +
|
| 120 | +## References |
| 121 | +
|
| 122 | +### ORAS credential store (registry configuration) docs |
| 123 | +
|
| 124 | +https://pkg.go.dev/oras.land/oras-go/v2/registry/remote/credentials#NewStoreFromDocker |
| 125 | +
|
| 126 | +### registries.conf specification |
| 127 | +https://github.com/containers/image/blob/main/docs/containers-registries.conf.5.md |
0 commit comments