Skip to content

Commit a06282b

Browse files
author
ranchodeluxe
committed
add pgo and cluster
1 parent a232fd4 commit a06282b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+19607
-448
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ body:
88
value: |
99
Thanks for taking the time to fill out this bug report!
1010
11-
- type: input
12-
id: title
13-
attributes:
14-
label: Title
15-
description: A clear and concise title of the issue
16-
placeholder: "Type the issue title here"
17-
validations:
18-
required: true
19-
2011
- type: checkboxes
2112
id: labels
2213
attributes:

.github/ISSUE_TEMPLATE/feature_request.yaml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ body:
88
value: |
99
Thanks for taking the time to suggest a feature!
1010
11-
- type: input
12-
id: title
13-
attributes:
14-
label: Title
15-
description: A clear and concise title of the feature request
16-
placeholder: "Type the feature title here"
17-
validations:
18-
required: true
19-
2011
- type: textarea
2112
id: description
2213
attributes:

.github/workflows/helm-tests.yml

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,11 @@
11
name: CI
22

3-
4-
# On every pull request, but only on push to main
53
on:
64
push:
7-
branches:
8-
- main
9-
paths: []
10-
# only run jobs if some code have changed
11-
#- 'helm-chart/eoapi/**'
5+
branches: [ "main" ]
126
pull_request:
13-
branches:
14-
- main
7+
branches: [ "main" ]
8+
types: [ opened, reopened, synchronize, labeled ]
159

1610
jobs:
1711
helm-tests:
@@ -25,8 +19,15 @@ jobs:
2519
- run: |
2620
cd helm-chart
2721
helm unittest eoapi -f 'tests/*.yaml' -v eoapi/test-helm-values.yaml
28-
integration-tests:
29-
if: github.event.pull_request.head.repo.full_name == github.repository
22+
integration-tests-gcp:
23+
# run on:
24+
# - all pushes to specified branch(es)
25+
# - a PR was just labeled 'test-integration'
26+
# - a PR with 'test-integration' label was opened, reopened, or synchronized
27+
if: |
28+
github.event_name == 'push' ||
29+
github.event.label.name == 'test-integration-gcp' ||
30+
contains( github.event.pull_request.labels.*.name, 'test-integration-gcp')
3031
permissions:
3132
contents: 'read'
3233
id-token: 'write'
@@ -78,24 +79,13 @@ jobs:
7879
7980
- name: helm render/install eoapi templates
8081
run: |
81-
export PGUSER=username
82-
export POSTGRES_USER=username
83-
export PGPASSWORD=password
84-
export POSTGRES_PASSWORD=password
8582
export GITSHA='${{github.sha}}'
8683
8784
cd helm-chart
8885
8986
helm install $RELEASE_NAME \
90-
--namespace eoapitest \
87+
--namespace $RELEASE_NAME \
9188
--create-namespace \
92-
--set db.settings.secrets.POSTGRES_HOST=pgstac-$RELEASE_NAME \
93-
--set db.settings.secrets.POSTGRES_HOST_READER=pgstac-$RELEASE_NAME \
94-
--set db.settings.secrets.POSTGRES_HOST_WRITER=pgstac-$RELEASE_NAME \
95-
--set db.settings.secrets.PGUSER=$PGUSER \
96-
--set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \
97-
--set db.settings.secrets.PGPASSWORD=$PGPASSWORD \
98-
--set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
9989
-f ./eoapi/values.yaml \
10090
-f ./eoapi/test-unittest-values.yaml \
10191
./eoapi
@@ -109,7 +99,7 @@ jobs:
10999
timeout-minutes: 10
110100
continue-on-error: true
111101
run: |
112-
kubectl config set-context --current --namespace=eoapitest
102+
kubectl config set-context --current --namespace=$RELEASE_NAME
113103
while [[ -z "$(kubectl get pod | grep "^raster-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /.*/healthz" | head -n 1)" ]]; do
114104
echo "still waiting for raster service to start..."
115105
sleep 1
@@ -131,6 +121,10 @@ jobs:
131121
run: |
132122
echo "The previous step failed or timed out. Running cleanup logic..."
133123
helm uninstall $RELEASE_NAME
124+
125+
# need to ticket in crunchy b/c depedencies are not uninstalling via above uninstall
126+
kubectl delete cm,secrets,statefulset,replicaset,deploy,pods,services,endpoints,sa,deployments --all --namespace=$RELEASE_NAME
127+
134128
# force GH action to show failed result
135129
exit 128
136130
@@ -145,7 +139,7 @@ jobs:
145139
id: testrunner
146140
continue-on-error: true
147141
run: |
148-
kubectl config set-context --current --namespace=eoapitest
142+
kubectl config set-context --current --namespace=$RELEASE_NAME
149143
PUBLICIP='http://'$(kubectl -n ingress-nginx get svc/ingress-nginx-controller -o jsonpath='{.spec.loadBalancerIP}')
150144
echo '#################################'
151145
echo vector=$PUBLICIP/vector$RELEASE_NAME
@@ -172,9 +166,16 @@ jobs:
172166
run: |
173167
echo "The previous step failed or timed out. Running cleanup logic..."
174168
helm uninstall $RELEASE_NAME
169+
170+
# need to ticket in crunchy b/c depedencies are not uninstalling via above uninstall
171+
kubectl delete cm,secrets,statefulset,replicaset,deploy,pods,services,endpoints,sa,deployments --all --namespace=$RELEASE_NAME
172+
175173
# force GH action to show failed result
176174
exit 128
177175
178176
- name: helm uinstall eoapi templates
179177
run: |
180178
helm uninstall $RELEASE_NAME
179+
180+
# need to ticket in crunchy b/c depedencies are not uninstalling via above uninstall
181+
kubectl delete cm,secrets,statefulset,replicaset,deploy,pods,services,endpoints,sa,deployments --all --namespace=$RELEASE_NAME

