Skip to content

Commit

Permalink
updates schema configmap process to use template (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonytheleg authored Sep 4, 2024
1 parent 8f14488 commit b0cc615
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 39 deletions.
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,23 @@ You should have logged into a valid openshift cluster using the oc login command

#### Option 1: Using the config from app-interface (RedHat Internal only)

* Create a config map inside a local directory. You can refer to [here](https://github.com/project-kessel/relations-api/blob/main/deploy/schema-configmaps/ex-schema-configmap.yaml)
* NOTE: Please replace the "data" section, as per your needs (the schema portion)
* Create a config map inside a local temp directory. You can leverage the template [here](./deploy/schema-configmaps/schema-configmap-template.yaml). The template can be used to inject any schema definition file you like by providing the contents of a schema definition file as the parameter.
```shell
# Example, create a configmap using the current default schema
TEMP_DIR=$(mktemp -d)
# SCHEMA_FILE can be a path to any desired schema definition file in yaml format
SCHEMA_FILE=./deploy/schema.yaml
oc process --local \
-f deploy/schema-configmaps/schema-configmap-template.yaml \
-p SCHEMA="$(cat ${SCHEMA_FILE})" \
-o yaml > $TEMP_DIR/schema-configmap.yaml
```
* Run the following command:
* `bonfire deploy relations --import-configmaps --configmaps-dir <path-to-configmaps-dir>`
* `bonfire deploy relations --import-configmaps --configmaps-dir $TEMP_DIR`
#### Option 2: Using the deploy.sh script in this repository

Expand Down
36 changes: 0 additions & 36 deletions deploy/schema-configmaps/ex-schema-configmap.yaml

This file was deleted.

17 changes: 17 additions & 0 deletions deploy/schema-configmaps/schema-configmap-template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: spicedb-schema-template
annotations:
description: "SpiceDB Schema Template"
parameters:
- description: "spicedb schema yaml for relations API"
name: SCHEMA
objects:
- apiVersion: v1
kind: ConfigMap
metadata:
name: spicedb-schema
data:
schema.yaml: |-
${{SCHEMA}}

0 comments on commit b0cc615

Please sign in to comment.