Fleet Manager Golang Template

Overview

Fleet Manager Golang Template

This project is an example fleet management service. Fleet managers govern service instances across a range of cloud provider infrastructure and regions. They are responsible for service placement, service lifecycle including blast radius aware upgrades,control of the operators handling each service instance, DNS management, infrastructure scaling and pre-flight checks such as quota entitlement, export control, terms acceptance and authorization. They also provide the public APIs of our platform for provisioning and managing service instances.

To help you while reading the code the example service implements a simple collection of dinosaurs and their provisioning, so you can immediately know when something is infrastructure or business logic. Anything that talks about dinosaurs is business logic, which you will want to replace with your our concepts. The rest is infrastructure, and you will probably want to preserve without change.

For a real service written using the same fleet management pattern see the kas-fleet-manager.

To contact the people that created this template go to zulip.

Prerequisites

Using the template for the first time

The implementation talks about the main components of this template. To bootstrap your application, after cloning the repository.

  1. Replace dinosaurs placeholder with your own business entity / objects
  2. Implement code that have TODO comments
    // TODO

Run for the first time

Please make sure you have followed all of the prerequisites above first and the populating configuration guide.

  1. Compile the binary
make binary
  1. Clean up and Creating the database

    • Create database tables
    make db/setup && make db/migrate
    
    • Optional - Verify tables and records are created
    make db/login
    
    # List all the tables
    serviceapitests# \dt
    
    
  2. Start the service

    ./fleet-manager serve
    

    NOTE: The service has numerous feature flags which can be used to enable/disable certain features of the service. Please see the feature flag documentation for more information.

  3. Verify the local service is working

    curl -H "Authorization: Bearer $(ocm token)" http://localhost:8000/api/dinosaurs_mgmt/v1/dinosaurs
    {"kind":"DinosaurRequestList","page":1,"size":0,"total":0,"items":[]}
    

    NOTE: Change dinosaur to your own rest resource

Using the Service

View the API docs

# Start Swagger UI container
make run/docs

# Launch Swagger UI and Verify from a browser: http://localhost:8082

# Remove Swagger UI conainer
make run/docs/teardown

Additional CLI commands

In addition to the REST API exposed via make run, there are additional commands to interact directly with the service (i.e. cluster creation/scaling, Dinosaur creation, Errors list, etc.) without having to use a REST API client.

To use these commands, run make binary to create the ./fleet-manager CLI.

Run ./fleet-manager -h for information on the additional commands.

Environments

The service can be run in a number of different environments. Environments are essentially bespoke sets of configuration that the service uses to make it function differently. Environments can be set using the OCM_ENV environment variable. Below are the list of known environments and their details.

  • development - The staging OCM environment is used. Sentry is disabled. Debugging utilities are enabled. This should be used in local development.
  • testing - The OCM API is mocked/stubbed out, meaning network calls to OCM will fail. The auth service is mocked. This should be used for unit testing.
  • integration - Identical to testing but using an emulated OCM API server to respond to OCM API calls, instead of a basic mock. This can be used for integration testing to mock OCM behaviour.
  • production - Debugging utilities are disabled, Sentry is enabled. environment can be ignored in most development and is only used when the service is deployed.

Additional docs

Contributing

See the contributing guide for general guidelines on how to contribute back to the template.

