sherlock

module
v0.0.111 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: BSD-3-Clause

README

Sherlock

codecov Go Report Card latest build Quality Gate Status

DSP DevOps's Source-of-Truth Service

Sherlock stores information about our Kubernetes-based deployments, including Helm Chart versions and application versions. Sherlock doesn't do the deploying itself--it offers an API that other tools can use to understand our infrastructure.

The primary clients are Beehive, a UI for changing the information stored in Sherlock, and Thelma, a CLI that combines Sherlock's knowledge with Helm, ArgoCD, and Kubernetes APIs to directly manage infrastructure.

Project Structure

Sherlock is a Golang server relying on a Postgres database.

Two API versions currently co-exist:

  • V1, which was developed to listen to our infrastructure and record Accelerate Metric data
  • V2, which was developed to be the deployment source-of-truth

Most references to Sherlock are talking about the newer V2 API. V1 will be more formally deprecated or removed once V2 is producing similar metrics.

An overview of different interactions with Sherlock:

V1 V2
API Endpoint :8080/api/v1 :8080/api/v2
Swagger Endpoint :8080/swagger/index.html
Prometheus Endpoint :8080/metrics :8080/metrics
Go Client Library ./clients/go
TypeScript (Fetch) Client Library ./clients/typescript-fetch
CLI ./cmd/cli/main.go Via Thelma
GitHub Actions Via CLI Via Thelma and ./.github/workflows/client-*
UI Via Beehive

Sherlock is meant to be deployed behind Google Cloud's Identity-Aware Proxy. The V2 API connects to Google Workspace's Admin API to evaluate permissions of the calling users.

Developing Locally

There's a makefile that calls out to a docker-compose to help spin up Sherlock and a database locally. make local-up will get you started. make local-stop or Ctrl+C will stop it, while make local-down will wipe the data in the database. ./build contains the Docker setup.

Database structure lives in ./db; migrations will be applied when Sherlock starts up. Configuration lives in ./config; also applied during startup.

./docs will get autogenerated by running make generate-swagger, while ./clients gets generated by CI upon merge.

That leaves ./cmd for the Go entrypoints and ./internal for all of Sherlock's main code.

Directories

Path Synopsis
clients
cmd
cli
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
Package docs GENERATED BY SWAG; DO NOT EDIT This file was generated by swaggo/swag
go-shared module
internal
cli
cli/v2
v2 contains cobra cli command implementations for interact with sherlock v2 apis
v2 contains cobra cli command implementations for interact with sherlock v2 apis
controllers/v1controllers
Package environments defines data structure representing a environment instance and methods for interacting with them it is left to concrete implementations in package db or others to implement these interfaces
Package environments defines data structure representing a environment instance and methods for interacting with them it is left to concrete implementations in package db or others to implement these interfaces
db
sherlock module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL