|
| 1 | + |
| 2 | + |
| 3 | +Useful helps: |
| 4 | + |
| 5 | +- [digitalocean API reference](https://docs.digitalocean.com/reference/api/api-reference/). |
| 6 | + |
| 7 | + |
| 8 | +```bash |
| 9 | + |
| 10 | +source cicd/keys/testing/digitalocean-rw-stackql.sh |
| 11 | + |
| 12 | +stackql shell --approot=./test/tmp/.create-digitalocean-k8s.stackql --http.log.enabled |
| 13 | +``` |
| 14 | + |
| 15 | +```sql |
| 16 | + |
| 17 | +registry pull digitalocean v24.11.00274; |
| 18 | + |
| 19 | +insert into |
| 20 | +digitalocean.projects.projects ( |
| 21 | + data__name, |
| 22 | + data__purpose, |
| 23 | + data__environment |
| 24 | +) |
| 25 | +select |
| 26 | + 'dashboard-k8s-project-uat', |
| 27 | + 'Hosting materials for k8s stackql dashboards', |
| 28 | + 'Staging' |
| 29 | +; |
| 30 | + |
| 31 | +-- this needs to be captured... '18e7b3f9-46d5-4bc9-81cd-08eb19aad862' in this particular case |
| 32 | +select id from digitalocean.projects.projects where name = 'dashboard-k8s-project-uat'; |
| 33 | + |
| 34 | +-- GOTTA click-ops this to be default project... for now |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +-- predicated upon correct default project |
| 40 | +insert into |
| 41 | +digitalocean.kubernetes.clusters ( |
| 42 | + data__name, |
| 43 | + data__region, |
| 44 | + data__version, |
| 45 | + data__node_pools, |
| 46 | + data__tags |
| 47 | +) |
| 48 | +select |
| 49 | + 'stackql-dashboards-k8s-uat-01', |
| 50 | + 'syd1', |
| 51 | + '1.31.1-do.5', |
| 52 | + '[ |
| 53 | + { |
| 54 | + "size": "s-1vcpu-2gb", |
| 55 | + "count": 2, |
| 56 | + "name": "worker-pool" |
| 57 | + } |
| 58 | + ]', |
| 59 | + '[ |
| 60 | + "stackql-dashboards-k8s-uat-01", |
| 61 | + "stackql-dashboards", |
| 62 | + "uat" |
| 63 | + ]' |
| 64 | +; |
| 65 | + |
| 66 | + |
| 67 | +-- here, wanna capture "id" for subsequent... 'b46e7d4f-da8b-4d7f-972c-544f2a37bf7d' ... can actually loop on this until ready -> may take ages |
| 68 | +select name, id from digitalocean.kubernetes.clusters where name = 'stackql-dashboards-k8s-uat-01'; |
| 69 | + |
| 70 | + |
| 71 | +select * from digitalocean.kubernetes.clusters_credentials where cluster_id = 'b46e7d4f-da8b-4d7f-972c-544f2a37bf7d'; |
| 72 | + |
| 73 | +``` |
| 74 | + |
| 75 | +```bash |
| 76 | + |
| 77 | +_clusterId=$(stackql exec --approot=./test/tmp/.create-digitalocean-k8s.stackql -o json "select name, id from digitalocean.kubernetes.clusters where name = 'stackql-dashboards-k8s-uat-01';" | jq -r '.[0].id') |
| 78 | + |
| 79 | +_clusterAuthObj=$(stackql exec --approot=./test/tmp/.create-digitalocean-k8s.stackql -o json "select * from digitalocean.kubernetes.clusters_credentials where cluster_id = '${_clusterId}';" | jq -r '.[0]') |
| 80 | + |
| 81 | +echo "cluster auth data = ${_clusterAuthObj}" |
| 82 | + |
| 83 | +curl -H "Authorization: Bearer ${DIGITALOCEAN_TOKEN}" -X GET https://api.digitalocean.com/v2/kubernetes/clusters/${_clusterId}/kubeconfig > $(pwd)/test/tmp/kubeconfig/do-uat-kubeconfig.yaml |
| 84 | + |
| 85 | + |
| 86 | +kubectl --kubeconfig=$(pwd)/test/tmp/kubeconfig/do-uat-kubeconfig.yaml get ns |
| 87 | +``` |
| 88 | + |
| 89 | +## Notes |
| 90 | + |
| 91 | +- `describe digitalocean.projects.projects;` returns only `column_anon`; but decent selct queries actually work. |
| 92 | + - Same also true for `describe digitalocean.droplets.droplets;`; probably endemic to the provider. |
| 93 | +- Pagination does not currently work, and appears to revolve around response body `"links":{"pages":{"last":"https://api.digitalocean.com/v2/images?page=14","next":"https://api.digitalocean.com/v2/images?page=2"}}`. |
| 94 | +- `stackql >>update digitalocean.projects.projects set is_default = true where project_id = 'c9027ad4-8e8a-47e8-9cb0-d9f0ae4d4b74';` -> `update statement RHS of type 'sqlparser.BoolVal' not yet supported`. |
| 95 | +- Debugging droplet init `cat /var/log/cloud-init-output.log`. |
| 96 | +- Viewing droplet startup script `cat /var/lib/cloud/instance/scripts/part-001`. |
| 97 | +- Apache2 service status `sudo systemctl status apache2`. |
0 commit comments