|
| 1 | +# Contributor Guide |
| 2 | + |
| 3 | +Welcome to the Tinkerbell Sandbox! We are really excited to have you. |
| 4 | +Please use the following guide on your contributing journey. |
| 5 | +Thanks for contributing! |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Context](#Context) |
| 10 | +- [Architecture](#Architecture) |
| 11 | +- [Prerequisites](#Prerequisites) |
| 12 | + - [DCO Sign Off](#DCO-Sign-Off) |
| 13 | + - [Code of Conduct](#Code-of-Conduct) |
| 14 | +- [Linting](#Linting) |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## Context |
| 19 | + |
| 20 | +The Tinkerbell Sandbox is a repo that handles the standing up a Tinkerbell stack in many different infrastructure environments. |
| 21 | +Its goal is to be **_"The easiest way to setup the Tinkerbell Stack"_**. |
| 22 | + |
| 23 | +There are two major areas of responsibility. |
| 24 | + |
| 25 | +1. Stand up of the Tinkerbell application stack |
| 26 | + - Handled by Docker Compose ([deploy/compose/docker-compose.yml](../deploy/compose/docker-compose.yml)) |
| 27 | +2. Stand up of infrastructure to support the Tinkerbell application stack |
| 28 | + - [Vagrant](../deploy/vagrant/Vagrantfile) |
| 29 | + - [Terraform](../deploy/terraform/main.tf) |
| 30 | + |
| 31 | +## Architecture |
| 32 | + |
| 33 | +<details> |
| 34 | + <summary>Diagram</summary> |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | +</details> |
| 39 | + |
| 40 | +The sandbox architecture can be broken down into 3 distinct groups. |
| 41 | + |
| 42 | +1. Core Services |
| 43 | + |
| 44 | + - [Tink Server](https://docs.tinkerbell.org/services/tink-server/) |
| 45 | + - GRPC Server that holds hardware, template, and workflows |
| 46 | + - Tink DB |
| 47 | + - Persistent data store for Tink Server |
| 48 | + - [Tink CLI](https://docs.tinkerbell.org/services/tink-cli/) |
| 49 | + - Tink Server client |
| 50 | + - [Boots](https://docs.tinkerbell.org/services/boots/) |
| 51 | + - DHCP, TFTP for ipxe binary download, HTTP for ipxe script download |
| 52 | + - [Hegel](https://docs.tinkerbell.org/services/hegel/) |
| 53 | + - Metadata service for use in workflow execution |
| 54 | + |
| 55 | +2. Support Services |
| 56 | + |
| 57 | + - [OSIE/Hook File Server](https://docs.tinkerbell.org/services/osie/) |
| 58 | + - Basic file server for kernel, initramfs, self signed TLS pem file, Ubuntu cloud image, OSIE scripts |
| 59 | + - [Container Registry](https://docs.tinkerbell.org/services/registry/) |
| 60 | + - Local/Internal container registry required for Tink Worker |
| 61 | + |
| 62 | +3. Single Run Services |
| 63 | + - Tink Record Creation |
| 64 | + - This [script](../deploy/compose/manifests/apply_manifests.sh) that creates Tink records from templated files ([hardware](../deploy/compose/manifests/hardware), [template](../deploy/compose/manifests/template), and workflow) |
| 65 | + - Tink DB Migrations |
| 66 | + - Builtin functionality to the Tink Server binary that will create DB schemas, tables, etc |
| 67 | + - TLS Setup |
| 68 | + - This [script](../deploy/compose/tls/generate.sh) that handles creating the self-signed TLS certificates for the Tink Server and the Container Registry (the same certs are shared for both). |
| 69 | + Valid domain names are defined in the [csr.json](../deploy/compose/tls/csr.json) file. By default the value of `TINKERBELL_HOST_IP` in the [.env](../deploy/compose/.env) file is added as a valid domain name. |
| 70 | + This addition happens via the [generate.sh](../deploy/compose/tls/generate.sh) script. |
| 71 | + - Registry Auth |
| 72 | + - This container (named `registry-auth` in the [docker-compose.yml](../deploy/compose/docker-compose.yml)) creates the user/passwd pair for use to login to the container registry. |
| 73 | + Defaults to admin/Admin1234. |
| 74 | + These can be customized by setting `TINKERBELL_REGISTRY_USERNAME` and `TINKERBELL_REGISTRY_PASSWORD` in the [.env](../deploy/compose/.env) file. |
| 75 | + - Registry Image Population |
| 76 | + - This [script](../deploy/registry/upload.sh) uploads images to the local/internal container registry, including the tink-worker image. |
| 77 | + Any image needed in a workflow will need to be added to the [registry_images.txt](../deploy/compose/registry/registry_images.txt) file. |
| 78 | + The [registry_images.txt](../deploy/compose/registry/registry_images.txt) file should not contain a final newline and each line must have the form of `<image_name>space<image_name>` |
| 79 | + ```bash |
| 80 | + quay.io/tinkerbell/tink-worker:latest tink-worker:latest |
| 81 | + ``` |
| 82 | + - OSIE/Hook Setup |
| 83 | + - This [script](../deploy/compose/osie/lastmile.sh) handles downloading Hook (or OSIE), extracting it, and placing it in the path ([deploy/compose/state/misc/osie/current](../deploy/compose/state/misc/osie/current)) that the compose service `osie-bootloader` uses for serving files. |
| 84 | + To use OSIE instead of Hook, update the `deploy/compose/.env` by setting `OSIE_DOWNLOAD_URL` to an OSIE download URL and by setting `TINKERBELL_USE_HOOK` to false. |
| 85 | + FYI, currently only an x86_64 Hook is published so only x86_64 machines can be provisioned with the sandbox using Hook. |
| 86 | + - Ubuntu Image Setup |
| 87 | + - This [script](../deploy/compose/ubuntu/setup_ubuntu.sh) handles downloading the Ubuntu focal cloud `.img` file and [converting it to a raw image](https://docs.tinkerbell.org/deploying-operating-systems/examples-ubuntu/). |
| 88 | + This will be used with workflow action [`quay.io/tinkerbell-actions/image2disk:v1.0.0`](https://artifacthub.io/packages/tbaction/tinkerbell-community/image2disk). |
| 89 | + |
| 90 | +## Prerequisites |
| 91 | + |
| 92 | +Before contributing, please be sure to complete the following. |
| 93 | + |
| 94 | +### DCO Sign Off |
| 95 | + |
| 96 | +Please read and understand the DCO found [here](DCO.md). |
| 97 | + |
| 98 | +### Code of Conduct |
| 99 | + |
| 100 | +Please read and understand the code of conduct found [here](https://github.com/tinkerbell/.github/blob/master/CODE_OF_CONDUCT.md). |
| 101 | + |
| 102 | +## Linting |
| 103 | + |
| 104 | +To execute linting, run: |
| 105 | + |
| 106 | +```bash |
| 107 | +./.github/workflows/ci-non-go.sh |
| 108 | +``` |
0 commit comments