From 865afa258049df1669d61cec6cd6cc324809fb16 Mon Sep 17 00:00:00 2001 From: Manabu McCloskey Date: Thu, 17 Oct 2024 08:11:56 -0700 Subject: [PATCH] add docs for using the gitea token (#69) Signed-off-by: Manabu McCloskey --- .../installations/idpbuilder/usage.md | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/docs/reference-implementation/installations/idpbuilder/usage.md b/docs/reference-implementation/installations/idpbuilder/usage.md index 93718e51..fbd66168 100644 --- a/docs/reference-implementation/installations/idpbuilder/usage.md +++ b/docs/reference-implementation/installations/idpbuilder/usage.md @@ -134,6 +134,56 @@ Delete a cluster named `localdev`. idpbuilder delete --name localdev ``` + +### Gitea Integration + +idpbuilder creates an internal [Gitea](https://about.gitea.com/) server (accessible from your laptop and kind cluster only). +This can be used for various purposes such as sources for ArgoCD, container registry, and more. +To facilitate interactions with Gitea, idpbuilder creates a token with administrator scope, then stores it in a Kubernetes secret. + +The token can be obtained by running the following command: + +```bash +# print all secrets associated with gitea +idpbuilder get secrets -p gitea + +# get token only +idpbuilder get secrets -p gitea -o json | jq -r '.[0].data.token + +``` + +Here are a some examples for using the token: + +
+ Create a Gitea Organization + +```bash + +TOKEN=$(idpbuilder get secrets -p gitea -o json | jq -r '.[0].data.token' ) +curl -k -X POST \ + https://gitea.cnoe.localtest.me:8443/api/v1/orgs \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $TOKEN" \ + -d '{"description": "my-org", "email": "my-org@my.m", "full_name": "my-org", "username": "my-org"}' +``` + +
+ +
+ Create a Gitea User + +```bash + +TOKEN=$(idpbuilder get secrets -p gitea -o json | jq -r '.[0].data.token' ) +curl -k -X POST \ + https://gitea.cnoe.localtest.me:8443/api/v1/admin/users \ + -H 'Content-Type: application/json' \ + -H "Authorization: Bearer $TOKEN" \ + -d '{"email": "my-org@my.m", "full_name": "user one", "username": "user1", "password": "password", "must_change_password": true}' +``` + +
+ ### Custom Packages Idpbuilder supports specifying custom packages using the flag `-p` flag. This flag expects a directory (local or remote) containing ArgoCD application files and / or ArgoCD application set files. In case of a remote directory, it must be a directory in a git repository, and the URL format must be a [kustomize remote URL format](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md).