Comments
  • docs: extend observability populating doc

    docs: extend observability populating doc

    Description

    • Extend observability populating doc
    • Minor formatting changes

    Verification Steps

    Checklist (Definition of Done)

    • [ ] All acceptance criteria specified in JIRA have been completed
    • [ ] Unit and integration tests added that prove the fix is effective or the feature works (tested against emulated and non-emulated OCM environment)
    • [ ] Documentation added for the feature
    • [ ] CI and all relevant tests are passing
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Required metrics/dashboards/alerts have been added (or PR created).
    • [ ] Required Standard Operating Procedure (SOP) is added.
    • [ ] JIRA has created for changes required on the client side
    opened by miguelsorianod 9
  • docs(fleetshard): add links to fleetshard pattern

    docs(fleetshard): add links to fleetshard pattern

    Description

    Fixes https://github.com/bf2fc6cc711aee1a0c2a/ffm-project/issues/14

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 5
  • docs(contributing): add updates proposal

    docs(contributing): add updates proposal

    Description

    Everything in the PR title

    Verification Steps

    Checklist (Definition of Done)

    • [ ] All acceptance criteria specified in JIRA have been completed
    • [ ] Unit and integration tests added that prove the fix is effective or the feature works (tested against emulated and non-emulated OCM environment)
    • [ ] Documentation added for the feature
    • [ ] CI and all relevant tests are passing
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Required metrics/dashboards/alerts have been added (or PR created).
    • [ ] Required Standard Operating Procedure (SOP) is added.
    • [ ] JIRA has created for changes required on the client side
    opened by machi1990 3
  • skip failing integration tests by default

    skip failing integration tests by default

    Description

    Skip failing integration tests by default. This is useful as it enables integration tests to be used to identify regressions from day 1.

    Verification Steps

    Run integration tests with "emulated" OCM, as described in docs/automated-testing.md The entire testsuite should pass.

    Checklist (Definition of Done)

    • [x] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by jharting 2
  • fix: bring dinosaur owner check

    fix: bring dinosaur owner check

    Description

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • fix(db): ensure enable-db-debug is honored and prints SQL statements

    fix(db): ensure enable-db-debug is honored and prints SQL statements

    Description

    Apply https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/949 patch!

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • docs(test): update integration test setup guide

    docs(test): update integration test setup guide

    Fixes https://github.com/bf2fc6cc711aee1a0c2a/ffm-project/issues/22

    Description

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • refactor(db): remove sql helper file as it is not used anymore

    refactor(db): remove sql helper file as it is not used anymore

    Description

    Related to https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/927 and has to be merged once https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/927 has been merge

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • add a Makefile target for creating empty secret files, needed to boot the service locally

    add a Makefile target for creating empty secret files, needed to boot the service locally

    Description

    add a Makefile target for creating empty secret files, needed to boot the service locally

    Verification Steps

    Checklist (Definition of Done)

    • [x] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by jharting 1
  • refactor: remove a bunch of TODO that are not meant to be replaced by the user

    refactor: remove a bunch of TODO that are not meant to be replaced by the user

    Also centralise some constants in the constants directory

    Description

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • chore: update gocloak version

    chore: update gocloak version

    This follows up the work one in https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/847

    Description

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 1
  • chore(backport): apply changes to configure the auth server claims

    chore(backport): apply changes to configure the auth server claims

    Description

    This apply changes https://github.com/bf2fc6cc711aee1a0c2a/kas-fleet-manager/pull/902 to allow the fleet manager to be used against any other auth server since we can configure how the required claims are to be retrieved

    Verification Steps

    Checklist (Definition of Done)

    • [ ] Documentation added for the feature
    • [ ] Code Review completed
    • [ ] Verified independently by reviewer
    • [ ] Equivalent Github Pull Request or an issue has been opened on the Quarkus based template
    opened by machi1990 0
Owner
bf2fc6cc711aee1a0c2a82e312df7f2e6b37baa12bd9b1f2fd752e260d93a6f8144ac730947f25caa2bfe6ad0f410da360940ee6d28d6c1688d3822c4055650e
bf2fc6cc711aee1a0c2a82e312df7f2e6b37baa12bd9b1f2fd752e260d93a6f8144ac730947f25caa2bfe6ad0f410da360940ee6d28d6c1688d3822c4055650e
Go-project-template - Template for a golang project

This is a template repository for golang project Usage Go to github: https://git

