Skip to content

Commit 283ae1b

Browse files
authored
Docs for #282: added oci registry readme help text (#302)
Signed-off-by: Jesse Sanford <[email protected]>
1 parent 7d6bf1c commit 283ae1b

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed

README.md

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ Once idpbuilder finishes provisioning cluster and packages, you can access GUIs
9292
* ArgoCD: https://argocd.cnoe.localtest.me:8443/
9393
* Gitea: https://gitea.cnoe.localtest.me:8443/
9494

95+
#### Secrets
9596
You can obtain credentials for them by running the following command:
9697

9798
```bash
@@ -227,6 +228,89 @@ You can also view the updated Application spec by going to this address: https:/
227228
The second package directory defines two normal ArgoCD applications referencing a remote repository.
228229
They are applied as-is.
229230

231+
## Local OCI Registry
232+
233+
The local Gitea instance created by idpbuilder contains a built in OCI registry for hosting container images as "packages" in Gitea nomenclature.
234+
235+
It is a standard OCI registry, so the API should be compatible with any tools that are OCI compliant. That includes the `docker` cli.
236+
237+
For example you can push an image by running:
238+
239+
```bash
240+
docker login gitea.cnoe.localtest.me:8443
241+
Username: giteaAdmin
242+
Password:
243+
docker push gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder:with-app-fix2
244+
The push refers to repository [gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder]
245+
78a0cd9d2976: Layer already exists
246+
with-app-fix2: digest: sha256:50dc814b89e22988a69ac23aa7158daa834ab450b38b299e7f7fe17dba0ce992 size: 5566
247+
```
248+
249+
*NOTE: You can't get the giteaAdmin password in the same way as for the web or git interface.*
250+
251+
```bash
252+
./idpbuilder get secrets -p gitea
253+
```
254+
255+
Or you can use this one liner to login:
256+
257+
```bash
258+
idpbuilder get secrets -p gitea -o json | jq '.[0].data.password' -r | docker login -u giteaAdmin --password-stdin gitea.cnoe.localtest.me:8443
259+
```
260+
261+
### Pulling Images
262+
263+
You can pull an image back to your local machine using your docker client like so:
264+
265+
```
266+
docker push gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder
267+
Using default tag: latest
268+
latest: Pulling from giteaadmin/beacon.idpbuilder
269+
Digest: sha256:6308ebbce176470277dcca5e59aee3d528d9798a19f13d6a73ddd74a3f5da17b
270+
Status: Downloaded newer image for gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder:latest
271+
gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder:latest
272+
```
273+
274+
### Referencing Images In Manifests On The Idpbuilder K8s Cluster
275+
If you are creating a pod or a deployment of some sort, you can reference the images on the cluster using the same image name and tag like in the following example:
276+
277+
```
278+
apiVersion: apps/v1
279+
kind: Deployment
280+
metadata:
281+
annotations:
282+
spec:
283+
template:
284+
spec:
285+
containers:
286+
- image: gitea.cnoe.localtest.me:8443/giteaadmin/beacon.idpbuilder:with-app-fix2
287+
imagePullPolicy: IfNotPresent
288+
```
289+
290+
### No Pull Secret Needed
291+
Our gitea instance allows for anonymous read access. This means that you can pull git repo contents and container images without the need to login.
292+
293+
### Only Works With Subdomain Based Idpbuilder Installations
294+
Right now because of the way the OCI registry specifications discovers information about a repo, this will only work with subdomain `gitea.cnoe.localtest.me`
295+
based installations of idpbuilder's core capabilities.
296+
297+
If you would like to use path based routing, you will have to install and manage your own OCI registry at this time.
298+
Other registries might be able to handle this better, however which registries and how to configure them is beyond the scope of this readme.
299+
300+
For more info on the OCI registry spec and the root cause of this "discovery" issue see the spec here:
301+
https://specs.opencontainers.org/distribution-spec/?v=v1.0.0#checking-if-content-exists-in-the-registry
302+
303+
### Pulling Images From Inside Idpbuilder K8s Cluster:
304+
305+
Because we are using an NGINX Ingress and pushing our image from off cluster,
306+
Gitea and it's OCI registry think all images pushed to it are prefixed with `gitea.cnoe.localtest.me:8443`.
307+
308+
This is correct by the OCI spec standards. However when you are on the cluster, that ingress is not available to you.
309+
You can use the service name of gitea, but gitea will not know what images are being asked for at the svc domain name.
310+
311+
So we use containerd to rewrite those image names so that they can be referenced at the external url:
312+
313+
See `./pkg/kind/resources/kind.yaml.tmpl` for how this is done.
230314

231315
## Contributing
232316

0 commit comments

Comments
 (0)