Light Dark Auto

Initialize a Tenant Service

How to initiliaze greymatter configuration for a tenant project using GSL and the CLI.

Once you’ve generated a project with greymatter init, the next step is to get your service configs generated! Let’s check out our helpful guide init and see what it has to offer with service config generation.

greymatter init service --help

Initialize A Service

Service initialization is as easy as providing a service type, an output directory, a target namespace, and a name.

From the root of your greymatter project, run the following command overriding values as necessary:

greymatter init service --type=http --dir=greymatter/$PROJECT_NAME --namespace=$PROJECT_NAME kiwi

A fully functional, base kiwi.cue file is created in the greymatter/$MY_PROJECT directory using the default values for a service of type http.

Types Of Services

init has support for generating service configurations for various types of services. This can mean various things such as default enabled filters, SNI, TLS configurations, and more. A full list can be found in the help command but here are some of the supported types:

  • HTTP: --type=http
  • TCP: --type=tcp
  • AWS Lambda: --type=lambda

Deploying Your Service Manifests

Given you have an existing manifest for your service, first deploy it into an operator watched namespace with the proper sidecar annotations in the Kubernetes object metadata field:

# Deployment metadata
metadata:
  name: kiwi
  namespace: my-namespace
  annotations:
    greymatter.io/inject-sidecar-to: 10808

...

# Container spec metadata
# This is required to associate your service with the defined upstream in greymatter.
# __NOTE__ that the value provided on this annotation should be
# the key defined in your services proxy object.
metadata:
  labels:
    greymatter.io/cluster: kiwi

Your kubernetes manifest file should live in your greymatter project under the k8s/ folder. Once you’ve added the annotations to your manifests, make a commit to your remote repository that you pointed the deployed sync service to and push! After a few moments your service should show up in the greymatter.io intelligence dashboard and go green once the sidecar can reach the upstream service.

Next Steps