KyberNetwork 4 Oct 25, 2022
Wrapper package for Go's template/html to allow for easy file-based template inheritance.

Extemplate Extemplate is a small wrapper package around html/template to allow for easy file-based template inheritance. File: templates/parent.tmpl <

Danny van Kooten 51 Nov 13, 2022
Fast, powerful, yet easy to use template engine for Go. Optimized for speed, zero memory allocations in hot paths. Up to 20x faster than html/template

quicktemplate A fast, powerful, yet easy to use template engine for Go. Inspired by the Mako templates philosophy. Features Extremely fast. Templates

Aliaksandr Valialkin 2.6k Nov 29, 2022
Simple system for writing HTML/XML as Go code. Better-performing replacement for html/template and text/template

Simple system for writing HTML as Go code. Use normal Go conditionals, loops and functions. Benefit from typing and code analysis. Better performance than templating. Tiny and dependency-free.

Nelo Mitranim 4 Apr 13, 2022
A template to build dynamic web apps quickly using Go, html/template and javascript

gomodest-template A modest template to build dynamic web apps in Go, HTML and sprinkles and spots of javascript. Why ? Build dynamic websites using th

Adnaan Badr 87 Nov 23, 2022
Made from template temporalio/money-transfer-project-template-go

Temporal Go Project Template This is a simple project for demonstrating Temporal with the Go SDK. The full 20 minute guide is here: https://docs.tempo

MarkGorewicz 0 Jan 6, 2022
Go-api-template - A rough template to give you a starting point for your API

Golang API Template This is only a rough template to give you a starting point f

Only Tunes Radio 3 Jan 14, 2022
Api-go-template - A simple Go API template that uses a controller-service based model to build its routes

api-go-template This is a simple Go API template that uses a controller-service

Pedro Espíndula 1 Feb 18, 2022
A general purpose golang CLI template for Github and Gitlab

golang-cli-template A general purpose project template for golang CLI applications This template serves as a starting point for golang commandline app

null 22 Dec 2, 2022
Clean arch Golang template project

Template No previous versions, still working on this one to reach v1. API Service for pssword app mobilde based on : https://github.com/bxcodec/go-cle

Diego Alberto León López 2 Sep 15, 2021
Template for Golang rest API using Fiber

Rest API Setup DB sudo -S docker-compose -f db.yml up -d Build container sudo -S docker build -t rest-api-image . Run container from image sudo -S doc

Daniel Svitan 2 Dec 5, 2021
Clean Architecture template for Golang services

Go Clean template Clean Architecture template for Golang services Overview The purpose of the template is to show: how to organize a project and preve

null 7 Jul 11, 2022
Clean Architecture template for Golang services

Go Clean template Clean Architecture template for Golang services Overview The purpose of the template is to show: how to organize a project and preve

Gabe Hoban 0 Nov 30, 2021
A Go Template Library. A bunch of utils and collections that are not part of the Golang standard library.

gotl A Go Template Library. A bunch of utils and collections that are not part of the Golang standard library. Prerequisites This library is using ext

null 1 Dec 15, 2021
Competitive Programming Template for Golang

Go Competitive Programming Template How to use this repo? Check the commit histo

Tien La 0 Dec 19, 2021
Template user CRUD operations with golang, JWT, postgres

user-api-golang A CRUD API template for perform operations on users. Written in golang. Components Server: Golang with go-chi as mux and zap for loggi

Amandeep Singh 0 Dec 26, 2021
Template for depency injection in golang (no libraries)

Go Dependency Injection (No libraries) Project template based on the most common layered architecture style, made to explain how to do dependency inje

Yael 2 Mar 30, 2022
Golang Service Template

Golang Service Template Golang back-end service template. Using this template, you can get started with back-end projects quickly. Web Framework ORM D

Ralph 18 Jun 8, 2022
This is a simple GoLang script template.

This is a simple GoLang script template.

Vladimir Glusic 1 Oct 25, 2022