Please do commits following conventional commits approach.
There is a github action that will prevent your commit if you dont do it!
Run make setup in order to install pre-commit checks to prevent that from happening
Responsible to manage tenant information, including:
- Tenant Account creation/deletion
- Agents Creation/deletion
- Agent Life checks
- Billing Consolidation
Is tenant manager a full fledged backend for the web ui (aka our portal)?
- Maybe. I'm not yet sure that we are going to go more granular on services with an api gateway or not.
This picture below summarizes the bits that could change still
These are needed to run/set up the application. You should only proceeed to the next steps after having these installed.
-
go 1.23
-
kind - (kubernetes on docker) - https://kind.sigs.k8s.io/docs/user/quick-start (this works on WSL)
-
kubectl - (kubernetes ctl) - https://kubernetes.io/pt-br/docs/tasks/tools/install-kubectl-linux/ (this works on WSL)
-
(optional) goenv (https://github.com/go-nv/goenv)
-
(optional) VS Code Go Extension
-
(optional) Windows - WSL (kubernetes works better on WSL)
Add Go binaries to your PATH. If you don't have a GOPATH variable, create it.
export GOPATH=$HOME/go
export PATH=$PATH:$(go env GOPATH)/binInstall Swag with Go:
go install github.com/swaggo/swag/cmd/swag@latestInstall the dependencies:
make installCreate the dev cluster:
make devForward the port to access the api from your machine:
kubectl port-forward -n tenant-manager svc/tenant-manager 8080:8080&
curl localhost:8080/api/agentson debugging session:
kubectl port-forward -n tenant-manager svc/postgres 5432:5432&
# Start debugging session on vscode or dlvSome information is already seeded to speed up development. If you need a valid user locally, you can simply use the following credentials:
{"email": "dev@test.com", "tenant": "Acme Corp", "password": "password"}
By Default, tenant-manager will not connect to GCP on local development (make dev command). In this environment, manifests generated for agents need to be applied within your local cluster to see the agent working.
If you need to do something related to GCP, first login to GCP and expose the database port:
gcloud auth application-default login
kubectl port-forward svc/postgres 5432:5432&
Then, call the client with the appropriate parameters:
go run main.go --gcpProjectId="external-secrets-inc-dev"
├── api
│ ├── binders #Code for custom binders. No binders defined atm
│ ├── handlers #API Handlers
│ │ ├── agent #Agent Handler
│ │ ├── auth #Auth (login, signup) Handler
│ │ ├── common #Common request/response and methods
│ │ ├── tenant #Tenant Handler (internal only)
│ │ └── user #User Handler
│ └── middleware #Custom Middleware goes here.
├── cmd #Where the server main routine is.
├── dev #Folder with manifests called with `make dev`
├── docs #OpenAPi Generated docs
├── domain #Models are defined here
├── event #Asynchronous Jobs
│ ├── agent #Agent Jobs
│ ├── pubsub #Base Definition of Event Scheme (Golang channels)
│ └── tenant #Tenant Jobs
├── images #For this page basically
├── service #API Services
│ ├── agent #Agent service
│ ├── auth #Auth Service
│ ├── tenant #Tenant Service
│ └── user #User Service
└── store #DB store (not for multiple engines, but for tenancy mostly)
Tenant manager development supports using tilt. To use tilt, simply download it, create a kind cluster
and run tilt up. Press <space> and watch the whole thing start up.
To modify the admin username and admin password, create a tilt-settings.yaml file that contains the following values:
admin:
username: username
password: passwordAnd that's it. Tilt will automatically port-forward the tenant. And since tilt is using a process manager inside the pod to update the running binary, the port-forward will always point to the right thing.
To add additional files into the container like local_manifest.yaml just define a tilt-settings.yaml and add a statement
like this:
extra_files:
./local_manifest.yaml: /local_manifest.yamlMultiple files can be added this way.
Make sure to install swag (see Dependencies) before running any make commands.
Also, ensure that your GOPATH is available on your PATH. Contact the team if the issue persists.
The current project strucutre follows the picture below:

Eventually we will move out of local asynchronous jobs into a proper queue management system (either GCP PubSub/NATS, whichever is cheaper)
Firts make sure to create the debugger launch.json file in the .vscode directory inside the project
mkdir .vscode
touch .vscode/launch.json
Inside that file configure the debugger so you can run the code with the local env vars
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
// add env vars to the launch.json file
"version": "0.2.0",
"configurations": [
{
"type": "go",
"request": "launch",
"name": "Launch Program",
"program": "${workspaceFolder}/main.go",
"env": {
"LOCAL_DEVELOPMENT": "true",
"ADMIN_PASSWORD": "admin",
"ADMIN_USERNAME": "admin"
}
},
]
}
Be sure to run the database and expose its port locally (you can usekubectl -n tenant-manager port-forward svc/postgres 5432:5432).
Create one ore more breakpoints in code in a line where there is a statement (no comments or global declarations).
Hit play in the VSCode debugger.