README.md

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ Once you have a k8s cluster set up you can `helm install` eoAPI as follows:
5353
eoapi/eoapi 0.1.1 0.1.0 Create a full Earth Observation API with Metada...
5454
eoapi/eoapi 0.1.2 0.1.0 Create a full Earth Observation API with Metada...
5555

56-
# add the required secret overrides to an arbitrarily named `.yaml` file (`config.yaml` below)
56+
# optionally override keys/values in the default `values.yaml` with a custom `config.yaml` like below:
5757
$ cat config.yaml
58-
db:
58+
vector:
59+
enable: false
60+
pgstacBootstrap:
5961
settings:
60-
secrets:
61-
PGUSER: "username"
62-
POSTGRES_USER: "username"
63-
PGPASSWORD: "password"
64-
POSTGRES_PASSWORD: "password"
65-
62+
envVars:
63+
LOAD_FIXTURES: "0"
64+
RUN_FOREVER: "1"
65+
6666
# then run `helm install` with those overrides
6767
$ helm install -n eoapi --create-namespace eoapi eoapi/eoapi --version 0.1.2 -f config.yaml
6868
```
@@ -74,21 +74,13 @@ Once you have a k8s cluster set up you can `helm install` eoAPI as follows:
7474
# create os environment variables for required secrets
7575
######################################################
7676
$ export GITSHA=$(git rev-parse HEAD | cut -c1-10)
77-
$ export PGUSER=s00pers3cr3t
78-
$ export POSTGRES_USER=s00pers3cr3t
79-
$ export POSTGRES_PASSWORD=superuserfoobar
80-
$ export PGPASSWORD=foobar
8177

8278
$ cd ./helm-chart
8379

8480
$ helm install \
8581
--namespace eoapi \
8682
--create-namespace \
8783
--set gitSha=$GITSHA \
88-
--set db.settings.secrets.PGUSER=$PGUSER \
89-
--set db.settings.secrets.POSTGRES_USER=$POSTGRES_USER \
90-
--set db.settings.secrets.PGPASSWORD=$PGPASSWORD \
91-
--set db.settings.secrets.POSTGRES_PASSWORD=$POSTGRES_PASSWORD \
9284
eoapi \
9385
./eoapi
9486
```

docs/aws-eks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a verbose walkthrough. It uses `eksctl` and assumes you already have an AWS account, have the [eksctl prerequisites installed](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html) including `eksctl` and `helm`.
44

5-
If you are familiar with Terraform would like an IaC choice that is more terse consider setting up your cluster with that: https://github.com/developmentseed/eoapi-k8s-terraform
5+
If you're familiar with Terraform and would like an IaC choice that is more terse consider setting up your cluster with that: https://github.com/developmentseed/eoapi-k8s-terraform
66

77

88
## Table of Contents:

