From 101ee2706b7d4933329152476409e039e56a557f Mon Sep 17 00:00:00 2001 From: Derik Evangelista Date: Mon, 4 Nov 2024 16:18:20 +0000 Subject: [PATCH 1/3] chore: simplify destination selectors explanation by: - registering the platform cluster with the label from the start - explaining the concept after seeing it working --- docs/workshop/part-i/01-installing-kratix.md | 6 +- docs/workshop/part-i/03-multiple-promise.md | 135 ++++++++++--------- 2 files changed, 78 insertions(+), 63 deletions(-) diff --git a/docs/workshop/part-i/01-installing-kratix.md b/docs/workshop/part-i/01-installing-kratix.md index 4b098259..fb999f3b 100644 --- a/docs/workshop/part-i/01-installing-kratix.md +++ b/docs/workshop/part-i/01-installing-kratix.md @@ -103,6 +103,7 @@ Check the Kubernetes documentation for further details on [Custom Resources](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/) and [Custom Resources Definition](https://kubernetes.io/docs/tasks/extend-kubernetes/custom-resources/custom-resource-definitions/). + Verify the Kratix deployment: @@ -353,7 +354,7 @@ through similar steps you ran during the worker cluster Destination registration There's a script in the `kratix` directory that will do exactly that. This script replicates the setup you performed previously in the [Destination setup](./installing-kratix#destination-setup) section. Run: ```bash -./scripts/register-destination --name platform-cluster --context $PLATFORM --state-store default --strict-match-labels +./scripts/register-destination --name platform-cluster --context $PLATFORM --state-store default --strict-match-labels --with-label environment=platform ``` The platform cluster should now be registered with Kratix and ready to receive @@ -364,6 +365,7 @@ kubectl --context $PLATFORM get destinations ``` The above command will give an output similar to: + ```shell-session NAME AGE platform-cluster 1m @@ -377,6 +379,7 @@ kubectl --context $PLATFORM get namespaces --watch ``` The above command will give an output similar to: + ```shell-session NAME STATUS AGE ... @@ -402,5 +405,6 @@ To recap the steps you took: 1. ✅  Told Kratix about the worker and platform clusters, as Destinations ## 🎉 Congratulations + ✅ Kratix is now installed and configured!
👉🏾 [Next you will deploy your first Promise](./installing-a-promise). diff --git a/docs/workshop/part-i/03-multiple-promise.md b/docs/workshop/part-i/03-multiple-promise.md index 929aa692..cf055362 100644 --- a/docs/workshop/part-i/03-multiple-promise.md +++ b/docs/workshop/part-i/03-multiple-promise.md @@ -4,6 +4,7 @@ title: Using Compound Promises id: multiple-promises slug: ../multiple-promises --- + ```mdx-code-block import CompoundPromiseDiagram from "/img/docs/workshop/compound-promise-diagram.svg" import PavedPathDiagram from "/img/docs/workshop/compound-promise-paved-path-diagram.svg" @@ -75,6 +76,7 @@ kubectl --context $PLATFORM get pods --namespace kratix-platform-system ``` The above command will give an output similar to: + ```shell-session NAME READY STATUS RESTARTS AGE kratix-platform-controller-manager-7cc49f598b-zqkmz 2/2 Running 0 4h4m @@ -114,82 +116,104 @@ kubectl --context $PLATFORM get promises --watch The above command will eventually include the following output: ```shell-session +easyapp Unavailable EasyApp example.promise.syntasso.io/v1 +easyapp Unavailable EasyApp example.promise.syntasso.io/v1 +easyapp Unavailable EasyApp example.promise.syntasso.io/v1 easyapp Available EasyApp example.promise.syntasso.io/v1 ``` -Once you see the "Available", press Ctrl+C to -exit the watch mode. +Once the EasyApp promise becomes "Available", you should see the sub-Promises +getting automatically installed. If you haven't killed the watch command, you +should see the following output appearing: -At this point, you may be asking yourself: _"Wait, wasn't the EasyApp Promise supposed to install three Promises? Why is there only one?"_ - -That's because the EasyApp Promise makes use of the Kratix _Destination Selectors_ feature. +```shell-session +nginx-ingress +postgresql +nginx-ingress Unavailable deployment marketplace.kratix.io/v1alpha1 +postgresql Unavailable postgresql marketplace.kratix.io/v1alpha1 +... +nginx-ingress Available deployment marketplace.kratix.io/v1alpha1 +postgresql Available postgresql marketplace.kratix.io/v1alpha1 +``` -Destination Selectors allow Promises to specify scheduling logic to determine the suitable Destinations for hosting Dependencies and workloads. +Once all promises are "Available", press Ctrl+C to +exit the watch mode. -You can verify the EasyApp Destination Selector by describing the Promise: +The dependencies for the sub-Promises, on the other hands, are installed on the Worker +destination. You can validate that by checking the deployments on the Worker: ```bash -kubectl --context $PLATFORM describe promise easyapp | tail -n 30 | \ - grep "Destination Selectors" --after-context 2 --max-count 1 +kubectl --context $WORKER get deployments --watch ``` -The above command will give an output similar to: +The above command will give an output similar to (it may take a few minutes for +it to appear and to start): + ```shell-session -Destination Selectors: - Match Labels: - Environment: platform +NAME READY UP-TO-DATE AVAILABLE AGE +nginx-nginx-ingress 1/1 1 1 1m +postgres-operator 1/1 1 1 1m ``` -This means the EasyApp Promise is telling Kratix: +When the deployments eventually complete, press Ctrl+C to exit. + +## Understanding Destination Selectors -> Only install my Dependencies (i.e., the NGINX and the PostgreSQL Promises) in -> Destinations with the **label environment=platform**. +You may be asking yourself: how did Kratix know it should install the +Sub-promises on the Platform cluster? And how did it know to install the NGINX +and the PostgreSQL Promises dependencies on the Worker cluster? -Check the registered Destinations again, but this time ask `kubectl` to also show the Destination labels: +The answer is: **Destination Selectors**. + +Destination Selectors are a powerful feature in Kratix that allows Promises to +specify where their dependencies and resources should be scheduled to. Similar +to how Kubernetes uses labels to select resources, Kratix uses Destination +Selectors to select Destinations. + +You can verify the EasyApp Destination Selectors by describing the Promise: ```bash -kubectl --context $PLATFORM get destinations --show-labels +kubectl --context $PLATFORM describe promise easyapp | tail -n 30 | \ + grep "Destination Selectors" --after-context 2 --max-count 1 ``` The above command will give an output similar to: + ```shell-session -NAME AGE LABELS -platform-cluster 10m -worker-cluster 1h environment=dev +Destination Selectors: + Match Labels: + Environment: platform ``` -
- +This tells Kratix: -
+> Only install the EasyApp Dependencies (i.e., the NGINX and the PostgreSQL +> Promises) in Destinations with the **label environment=platform**. -Note that the platform cluster is missing the required label. Adding the missing -label should cause the system to converge to the desired state: +So, on the Platform Destination, you should have a label `environment=platform`. Verify: ```bash -kubectl --context $PLATFORM label destination platform-cluster environment=platform; \ -kubectl --context $PLATFORM get promises --watch +kubectl --context $PLATFORM get destination platform-cluster --show-labels ``` -The above command will eventually converge to an output similar to: +The above command will give an output similar to: + ```shell-session -NAME STATUS KIND API VERSION VERSION -easyapp Available EasyApp example.promise.syntasso.io/v1 -nginx-ingress Available deployment marketplace.kratix.io/v1alpha1 -postgresql Available postgresql marketplace.kratix.io/v1alpha1 +NAME AGE LABELS +platform-cluster 1h environment=platform ``` -Once you see the expected three Promises, press Ctrl+C to -exit the watch mode. -
Sequence of events during the installation of a Compound Promise
-Once the sub-Promises are installed, their Dependencies will be scheduled to a -Destination. The EasyApp sub-Promises are also declaring a Destination Selector. -Verify: +That explains why the NGINX and the PostgreSQL Promises were installed on the +Platform cluster. But how did the dependencies of those Promises end up on the +Worker cluster? + +Once again, Destination Selectors are the answer. Check the destination +selectors defined in the NGINX and the PostgreSQL Promises: ```bash kubectl --context $PLATFORM describe promise nginx-ingress | grep "Destination Selectors:" -A 2 -m 1 @@ -197,6 +221,7 @@ kubectl --context $PLATFORM describe promise postgresql | grep "Destination Sele ``` The above command will give an output similar to: + ```shell-session Destination Selectors: Match Labels: @@ -208,37 +233,21 @@ The NGINX and the PostgreSQL Promises are telling Kratix: > Only install my Dependencies (which include, the NGINX Ingress Controller and the > PostgreSQL operator) in Destinations with the **label environment=dev**. -As you may have noted before, the worker cluster is already labelled correctly. -Verify: +Similarly, if you check the Worker Destination, you should see the label +`environment=dev`: ```bash kubectl --context $PLATFORM get destination worker-cluster --show-labels ``` The above command will give an output similar to: + ```shell-session NAME AGE LABELS worker-cluster 1h environment=dev ``` -Since the worker Destination includes the label, the NGINX and PostgreSQL Promise -Dependencies should be getting installed into the worker cluster. Verify: - -```bash -kubectl --context $WORKER get deployments --watch -``` - -The above command will give an output similar to (it may take a few minutes for -it to appear and to start): - -```shell-session -NAME READY UP-TO-DATE AVAILABLE AGE -nginx-nginx-ingress 1/1 1 1 1m -postgres-operator 1/1 1 1 1m -``` - -When the deployments eventually complete, press Ctrl+C to -exit. +The entire installation process is summarised in the diagram below:
@@ -246,7 +255,6 @@ exit.
Full sequence of events during the installation of the Compound Promise
-Platform users can go ahead and start using the Promises! :::info Managing a Fleet of Destinations @@ -264,6 +272,7 @@ If you are curious to learn more about Kratix scheduling, check the ::: +Your Platform is now ready to deploy EasyApps! ## Request an EasyApp @@ -275,6 +284,7 @@ kubectl --context $PLATFORM get promises ``` The above command will give an output similar to: + ```shell-session NAME STATUS KIND API VERSION VERSION easyapp Available EasyApp example.promise.syntasso.io/v1 @@ -305,6 +315,7 @@ EOF ``` The above command will give an output similar to: + ```shell-session easyapp.example.promise.syntasso.io/example created ``` @@ -313,7 +324,6 @@ The EasyApp Promise will take that request and generate the necessary requests for the sub-Promises, wiring up the application to the Postgres service. -
@@ -322,12 +332,12 @@ service. Verify the Workflows running on the platform cluster: - ```bash kubectl --context $PLATFORM get pods --watch ``` The above command will give an output similar to: + ```shell-session NAME READY STATUS RESTARTS AGE kratix-easyapp-example-instance-configure-43a5e-x7sdg 0/1 Completed 0 45s @@ -351,6 +361,7 @@ kubectl --context $WORKER get pods --watch ``` The above command will give an output similar to: + ```shell-session NAME READY STATUS RESTARTS AGE #highlight-next-line From 87eb883770fcb53a717070cbc84f649e918a8685 Mon Sep 17 00:00:00 2001 From: Derik Evangelista Date: Mon, 4 Nov 2024 17:31:37 +0000 Subject: [PATCH 2/3] chore: several tweaks and improvements - fixes #147 - fixes #145 --- .../part-ii/01-writing-your-first-promise.mdx | 18 +-- .../workshop/part-ii/02-promise-workflows.mdx | 9 ++ .../workshop/part-ii/03-secrets-and-state.mdx | 65 ++++---- docs/workshop/part-ii/06-compound-promise.mdx | 9 +- .../promise-workflows/02-full-promise.yaml | 10 +- .../01-promise-with-postgres-dependency.yaml | 142 ------------------ ...ompound-promise-with-required-promise.yaml | 87 ----------- .../05-resource-workflow.yaml | 5 +- .../writing-a-promise/06-full-promise.yaml | 8 +- 9 files changed, 65 insertions(+), 288 deletions(-) delete mode 100644 docs/workshop/part-ii/_partials/writing-a-compound-promise/01-promise-with-postgres-dependency.yaml delete mode 100644 docs/workshop/part-ii/_partials/writing-a-compound-promise/02-compound-promise-with-required-promise.yaml diff --git a/docs/workshop/part-ii/01-writing-your-first-promise.mdx b/docs/workshop/part-ii/01-writing-your-first-promise.mdx index da49be84..f00e2e5f 100644 --- a/docs/workshop/part-ii/01-writing-your-first-promise.mdx +++ b/docs/workshop/part-ii/01-writing-your-first-promise.mdx @@ -329,19 +329,19 @@ As we will use this same image to build several stages in the pipeline, let's re mv workflows/resource/configure/mypipeline/kratix-workshop-app-pipeline-image/scripts/{pipeline.sh,resource-configure} ``` -Make sure to update the Dockerfile to reflect the new script name. Remove the lines marked in red and add the lines marked in green: +Make sure to update the Dockerfile to reflect the new script name. Replace the Dockerfile contents with the snippet below: -```diff title="app-promise/workflows/resource/configure/mypipeline/kratix-workshop-app-pipeline-image/Dockerfile" -- RUN apk update && apk add --no-cache yq -+ RUN apk update && apk add --no-cache yq kubectl +```Dockerfile title="app-promise/workflows/resource/configure/mypipeline/kratix-workshop-app-pipeline-image/Dockerfile" +FROM "alpine" -- ADD scripts/pipeline.sh /usr/bin/pipeline.sh -+ COPY scripts/* /usr/bin/ +RUN apk update && apk add --no-cache yq kubectl -- RUN chmod +x /usr/bin/pipeline.sh -+ RUN chmod +x /usr/bin/* +COPY scripts/* /usr/bin/ +ADD resources resources -- CMD [ "sh", "-c", "pipeline.sh"] +RUN chmod +x /usr/bin/* + +ENTRYPOINT [] ``` Replace the contents of the `resource-configure` script with the following: diff --git a/docs/workshop/part-ii/02-promise-workflows.mdx b/docs/workshop/part-ii/02-promise-workflows.mdx index 3ea54456..d5398aee 100644 --- a/docs/workshop/part-ii/02-promise-workflows.mdx +++ b/docs/workshop/part-ii/02-promise-workflows.mdx @@ -147,12 +147,21 @@ docker run \ --volume ${outputDir}:/kratix/output \ --volume ${inputDir}:/kratix/input \ --volume ${metadataDir}:/kratix/metadata \ + --env MINIO_USER=minioadmin \ + --env MINIO_PASSWORD=minioadmin \ + --env MINIO_ENDPOINT=localhost:31337 \ kratix-workshop/app-pipeline-image:v1.0.0 sh -c "$command" EOF chmod +x scripts/* ``` +:::warning + +If you are running the workshop on a Mac, you may need to update the `MINIO_ENDPOINT` above to `host.docker.internal:31337`. + +::: + These scripts do the following: - `build-pipeline` codifies the image building and loads the container image on the KinD cluster. diff --git a/docs/workshop/part-ii/03-secrets-and-state.mdx b/docs/workshop/part-ii/03-secrets-and-state.mdx index 8d5a3ffc..0bd7423d 100644 --- a/docs/workshop/part-ii/03-secrets-and-state.mdx +++ b/docs/workshop/part-ii/03-secrets-and-state.mdx @@ -61,13 +61,12 @@ spec: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: resource-configure + name: mypipeline spec: containers: - - command: - - resource-configure - image: kratix-workshop/app-pipeline-image:v1.0.0 + - image: kratix-workshop/app-pipeline-image:v1.0.0 name: kratix-workshop-app-pipeline-image + command: [ resource-configure ] #highlight-start - name: create-bucket image: kratix-workshop/app-pipeline-image:v1.0.0 @@ -89,6 +88,7 @@ spec: name: app-promise-minio-creds key: password #highlight-end +status: {} ``` You can now add the `create-bucket` script to your Resource Worfklow Pipeline image. Create a `create-bucket` script in the `workflows/resource/configure/mypipeline/kratix-workshop-app-pipeline-image/scripts/` directory: @@ -129,31 +129,7 @@ import CreateBucket from '!!raw-loader!./_partials/secrets-and-state/02-create-b {CreateBucket} -With all of that in place, you can test the Workflow. You will need to expose the environment variables defined in the `create-bucket` step before running the test script. Open the `scripts/test-pipeline` script and update the `docker run` command to look like this: - -```bash title="scripts/test-pipeline" -docker run \ - --rm \ - --volume ~/.kube:/root/.kube \ - --network=host \ - --volume ${outputDir}:/kratix/output \ - --volume ${inputDir}:/kratix/input \ - --volume ${metadataDir}:/kratix/metadata \ -#highlight-start - --env MINIO_USER=minioadmin \ - --env MINIO_PASSWORD=minioadmin \ - --env MINIO_ENDPOINT=localhost:31337 \ -#highlight-end - kratix-workshop/app-pipeline-image:v1.0.0 bash -c "$command" -``` - -:::warning - -If you are running the workshop on a Mac, you may need to update the `MINIO_ENDPOINT` to `host.docker.internal:31337`. - -::: - -You need to ensure kubectl is pointing to the platform cluster before running the test script: +With all of that in place, you can test the Workflow. Before running running the test, ensure kubectl is pointing to the platform cluster before running the test script: ```bash kubectl config set current-context $PLATFORM @@ -210,12 +186,31 @@ that you can ensure the Kratix Pipeline Service Account has the appropriate perm In your `promise.yaml`, find the Workflow for the `resource.configure` Pipeline. Edit the Workflow's Pipeline `spec` to have the following: -``` - rbac: - permissions: - - apiGroups: [""] - verbs: ["*"] - resources: ["configmaps"] +```yaml +apiVersion: platform.kratix.io/v1alpha1 +kind: Promise +metadata: + name: app +spec: + api: #... + workflows: + promise: # ... + resource: + configure: + - apiVersion: platform.kratix.io/v1alpha1 + kind: Pipeline + metadata: + name: mypipeline + spec: + #highlight-start + rbac: + permissions: + - apiGroups: [""] + verbs: ["*"] + resources: ["configmaps"] + #highlight-end + containers: #... + # rest of the file ``` This updates the permissions of the Kratix Pipeline Service Account to allow it to create and retrieve ConfigMaps. You can read more about how to configure RBAC permission in Pipelines in the [Kratix reference documentation](/main/reference/workflows#rbac). diff --git a/docs/workshop/part-ii/06-compound-promise.mdx b/docs/workshop/part-ii/06-compound-promise.mdx index b675a9a8..2b469edb 100644 --- a/docs/workshop/part-ii/06-compound-promise.mdx +++ b/docs/workshop/part-ii/06-compound-promise.mdx @@ -113,7 +113,7 @@ spec: - name: postgresql version: v1.0.0-beta.2 #highlight-end - # ... + # rest of the file ``` This states that the App-as-a-Promise needs the PostgreSQL Promise to be installed at version `v1.0.0-beta.2`. You can read more about Promise versioning [in the reference documentation](/main/reference/promises/releases#promise-release). @@ -331,10 +331,10 @@ workflows: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: resource-configure + name: mypipeline spec: containers: - - name: create-resources + - name: kratix-workshop-app-pipeline-image # ... - name: create-bucket # ... @@ -343,6 +343,7 @@ workflows: image: kratix-workshop/app-pipeline-image:v1.0.0 command: [ database-configure ] #highlight-end +status: {} ``` Apply your newly updated promise: @@ -362,7 +363,7 @@ Before you proceed, ensure you have registered the platform cluster as a destina kubectl get destinations --show-labels ``` -If you don't see the platform cluster, or it's not labelled as platform, you can follow [these steps](https://docs.kratix.io/workshop/multiple-promises#register-the-platform-as-a-destination) to register it as a destination. +If you don't see the platform cluster, or it's not labelled as platform, you can follow [these steps](https://docs.kratix.io/workshop/multiple-promises#register-the-platform-as-a-destination) to register it as a destination. ```bash NAME AGE LABELS diff --git a/docs/workshop/part-ii/_partials/promise-workflows/02-full-promise.yaml b/docs/workshop/part-ii/_partials/promise-workflows/02-full-promise.yaml index 5a88d8aa..d6bf9e6f 100644 --- a/docs/workshop/part-ii/_partials/promise-workflows/02-full-promise.yaml +++ b/docs/workshop/part-ii/_partials/promise-workflows/02-full-promise.yaml @@ -41,20 +41,20 @@ spec: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: promise-configure + name: dependencies spec: containers: - - name: download-dependencies + - name: configure-deps image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ promise-configure ] resource: configure: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: resource-configure + name: mypipeline spec: containers: - - name: create-resources + - name: kratix-workshop-app-pipeline-image image: kratix-workshop/app-pipeline-image:v1.0.0 command: [ resource-configure ] +status: {} diff --git a/docs/workshop/part-ii/_partials/writing-a-compound-promise/01-promise-with-postgres-dependency.yaml b/docs/workshop/part-ii/_partials/writing-a-compound-promise/01-promise-with-postgres-dependency.yaml deleted file mode 100644 index 3c8610c9..00000000 --- a/docs/workshop/part-ii/_partials/writing-a-compound-promise/01-promise-with-postgres-dependency.yaml +++ /dev/null @@ -1,142 +0,0 @@ -apiVersion: platform.kratix.io/v1alpha1 -kind: Promise -metadata: - name: app -spec: - destinationSelectors: - - matchLabels: - environment: platform - api: - apiVersion: apiextensions.k8s.io/v1 - kind: CustomResourceDefinition - metadata: - name: apps.workshop.kratix.io - spec: - group: workshop.kratix.io - names: - kind: App - plural: apps - singular: apps - shortNames: - - app - scope: Namespaced - versions: - - name: v1 - served: true - storage: true - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - service: - type: object - properties: - port: - type: integer - image: - type: string - dependencies: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Promise - metadata: - creationTimestamp: null - name: postgresql - namespace: default - spec: - api: - apiVersion: apiextensions.k8s.io/v1 - kind: CustomResourceDefinition - metadata: - name: postgresqls.marketplace.kratix.io - spec: - group: marketplace.kratix.io - names: - kind: postgresql - plural: postgresqls - singular: postgresql - scope: Namespaced - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - properties: - spec: - properties: - dbName: - default: postgres - description: | - Database name. A database will be created with this name. The owner of the database will be the teamId. - type: string - env: - default: dev - description: | - Configures and deploys this PostgreSQL with environment specific configuration. Prod PostgreSQL are configured with backups and more resources. - pattern: ^(dev|prod)$ - type: string - namespace: - default: default - description: | - Kubernetes namespace to create the Postgres cluster. - type: string - teamId: - default: acid - description: | - Team ID. A superuser role will be created with this name. - type: string - type: object - type: object - served: true - storage: true - destinationSelectors: - - matchLabels: - environment: dev - workflows: - promise: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: promise-configure - namespace: default - spec: - containers: - - image: ghcr.io/syntasso/promise-postgresql/postgresql-configure-pipeline:v0.1.0 - name: psql-promise-pipeline - resource: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: instance-configure - namespace: default - spec: - containers: - - image: ghcr.io/syntasso/promise-postgresql/postgresql-configure-pipeline:v0.1.0 - name: postgresql-configure-pipeline - status: {} - workflows: - promise: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: promise-configure - spec: - containers: - - name: download-dependencies - image: kratix-workshop/create-resources:v1.0.0 - command: [/promise-configure] - resource: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: resource-configure - spec: - containers: - - name: create-resources - image: kratix-workshop/create-resources:v1.0.0 - command: [/execute-pipeline] \ No newline at end of file diff --git a/docs/workshop/part-ii/_partials/writing-a-compound-promise/02-compound-promise-with-required-promise.yaml b/docs/workshop/part-ii/_partials/writing-a-compound-promise/02-compound-promise-with-required-promise.yaml deleted file mode 100644 index 85274bd3..00000000 --- a/docs/workshop/part-ii/_partials/writing-a-compound-promise/02-compound-promise-with-required-promise.yaml +++ /dev/null @@ -1,87 +0,0 @@ -apiVersion: platform.kratix.io/v1alpha1 -kind: Promise -metadata: - name: app -spec: - api: - apiVersion: apiextensions.k8s.io/v1 - kind: CustomResourceDefinition - metadata: - name: apps.workshop.kratix.io - spec: - group: workshop.kratix.io - names: - kind: App - plural: apps - singular: apps - shortNames: - - app - scope: Namespaced - versions: - - name: v1 - served: true - storage: true - schema: - openAPIV3Schema: - type: object - properties: - spec: - type: object - properties: - service: - type: object - properties: - port: - type: integer - image: - type: string - dbDriver: - type: string - requiredPromises: - - name: postgresql - version: v1.0.0-beta.1 - workflows: - promise: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: promise-configure - spec: - containers: - - name: download-dependencies - image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ promise-configure ] - resource: - configure: - - apiVersion: platform.kratix.io/v1alpha1 - kind: Pipeline - metadata: - name: resource-configure - spec: - containers: - - name: create-resources - image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ resource-configure ] - - name: create-bucket - image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ create-bucket ] - env: - - name: MINIO_ENDPOINT - valueFrom: - secretKeyRef: - name: app-promise-minio-creds - key: endpoint - - name: MINIO_USER - valueFrom: - secretKeyRef: - name: app-promise-minio-creds - key: username - - name: MINIO_PASSWORD - valueFrom: - secretKeyRef: - name: app-promise-minio-creds - key: password - - name: database-configure - image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ database-configure ] \ No newline at end of file diff --git a/docs/workshop/part-ii/_partials/writing-a-promise/05-resource-workflow.yaml b/docs/workshop/part-ii/_partials/writing-a-promise/05-resource-workflow.yaml index f3fc38b7..55890bde 100644 --- a/docs/workshop/part-ii/_partials/writing-a-promise/05-resource-workflow.yaml +++ b/docs/workshop/part-ii/_partials/writing-a-promise/05-resource-workflow.yaml @@ -11,10 +11,11 @@ spec: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: resource-configure + name: mypipeline spec: containers: - - name: create-resources + - name: kratix-workshop-app-pipeline-image image: kratix-workshop/app-pipeline-image:v1.0.0 #highlight-next-line command: [ resource-configure ] +status: {} diff --git a/docs/workshop/part-ii/_partials/writing-a-promise/06-full-promise.yaml b/docs/workshop/part-ii/_partials/writing-a-promise/06-full-promise.yaml index 97b6554b..3d8eee5e 100644 --- a/docs/workshop/part-ii/_partials/writing-a-promise/06-full-promise.yaml +++ b/docs/workshop/part-ii/_partials/writing-a-promise/06-full-promise.yaml @@ -47,7 +47,6 @@ spec: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - creationTimestamp: null name: dependencies spec: containers: @@ -58,9 +57,10 @@ spec: - apiVersion: platform.kratix.io/v1alpha1 kind: Pipeline metadata: - name: resource-configure + name: mypipeline spec: containers: - - name: create-resources + - name: kratix-workshop-app-pipeline-image image: kratix-workshop/app-pipeline-image:v1.0.0 - command: [ resource-configure ] \ No newline at end of file + command: [ resource-configure ] +status: {} From 7d99c090963506a9b3e82817bd51f5b76d48c4dd Mon Sep 17 00:00:00 2001 From: Abby Bangser Date: Tue, 5 Nov 2024 11:06:15 +0000 Subject: [PATCH 3/3] docs: minor consistency updates across stages of workshop --- .../_install-check-flux-and-finish.mdx | 4 +--- docs/workshop/part-i/02-installing-a-promise.md | 9 +-------- docs/workshop/part-i/03-multiple-promise.md | 14 ++++++++++---- 3 files changed, 12 insertions(+), 15 deletions(-) diff --git a/docs/_partials/installation/_install-check-flux-and-finish.mdx b/docs/_partials/installation/_install-check-flux-and-finish.mdx index 2024ae29..a08543de 100644 --- a/docs/_partials/installation/_install-check-flux-and-finish.mdx +++ b/docs/_partials/installation/_install-check-flux-and-finish.mdx @@ -3,11 +3,9 @@ to receive workloads. You can verify its readiness by observing the `kratix-work namespace appearing in the `worker` cluster: ```shell-session -$ kubectl --context $WORKER get namespaces +$ kubectl --context $WORKER get namespace kratix-worker-system NAME STATUS AGE -... kratix-worker-system Active 1m -... ``` 🎉 **Congratulations!** Kratix is now installed! Jump to [Installing and using a Promise](installing-a-promise) to spin up your first as-a-service offering. diff --git a/docs/workshop/part-i/02-installing-a-promise.md b/docs/workshop/part-i/02-installing-a-promise.md index 6fd44a8d..353ed8b8 100644 --- a/docs/workshop/part-i/02-installing-a-promise.md +++ b/docs/workshop/part-i/02-installing-a-promise.md @@ -44,21 +44,14 @@ minio 1/1 1 1 1h You should also have a `kratix-worker-system` namespace in your worker cluster: ```bash -kubectl --context $WORKER get namespaces +kubectl --context $WORKER get namespace kratix-worker-system ``` The above command will give an output similar to: ```shell-session NAME STATUS AGE -default Active 41m -flux-system Active 39m -//highlight-next-line kratix-worker-system Active 35m -kube-node-lease Active 41m -kube-public Active 41m -kube-system Active 41m -local-path-storage Active 41m ``` If your outputs do not align with the above, please refer back to diff --git a/docs/workshop/part-i/03-multiple-promise.md b/docs/workshop/part-i/03-multiple-promise.md index cf055362..4844f304 100644 --- a/docs/workshop/part-i/03-multiple-promise.md +++ b/docs/workshop/part-i/03-multiple-promise.md @@ -80,11 +80,10 @@ The above command will give an output similar to: ```shell-session NAME READY STATUS RESTARTS AGE kratix-platform-controller-manager-7cc49f598b-zqkmz 2/2 Running 0 4h4m -minio-6f75d9fbcf-jpstv 1/1 Running 0 4h4m ``` -If the command above display a different output, please refer back to previous -guides. +If the command above does not include a ready kratix-platform-controller-manager, +please refer back to previous guides. ### Install the Promise @@ -160,7 +159,7 @@ When the deployments eventually complete, press Ctrl+C to ## Understanding Destination Selectors You may be asking yourself: how did Kratix know it should install the -Sub-promises on the Platform cluster? And how did it know to install the NGINX +sub-promises on the Platform cluster? And how did it know to install the NGINX and the PostgreSQL Promises dependencies on the Worker cluster? The answer is: **Destination Selectors**. @@ -372,6 +371,13 @@ postgres-operator-79754946d-nmkhr 1/1 Running 0 10m todo-84f6b6698-vqxqm 1/1 Running 0 74s ``` +:::note + +It will take a couple of minutes for the Todo App to start, and it may cycle through +a few states, including _Error_, before it eventually succeeds. + +::: + Once you see the `todo` and the `acid-todo-postgresql-0` pods reporting `Ready 1/1`, press Ctrl+C to exit the watch mode.