Gitea hosts private git repositories.
First, select the desired K8s kubeconfig and default context where Gitea will be installed.
Then, for an installation with default configuration run:
./ALL-IN-ONE-Gitea-install.sh
For use then you could do:
source "${CREDENTIALS_DIR}/gitea_environment.rc"
For Gitea provisioning for OSM usage (tokens, users and repos), you can just use this script:
source "${CREDENTIALS_DIR}/gitea_environment.rc" source "${CREDENTIALS_DIR}/gitea_tokens.rc" ./90-provision-gitea-for-osm.sh"
Alternatively, in case you wanted to set up Gitea programmatically for other use cases without using the UI (which is always a possibility), including the setup of Gitea tokens, the creation of users, the creation of repos, etc., you should have a look at all the operations captured in 90-provision-gitea-for-osm.sh (including the commented examples) and create a custom provisioning script that fits your needs.
For your convenience (although it would not be strictly required), you may also enable the local Git user to interact with the significant repos:
source "${CREDENTIALS_DIR}/gitea_environment.rc" source "${CREDENTIALS_DIR}/gitea_tokens.rc" ./91-provision-local-git-user.sh"
This folder provides helper scripts to complete a full standalone installation of Gitea on Kubernetes using the current kubeconfig and the current context.
WARNING: In case your current kubeconfig context does not point to your desired K8s cluster target, simply select it before applying any of the scripts:
export KUBECONFIG=/absolute/path/to/kubeconfig.yaml kubectl config use-context put-your-desired-context-here # Alternatively, you may use `kubectx` for interactive selection of your default context
Once selected the K8s target, the following environment files and scripts should be applied in the order indicated by their prefix number, noting that *.rc files should be sourced and *.sh files should be executed. Here is their utility:
00-custom-config.rc: (optional) Used to override selectively some environment variables that may condition the behaviour of the installer scripts. By default, just generates random values for Gitea passwords, but it may edited for further customizations if needed. If not sourced, the rest of scripts will work normally with sensible defaults (note that default passwords will be applied).01-base-config.rc: Sets sensible defaults to environment variables for Gitea configuration in case they had not been set explicitly before, either via 00-custom-config.rc or by other means.02-deploy-gitea.sh: Makes a Gitea installation based on the config variables set in previous steps.gitea namespace using the published Helm chart.http://gitea-http.gitea:8080.ssh://gitea-ssh.gitea:22.http://git.${GITEA_HTTP_IP}.nip.io:${GITEA_HTTP_PORT}, where ${GITEA_HTTP_PORT} is 8080 by default.ssh://git.${GITEA_SSH_IP}.nip.io:${GITEA_SSH_PORT}, where ${GITEA_HTTP_PORT} is 22 by default.03-get-gitea-connection-info.rc04-fix-and-use-external-gitea-urls.sh: (optional) Fixes the base domain of Gitea to point to a nip.io URL pointing to the external load balancer service IP.05-export-connection-info.sh: Determines full connection URLs and exports data to ${CREDENTIALS_DIR} folder and into a K8s secret.90-provision-gitea-for-osm.sh: Run post-provisioning tasks in Gitea with scripted operations to support its use from OSM:${GITEA_STD_USERNAME}.${CREDENTIALS_DIR} folder and into a K8s secrfleet-osm and sw-catalogs-osm.91-provision-local-git-user.sh: Enable the local Git user to interact with the significant repos supporting its use from OSM:For testing you can use gitea in the Gitea main pod via
./admin/shell.sh su git gitea <your_command_goes_here>
Admin operations on Gitea can be handled in two different ways:
./admin/gitea.sh script, which wraps the Gitea CLI in the main pod, or./admin/api.sh to call the Swagger endpoints.${CREDENTIALS_DIR}/gitea_tokens.rc as environment variables ready to be sourced.In both cases, you will need to source the environment variables saved at ${CREDENTIALS_DIR}/gitea_environment.rc.
Some common helper scripts for common admin operations are also available in the ./admin/ folder.
You can find many useful (commented) examples of admin operations in 90-provision-gitea-for-osm.sh.