https://github.com/jacobweinstock/tinklet
implementation of the tinkerbell worker
https://github.com/jacobweinstock/tinklet
tink-worker tinkerbell tinkerbell-worker
Last synced: 9 months ago
JSON representation
implementation of the tinkerbell worker
- Host: GitHub
- URL: https://github.com/jacobweinstock/tinklet
- Owner: jacobweinstock
- License: apache-2.0
- Created: 2021-03-31T02:05:30.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-11-02T03:23:58.000Z (about 4 years ago)
- Last Synced: 2025-02-13T03:42:14.436Z (11 months ago)
- Topics: tink-worker, tinkerbell, tinkerbell-worker
- Language: Go
- Homepage:
- Size: 1.44 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tinklet
[](https://github.com/jacobweinstock/tinklet/actions/workflows/ci.yaml)
[](https://gist.github.com/jacobweinstock/9d00cc54b39121e62d88ab6e02cec6dd#file-branch-main-coverage)
[](https://goreportcard.com/report/github.com/jacobweinstock/tinklet)
>:warning: This is a WIP as it is not a drop in replacement for [tink-worker](https://docs.tinkerbell.org/services/tink-worker/) yet :warning:
tinklet is an implementation of the [tinkerbell worker](https://docs.tinkerbell.org/services/tink-worker/).
## Goals
- support multiple container runtimes
- define standard interfaces for preparing container environments and running actions
- designed for ease of maintainance, testability, and extension
## Notable Features
- support for multiple container runtimes [docker, kubernetes]
- auth for multiple container registries
- multiple client-side TLS options for communicating with Tink server
## Usage
```bash
USAGE
tinklet [flags]
SUBCOMMANDS
docker run the tinklet using the docker backend.
kube run the tinklet using the kubernetes backend.
FLAGS
-config tinklet.yaml config file (optional)
-identifier ... worker id (required)
-loglevel info log level (optional)
-registry {"Name":"","User":"","Pass":""} container image registry (optional)
-tink ... tink server url (required)
-tls false tink server TLS (optional)
```
## Design Philosophies
Tinklet uses the design philosophies from [here](https://github.com/jacobweinstock/DesignPhilosophy) and well as the following:
1. prefer easy to understand over easy to do
2. `pkg` packages do not log only return errors
3. `pkg` is generic, reuseable code
4. functions/methods should follow the single responsibility principle
5. less code, less bugs
6. prefer explicit over implicit
7. avoid global/package level variables as much as possible
## Why not contribute to [tink-worker](https://docs.tinkerbell.org/services/tink-worker/)?
I found that for tink-worker to accommodate some of my desired updates and changes it would need significant modification to its foundation.
Unfortunately, I felt that the codebase was too fragile to make these changes.
Understanding the execution flow of the codebase was also a significant barrier to overcome.
The following are some of the factors I felt contribute to the fragility of tink-worker:
- Low unit test coverage
- Large, complex, and difficult to test functions
- Scattered calls to `os.Exit` and `os.Getenv`
- Tight coupling to the container runtime (docker)
- Difficult to modify or test tightly coupled functions and methods
- The action execution flow code is complex and difficult to follow and understand
- The Tink server interactions are difficult to follow and understand
- The Tink workflow status reporting call result is coupled to the worker exit status
- Lack of documentation and code comments