Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions examples/postgres/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# How to use this example

This Promise was generated with using kratix CLI:

```bash
kratix init promise database --group demo.kratix.io --kind Database
```

To see this example promise working, you need to build and load two images to your environment:
1. promise configure workflow container image
2. resource configure workflow container image

You can build and load the promise configure workflow image by running:
```bash
docker build -t kratix-demo/promise-pipeline:v0.1.0 workflows/promise/configure/dependencies/configure-deps
kind load docker-image kratix-demo/promise-pipeline:v0.1.0 -n <your-local-kind-cluster>
```

For the resource configure workflow, run:
```bash
docker build -t kratix-demo/resource-pipeline:v0.1.0 workflows/resource/configure/database-configure/kratix-demo-resource-pipeline
kind load docker-image kratix-demo/resource-pipeline:v0.1.0 -n <your-local-kind-cluster>
```

After making these two images available in your k8s cluster, you can install the promise:
```bash
kubectl apply -f promise.yaml
```

you can request a database by:
```bash
kubectl apply -f example-resource.yaml
```
6 changes: 6 additions & 0 deletions examples/postgres/example-resource.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: demo.kratix.io/v1beta1
kind: Database
metadata:
name: example-database
spec:
size: "1Gi"
62 changes: 62 additions & 0 deletions examples/postgres/promise.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
apiVersion: platform.kratix.io/v1alpha1
kind: Promise
metadata:
creationTimestamp: null
labels:
kratix.io/promise-version: v0.0.1
name: database
spec:
api:
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: databases.demo.kratix.io
spec:
group: demo.kratix.io
names:
kind: Database
plural: databases
singular: database
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
properties:
spec:
properties:
size:
type: string
type: object
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null
workflows:
promise:
configure:
- apiVersion: platform.kratix.io/v1alpha1
kind: Pipeline
metadata:
name: dependencies
spec:
containers:
- image: kratix-demo/promise-pipeline:v0.1.0
name: configure-deps
resource:
configure:
- apiVersion: platform.kratix.io/v1alpha1
kind: Pipeline
metadata:
name: database-configure
spec:
containers:
- image: kratix-demo/resource-pipeline:v0.1.0
name: kratix-demo-resource-pipeline
status: {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM "alpine"

RUN apk update && apk add --no-cache yq

ADD scripts/pipeline.sh /usr/bin/pipeline.sh
ADD resources resources

RUN chmod +x /usr/bin/pipeline.sh

CMD [ "sh", "-c", "pipeline.sh" ]
ENTRYPOINT []
Loading