-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: Operator-bootstrapped schema #259
Comments
hello, is this feature still far away / not considered ? |
It's not on the radar, especially since it can be done with existing features, but we'd welcome a pull request (or an explanation of why it should be higher priority?) |
Hello, the existing feature support only "initiating" the datastore, and to use the |
I'd agree with @adel-chouchane. It would be great to have a way to only initialize or update the schema and not touch any of the relationships and other data. Also, I suppose the operator should flag a |
Proposal: SpiceDB Schema WatcherPurposeThis application is designed to continuously monitor a specified schema file and automatically update the schema in your SpiceDB instance whenever changes are detected, within a GitOps workflow. This ensures that your SpiceDB schema remains synchronized with your application's requirements while maintaining version control and automation.
Sidecar ApproachWhy ?
Deployment DiagramPatchesapiVersion: authzed.com/v1alpha1
kind: SpiceDBCluster
metadata:
name: spicedb
namespace: default
spec:
config:
image: ghcr.io/authzed/spicedb:v1.37.1
replicas: 1
datastoreEngine: postgres
secretName: dev-spicedb-config
patches:
- kind: Deployment
patch:
spec:
template:
spec:
volumes:
- name: bootstrap
configMap:
name: spicedb-bootstrap
containers:
- name: spicedb-schema-watcher
image: # image name here
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
readOnlyRootFilesystem: true
runAsGroup: 65532
runAsNonRoot: true
runAsUser: 65532
seccompProfile:
type: RuntimeDefault
volumeMounts:
- name: bootstrap
mountPath: /app/data
readOnly: true
env:
- name: SCHEMA_FILE_PATH
value: /app/data/init.yaml
- name: SPICEDB_KEY
valueFrom:
secretKeyRef:
name: dev-spicedb-config
key: preshared_key ConclusionThis solution might add another layer to the management of SpiceDB ecosystem, but unless there is an upgrade in the SpiceDB Operator to watch the used schemas and apply changes to the respective SpiceDB clusters, it's a solid approach to handle the schema with GitOps |
Hey @adel-chouchane that sounds like a reasonable approach, but I'm wondering if it might be more elegant to implement this logic inside the operator itself instead of creating a new sidecar. It seems like the solution would look similar to the secret adopter inside the operator. |
Hey @jackwellsxyz , indeed it's just a small workaround to patch things up until it's officially supported by the Operator. |
Ref: #115
The goal is to allow a user to supply a bootstrap file with schema and relationships to SpiceDB on start, via the kube apis.
Today
This is possible today via use of patches:
But this will bootstrap every time a spicedb starts or is re-scheduled, which is not ideal.
Proposal: Managed schema
A new field,
bootstrapConfigMapName
will be added:Similarly to how migrations are handled, when
bootstrapConfigMap
is set, the operator will:Job
:zed import
, with the referenced configmap mounted as source data.Job
run.Any changes to the configmap will re-run the job (via comparison to the hash in the status).
We will assume that anyone using this feature wants the bootstrap to be continually run on changes; we can document a
Job
spec that will run once for anyone that doesn't want continual reconciliation.Alternatives Considered
New APIs
A
Schema
orBootstrap
API might be nice, but the boostrap yaml file format is already well-defined and is consumable by SpiceDB and zed, so a ConfigMap is somewhat more straightforward (i.e. users can can take a file from playground and directly create it as a configmap with kubectl). There are also some in-flight discussions for changes to the local schema filesystem representation that we don't want to box ourselves out of.SpiceDB
--datastore-bootstrap-files
instead ofzed
The same general effect could be achieved by selectively turning the
--datastore-bootstrap-files
flag on and off on a SpiceDB pod, but it means that the pods will need to be rolled again after a successful bootstrap (to disable the boostrap). TheJob
approach avoids this.The text was updated successfully, but these errors were encountered: