SpiceDB Operator is Open Source
Published: 2024-01-10 16:33:48

---
title: SpiceDB Operator is Open Source
published: true
date: 2022-09-08 00:00:00 UTC
tags: 
canonical_url: https://authzed.com/blog/open-source-spicedb-operator
---

<iframe style="margin-bottom:-7px;" src="https://ghbtns.com/github-btn.html?user=authzed&amp;repo=spicedb-operator&amp;type=star&amp;count=true&amp;size=large" width="170" height="30" title="GitHub"></iframe>

Today we’re announcing the open sourcing of [spicedb-operator](https://github.com/authzed/spicedb-operator/) - a [Kubernetes operator](https://kubernetes.io/docs/concepts/extend-kubernetes/operator/) for installing, upgrading, and maintaining [SpiceDB](https://github.com/authzed/spicedb) clusters on Kubernetes. Through [previous work at CoreOS](https://techcrunch.com/2017/12/05/coreos-tectonic-1-8-makes-it-easy-to-plug-external-services-into-kubernetes/) and [Red Hat](https://operatorframework.io/), our team developed many of the early ideas around operators. As we began to scale out the deployment of SpiceDB clusters across our fleet to address the needs of our customers, an operator was the natural choice.

## Running in production for 4 months

The operator has been quietly managing SpiceDB clusters for [Authzed’s Serverless and Dedicated](https://authzed.com/pricing) offerings for the past four months. It's production-ready and available today!

To get started yourself, install the operator:

```
kubectl apply --server-side -k github.com/authzed/spicedb-operator/config

```

And then create a cluster:

```
kubectl apply --server-side -f - <<EOF
apiVersion: authzed.com/v1alpha1
kind: SpiceDBCluster
metadata:
  name: dev
spec:
  config:
    replicas: 2
    datastoreEngine: postgres
  secretName: dev-spicedb-config
---
apiVersion: v1
kind: Secret
metadata:
  name: dev-spicedb-config
stringData:
  datastore_uri: "postgresql:///the-url-of-your-datastore"
  preshared_key: "averysecretpresharedkey"
EOF

```

Once a cluster is running, the operator will automatically run migrations and roll out new SpiceDB releases as they become available. Or, by pinning a cluster to a specific release, the operator can be used to coordinate the rollout of migrations in git-ops workflows.

The operator also simplifies the configuration of multi-node clusters and TLS - for more information, check out the [examples](https://github.com/authzed/spicedb-operator/tree/main/examples) and the [docs](https://docs.authzed.com/operator/installing).

## Listen up, idioms!

We’ve also open-sourced [controller-idioms](https://github.com/authzed/controller-idioms), the library we developed to support SpiceDB Operator and other operators that we use to run [Authzed Dedicated](https://authzed.com/pricing). We found ourselves solving some of the same problems in every operator we wrote, and built this microframework to standardize common patterns across our stack.

This new library:

- Works with other (golang-based) tooling like [client-go](https://github.com/kubernetes/client-go) and [controller-runtime](https://github.com/kubernetes-sigs/controller-runtime).
- Uses golang [generics](https://gobyexample.com/generics) to simplify dealing with Kubernetes APIs, informers, and indexes.
- Implements common patterns for resource adoption, ownership, status, and metrics.
- Provides a framework for breaking down large controller statemachines into small, testable pieces.

If you’re developing an operator of your own, please check out controller-idioms and let us know what’s missing in the [GitHub issues](https://github.com/authzed/controller-idioms/issues).

## Join the Conversation

Don’t see something you want? Let us know in the [GitHub issues](https://github.com/authzed/spicedb-operator/issues) what you’d like to see from the operator in the future, and don’t hesitate to reach out on [discord](https://authzed.com/discord) with any questions or feedback.

_Header image generated with DALL·E 2 with prompt "a robot putting a database icon in a kubernetes cluster"_