Skip to content

Instantly share code, notes, and snippets.

@lawrencejones
Last active April 24, 2023 13:04
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lawrencejones/b209a1a5da864b987cbedb1dffef6116 to your computer and use it in GitHub Desktop.
Save lawrencejones/b209a1a5da864b987cbedb1dffef6116 to your computer and use it in GitHub Desktop.
Why you need a service registry
{
"spec": {
"alertsChannel": "specialops",
"deploysChannel": "deploys",
"environments": [
{
"spec": {
"googleProject": "gc-prd-make-it-stag-833e",
"name": "staging",
"rbac": {
"admins": [
"banking-integrations"
],
"operators": [
"core-banking"
],
"viewers": [ ]
},
"targets": [
{
"spec": {
"autoSync": false,
"context": "compute-staging-brava",
"id": "compute-staging-brava/make-it-rain/make-it-rain",
"namespace": "make-it-rain",
"release": "make-it-rain",
"revision": "HEAD",
"strategy": "Argo"
},
"type": "Target"
}
]
},
"type": "Environment"
},
{
"spec": {
"googleProject": "gc-prd-make-it-prod-1eb1",
"name": "production",
"rbac": {
"admins": [
"banking-integrations"
],
"operators": [
"core-banking",
"banking-operations"
],
"viewers": [ ]
},
"targets": [
{
"spec": {
"autoSync": false,
"context": "compute-banking",
"id": "compute-banking/make-it-rain/make-it-rain",
"namespace": "make-it-rain",
"release": "make-it-rain",
"revision": "HEAD",
"strategy": "Argo"
},
"type": "Target"
}
]
},
"type": "Environment"
}
],
"googleServices": [
"pubsub.googleapis.com"
],
"name": "make-it-rain",
"repository": "gocardless/make-it-rain",
"team": "banking-integrations"
},
"type": "Service"
}
local utopia = import 'utopia/utopia/registry.libsonnet';
local service = utopia.registry.service;
local environment = utopia.registry.environment;
local argocd = utopia.registry.target.argo;
// Example service called make-it-rain, powering a dashboard of falling
// gold coins whenever anyone takes a payment via GoCardless.
//
// Banking teams love money, which is why they created this dashboard.
// It's officially owned by banking-integrations, but core-banking
// sometimes optimise the React code.
//
// It consumes data about new payments from Google Pub/Sub, and has a
// separate Google Cloud Platform project for each of its environments,
// of which there are two: staging and production.
service.new('make-it-rain', 'gocardless/make-it-rain') +
service.mixin.withTeam('banking-integrations') +
service.mixin.withGoogleServices([
'pubsub.googleapis.com',
]) +
service.mixin.withEnvironments([
environment.map(
// By default, every environment should have banking-integrations as
// admins, and core-banking as operators (they provide on-call cover
// for the falling gold coins).
environment.mixin.rbac.withAdmins('banking-integrations') +
environment.mixin.rbac.withOperators('core-banking'),
function(environment) [
environment.new('staging') +
environment.mixin.withGoogleProject('gc-prd-make-it-stag-833e') +
environment.mixin.withTargets([
argocd.new(context='compute-staging-brava', namespace='make-it-rain'),
]),
// Unlike most services, the production environment should permit
// a non-engineering team to open consoles. Sometimes we take a
// manual payment outside of GoCardless, and banking-operations
// open a make-it-rain console and run a script, so we don't miss
// any gold coins.
environment.new('production') +
environment.mixin.rbac.withOperatorsMixin('banking-operations') +
environment.mixin.withGoogleProject('gc-prd-make-it-prod-1eb1') +
environment.mixin.withTargets([
argocd.new(context='compute-banking', namespace='make-it-rain'),
]),
],
),
])
make-it-rain.json: make-it-rain.jsonnet
jsonnet -J $(ANU_ROOT)/utopia/lib -J $(ANU_ROOT)/utopia/jvendor $^ > $@
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment