Skip to content

Commit

Permalink
Example updates (#1316)
Browse files Browse the repository at this point in the history
  • Loading branch information
devdattakulkarni authored Jun 19, 2024
1 parent 80d74e6 commit 89a5131
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 79 deletions.
48 changes: 0 additions & 48 deletions examples/multitenancy/application-hosting/odoo/OdooService.yaml

This file was deleted.

14 changes: 4 additions & 10 deletions examples/multitenancy/application-hosting/odoo/steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This example shows delivering Bitnami Odoo Helm chart as-a-service using KubePlu

1. Download Odoo helm chart from Bitnami:
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm pull bitnami/odoo
$ helm pull bitnami/odoo --version 23.0.4

2. Install KubePlus and setup KubePlus kubectl plugins:
- Create provider kubeconfig:
Expand All @@ -24,17 +24,11 @@ This example shows delivering Bitnami Odoo Helm chart as-a-service using KubePlu
- Wait till KubePlus Pod is Running
$ kubectl get pods -A

- Setup KubePlus kubectl plugins
$ wget https://github.com/cloud-ark/kubeplus/blob/master/kubeplus-kubectl-plugins.tar.gz
$ gunzip kubeplus-kubectl-plugins.tar.gz
$ tar -xvf kubeplus-kubectl-plugins
$ export KUBEPLUS_HOME=`pwd`
$ export PATH=$KUBEPLUS_HOME/plugins:$PATH

3. Create OdooService API wrapping the Helm chart:
- Check odoo-service-composition-localchart.yaml. Notice that we are specifying the odoo chart from a file system based path.
So first we have to upload this chart to KubePlus Pod.
$ kubectl upload chart odoo-23.0.4.tgz
$ kubectl upload chart odoo-23.0.4.tgz kubeplus-saas-provider.json
$ kubectl create -f odoo-service-composition-localchart.yaml --kubeconfig=kubeplus-saas-provider.json
$ kubectl get crds --kubeconfig=kubeplus-saas-provider.json
- verify that odooservice crd has been created
Expand All @@ -44,8 +38,8 @@ This example shows delivering Bitnami Odoo Helm chart as-a-service using KubePlu
4. Download the consumer kubeconfig file:
- Direct
$ kubectl get configmaps kubeplus-saas-consumer-kubeconfig -n $KUBEPLUS_NS -o jsonpath="{.data.kubeplus-saas-consumer\.json}" > consumer.conf
- Using kubeplus plugin (use when working on GKE)
$ kubectl retrieve kubeconfig consumer default -s https://$server:443 -k kubeplus-saas-provider.json > consumer.conf
- Using kubeplus plugin
$ kubectl retrieve kubeconfig consumer default -s $server -k kubeplus-saas-provider.json > consumer.conf

5. Check permissions for provider and consumer service accounts, which are created by KubePlus:
$ kubectl auth can-i --list --as=system:serviceaccount:default:kubeplus-saas-provider
Expand Down
17 changes: 13 additions & 4 deletions examples/multitenancy/application-hosting/supabase/steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,30 @@ Pre-requisites:
- KubePlus kubectl plugins are available on PATH


Test Supase creation:
Test Supabase creation:
- helm repo add bitnami https://charts.bitnami.com/bitnami
- helm pull bitnami/supabase
- Open Supabase.yaml and change chartURL to the version of supabase tgz that you received from helm pull.
- helm pull bitnami/supabase --version 0.1.4
- kubectl upload chart supabase-0.1.4.tgz kubeplus-saas-provider.json
- python3 ../../../../provider-kubeconfig.py update default -p supabase-perms.json
- kubectl create -f Supabase.yaml --kubeconfig=kubeplus-saas-provider.json
- kubectl get resourcecompositions
- kubectl describe resourcecomposition supabase-res-composition
- kubectl get crds
- Verify that supabases crd is registered in the cluster
- kubectl get crds
- kubectl man Supabase -k kubeplus-saas-provider.json > sample-supabase.yaml
- kubectl create -f sample-supabase.yaml
- kubectl get supabases
- kubectl describe supabase sample-supabase
- kubectl get pods -A


Cleanup:
- Wait till the "Status" field is populated in the output of:
- kubectl describe supabase sample-supabase
- kubectl delete supabase sample-supabase
- kubectl get pods -A
- kubectl delete -f Supabase.yaml --kubeconfig=kubeplus-saas-provider.json
- Verify resourcecomposition is deleted
- kubectl get resourcecompositions
- Verify all the Supabase CRDs are deleted
- kubectl get crds
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"perms": {"": [{"secrets/resourceName::kptc-jwt": ["create", "delete", "get", "list", "patch", "update", "watch"]}]}}

This file was deleted.

34 changes: 18 additions & 16 deletions examples/multitenancy/platform-engineering/steps.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ Platform Engineering team
- Wait till KubePlus Pod is Running
$ kubectl get pods -A

- Setup KubePlus kubectl plugins
$ wget https://github.com/cloud-ark/kubeplus/blob/master/kubeplus-kubectl-plugins.tar.gz
$ gunzip kubeplus-kubectl-plugins.tar.gz
$ tar -xvf kubeplus-kubectl-plugins
$ export KUBEPLUS_HOME=`pwd`
$ export PATH=$KUBEPLUS_HOME/plugins:$PATH

4. Create CustomMysqlService API wrapping the Helm chart:
- Check custom-mysql-service-composition-localchart.yaml. Notice that we are specifying our custom mysql chart
from a file system based path.
Expand All @@ -60,45 +53,54 @@ Platform Engineering team
Product team
-------------

Setup kubectl kubectl plugins by following the corresponding steps mentioned in the above section.
1. Setup kubeplus kubectl plugins:

$ wget https://github.com/cloud-ark/kubeplus/blob/master/kubeplus-kubectl-plugins.tar.gz
$ gunzip kubeplus-kubectl-plugins.tar.gz
$ tar -xvf kubeplus-kubectl-plugins
$ export KUBEPLUS_HOME=`pwd`
$ export PATH=$KUBEPLUS_HOME/plugins:$PATH

1. Check details of CustomMysqlService API:
2. Check details of CustomMysqlService API:
$ kubectl explain CustomMysqlService --kubeconfig=consumer.conf
$ kubectl explain CustomMysqlService.spec.mysql.auth --kubeconfig=consumer.conf

2. Retrieve sample CustomMysqlService resource:
3. Retrieve sample CustomMysqlService resource:
$ kubectl man CustomMysqlService -k consumer.conf
- this will show a sample custommysqlservice object in which the spec properties are
attributes in the CustomMysql Helm chart's values.yaml file
$ kubectl man CustomMysqlService -k consumer.conf > sample-custom-mysql.yaml

3. Create Custom MySQL instance:
4. Create Custom MySQL instance:
- Open sample-custom-mysql.yaml and change the name to "prod-mysql"
- Open sample-custom-mysql.yaml and update the username and password.
$ kubectl create -f sample-custom-mysql.yaml --kubeconfig=consumer.conf
- verify that the MySQL Pod iscreated in a new namespace (kubectl get pods -A)
- verify that the MySQL Pod is created in a new namespace (kubectl get pods -A)

4. Check the created resources:
5. Check the created resources:
$ kubectl appresources CustomMysqlService prod-mysql -k consumer.conf
- this will show all the resources that KubePlus has created for the custom mysql instance

5. Check logs:
6. Check logs:
$ kubectl applogs CustomMysqlService prod-mysql default -k consumer.conf

6. Check metrics:
7. Check metrics:
$ kubectl metrics CustomMysqlService prod-mysql default -k consumer.conf
$ kubectl metrics CustomMysqlService prod-mysql default -k consumer.conf -o prometheus


Clean up:
---------
Product team:
$ kubectl delete -f sample-custom-mysql.yaml --kubeconfig=consumer.conf

Platform Engineering team:
$ kubectl delete -f custom-mysql-service-composition-localchart.yaml --kubeconfig=kubeplus-saas-provider.json


Key Takeaways:
--------------
As Platform Engineering team, you don't want to share Helm charts with your product teams and then you won't
As Platform Engineering team, you don't want to share Helm charts with your product teams as then you won't
have any control on how the Helm chart values will be modified.
Wrapping an API around your Helm chart, and sharing this API with the product teams solves this problem.

Expand Down

0 comments on commit 89a5131

Please sign in to comment.