docs/configuration.md

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,16 @@ $ head -n 9 <eoapi-k8s-repo>/values.schema.json
1010
"$schema": "http://json-schema.org/schema#",
1111
"type": "object",
1212
"required": [
13-
"db",
1413
"service",
1514
"gitSha"
1615
],
1716
```
1817
19-
Most of the required fields have common-sense defaults except traditional username and password secrets under `db`.
18+
Most of the required fields have common-sense defaults.
2019
The table below and the `values.yaml` comments should explain what the options and defaults are:
2120
2221
| **Values Key** | **Description** | **Default** | **Choices** |
2322
|:-------------------------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------|:------------|:------------------------|
24-
| `db.settings.secrets.PGUSER`<br>`db.settings.secrets.PGPASSWORD` | username and password used by application for connections<br>https://www.postgresql.org/docs/current/libpq-envars.html | | |
25-
| `db.settings.secrets.POSTGRES_USER`<br>`db.settings.secrets.POSTGRES_PASSWORD` | username and password used by<br>base postgresl image for admin purposes<br>see https://www.postgresql.org/docs/current/libpq-envars.html | | |
2623
| `service.port` | the port that all vector/raster/stac services run on<br>used in `kind: Service` and `kind: Ingress` | 8080 | your favorite port |
2724
| `gitSha` | sha attached to a `kind: Deployment` key `metadata.labels` | gitshaABC123 | your favorite sha |
2825
@@ -31,23 +28,11 @@ The table below and the `values.yaml` comments should explain what the options a
3128
3229
## Default Configuration
3330
34-
Running `helm install` from https://devseed.com/eoapi-k8s/ with this simple `config.yml` overrides below
35-
should spin up similar infrastructure in EKS or GKE:
36-
37-
```python
38-
$ cat config.yaml
39-
db:
40-
settings:
41-
secrets:
42-
PGUSER: "username"
43-
POSTGRES_USER: "username"
44-
PGPASSWORD: "password"
45-
POSTGRES_PASSWORD: "password"
46-
```
31+
Running `helm install` from https://devseed.com/eoapi-k8s/ should spin up similar infrastructure in EKS or GKE:
4732
4833
In EKS or GKE you'll by default get:
4934
50-
* a pgstac PostgreSQL database deployment and service
35+
* a HA PostgreSQL database deployment and service via [Crunchdata's Postgresl Operator](https://access.crunchydata.com/documentation/postgres-operator)
5136
* the same vector and raster data fixtures used for testing loaded into the DB
5237
* a load balancer and nginx-compatible ingress with the following path rewrites:
5338
* a `/stac` service for `stac_fastapi.pgstac`

docs/gcp-gke.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
This is a verbose walkthrough. It uses `gcloud` and assumes you already have an GCP account and project where you want to run eoapi. We also assume that you have some prerequisites installed including `gcloud`, `kubectl` and `helm`.
44

5-
If you are familiar with Terraform would like an IaC choice that is more terse consider setting up your cluster with that: https://github.com/developmentseed/eoapi-k8s-terraform
5+
If you're familiar with Terraform and would like an IaC choice that is more terse consider setting up your cluster with that: https://github.com/developmentseed/eoapi-k8s-terraform
66

77
# Table of Contents
88
- [Pre-requisites](#pre-requisites)

helm-chart/eoapi/Chart.lock

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
dependencies:
2+
- name: pgo
3+
repository: ""
4+
version: 5.5.2
5+
- name: postgrescluster
6+
repository: ""
7+
version: 5.5.2
8+
digest: sha256:88b79b5e364db5d6d1b636c5533628b2d874584f119b1630ec0b16ee6d0f9d88
9+
generated: "2024-06-06T11:50:50.141657-07:00"

helm-chart/eoapi/Chart.yaml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,18 @@ kubeVersion: ">=1.23.0-0"
1717
# This is the chart version. This version number should be incremented each time you make changes
1818
# to the chart and its templates, including the app version.
1919
# Versions are expected to follow Semantic Versioning (https://semver.org/)
20-
version: "0.2.14"
20+
version: "0.3.0"
2121

2222
# This is the version number of the application being deployed. This version number should be
2323
# incremented each time you make changes to the application. Versions are not expected to
2424
# follow Semantic Versioning. They should reflect the version the application is using.
2525
# It is recommended to use it with quotes.
26-
appVersion: "0.3.1"
26+
appVersion: "0.3.2"
27+
28+
dependencies:
29+
- name: pgo
30+
version: 5.5.2
31+
respository: "file://charts/pgo"
32+
- name: postgrescluster
33+
version: 5.5.2
34+
respository: "file://charts/postgrescluster"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# https://github.com/github/linguist/issues/4905
2+
# https://github.com/github/linguist/issues/5092#issuecomment-730262298
3+
/templates/*.tpl linguist-language=handlebars

0 commit comments

Comments
 (0)