Skip to content

Commit 34d5194

Browse files
committed
docs: add postgres example promise
1 parent 0e62ed5 commit 34d5194

File tree

11 files changed

+2082
-0
lines changed

11 files changed

+2082
-0
lines changed

examples/postgres/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# How to use this example
2+
3+
This Promise was generated with using kratix CLI:
4+
5+
```bash
6+
kratix init promise database --group demo.kratix.io --kind Database
7+
```
8+
9+
To see this example promise working, you need to build and load two images to your environment:
10+
1. promise configure workflow container image
11+
2. resource configure workflow container image
12+
13+
You can build and load the promise configure workflow image by running:
14+
```bash
15+
docker build -t kratix-demo/promise-pipeline:v0.1.0 workflows/promise/configure/dependencies/configure-deps
16+
kind load docker-image kratix-demo/promise-pipeline:v0.1.0 -n <your-local-kind-cluster>
17+
```
18+
19+
For the resource configure workflow, run:
20+
```bash
21+
docker build -t kratix-demo/resource-pipeline:v0.1.0 workflows/resource/configure/database-configure/kratix-demo-resource-pipeline
22+
kind load docker-image kratix-demo/resource-pipeline:v0.1.0 -n <your-local-kind-cluster>
23+
```
24+
25+
After making these two images available in your k8s cluster, you can install the promise:
26+
```bash
27+
kubectl apply -f promise.yaml
28+
```
29+
30+
you can request a database by:
31+
```bash
32+
kubectl apply -f example-resource.yaml
33+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: demo.kratix.io/v1beta1
2+
kind: Database
3+
metadata:
4+
name: example-database
5+
spec:
6+
size: "1Gi"

examples/postgres/promise.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
apiVersion: platform.kratix.io/v1alpha1
2+
kind: Promise
3+
metadata:
4+
creationTimestamp: null
5+
labels:
6+
kratix.io/promise-version: v0.0.1
7+
name: database
8+
spec:
9+
api:
10+
apiVersion: apiextensions.k8s.io/v1
11+
kind: CustomResourceDefinition
12+
metadata:
13+
creationTimestamp: null
14+
name: databases.demo.kratix.io
15+
spec:
16+
group: demo.kratix.io
17+
names:
18+
kind: Database
19+
plural: databases
20+
singular: database
21+
scope: Namespaced
22+
versions:
23+
- name: v1beta1
24+
schema:
25+
openAPIV3Schema:
26+
properties:
27+
spec:
28+
properties:
29+
size:
30+
type: string
31+
type: object
32+
type: object
33+
served: true
34+
storage: true
35+
status:
36+
acceptedNames:
37+
kind: ""
38+
plural: ""
39+
conditions: null
40+
storedVersions: null
41+
workflows:
42+
promise:
43+
configure:
44+
- apiVersion: platform.kratix.io/v1alpha1
45+
kind: Pipeline
46+
metadata:
47+
name: dependencies
48+
spec:
49+
containers:
50+
- image: kratix-demo/promise-pipeline:v0.1.0
51+
name: configure-deps
52+
resource:
53+
configure:
54+
- apiVersion: platform.kratix.io/v1alpha1
55+
kind: Pipeline
56+
metadata:
57+
name: database-configure
58+
spec:
59+
containers:
60+
- image: kratix-demo/resource-pipeline:v0.1.0
61+
name: kratix-demo-resource-pipeline
62+
status: {}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM "alpine"
2+
3+
RUN apk update && apk add --no-cache yq
4+
5+
ADD scripts/pipeline.sh /usr/bin/pipeline.sh
6+
ADD resources resources
7+
8+
RUN chmod +x /usr/bin/pipeline.sh
9+
10+
CMD [ "sh", "-c", "pipeline.sh" ]
11+
ENTRYPOINT []

0 commit comments

Comments
 (0)