Skip to content

Commit e04d2ab

Browse files
authored
Merge branch 'main' into patch-2
2 parents 6074875 + 66a0731 commit e04d2ab

File tree

12 files changed

+58
-227
lines changed

12 files changed

+58
-227
lines changed

.github/workflows/helm-tests.yml

Lines changed: 1 addition & 162 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ jobs:
116116
sleep 1
117117
done
118118
echo "all services have started, moving on..."
119-
119+
120120
- name: cleanup if services fail to boot
121121
if: steps.watchservices.outcome == 'failure'
122122
run: |
@@ -163,164 +163,3 @@ jobs:
163163
- name: helm uninstall eoapi templates
164164
run: |
165165
helm uninstall $RELEASE_NAME
166-
167-
gcp-integration-tests:
168-
# run on:
169-
# - a PR was just labeled 'test-integration-gcp'
170-
# - a PR was just labeled 'test-integration'
171-
# - a PR with 'test-integration' label was opened, reopened, or synchronized
172-
if: |
173-
github.event.label.name == 'test-integration-gcp' ||
174-
contains( github.event.pull_request.labels.*.name, 'test-integration-gcp')
175-
permissions:
176-
contents: 'read'
177-
id-token: 'write'
178-
needs: helm-tests
179-
runs-on: ubuntu-latest
180-
steps:
181-
- uses: actions/checkout@v4
182-
183-
- uses: azure/setup-helm@v4
184-
with:
185-
version: ${{ env.HELM_VERSION }}
186-
#token: ${{ secrets.GITHUB_TOKEN }}
187-
188-
- name: last commit sha if PR
189-
if: ${{ github.event_name == 'pull_request' }}
190-
shell: bash
191-
run: |
192-
echo "LAST_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> ${GITHUB_ENV}
193-
194-
- name: last commit sha if push
195-
if: ${{ github.event_name == 'push' }}
196-
shell: bash
197-
run: |
198-
echo "LAST_COMMIT_SHA=${GITHUB_SHA}" >> ${GITHUB_ENV}
199-
200-
- name: set k8s .release.name suffix
201-
run: |
202-
# salt for randomness per test run
203-
COMMITSHA=$(echo $LAST_COMMIT_SHA | cut -c 1-6)
204-
SALT=$(echo "${RANDOM}${RANDOM}${RANDOM}" | cut -c1-3)
205-
echo "RELEASE_NAME=eoapi$COMMITSHA$SALT" >> $GITHUB_ENV
206-
207-
- id: 'auth'
208-
uses: 'google-github-actions/auth@v2'
209-
with:
210-
service_account: '[email protected]'
211-
credentials_json: ${{ secrets.GH_ACTIONS_SA_JSON }}
212-
213-
- name: setup gcloud sdk
214-
uses: google-github-actions/setup-gcloud@v2
215-
with:
216-
version: '>= 363.0.0'
217-
project_id: 'devseed-labs'
218-
219-
- name: configure kubectl context
220-
run: |
221-
gcloud components install gke-gcloud-auth-plugin
222-
gcloud container clusters get-credentials k8seed-labs-cluster --zone us-central1-f
223-
224-
- name: helm install crunchydata postgres operator
225-
run: |
226-
helm upgrade --install \
227-
--set disable_check_for_upgrades=true \
228-
pgo \
229-
oci://registry.developers.crunchydata.com/crunchydata/pgo \
230-
--version ${{ env.PGO_VERSION }}
231-
232-
- name: helm render/install eoapi templates
233-
run: |
234-
HOST='${{ env.RELEASE_NAME }}.k8s.labs.ds.io'
235-
echo $HOST
236-
237-
cd helm-chart
238-
239-
helm dependency build eoapi
240-
241-
helm install $RELEASE_NAME \
242-
--namespace $RELEASE_NAME \
243-
--create-namespace \
244-
--set ingress.host=$HOST \
245-
-f ./eoapi/values.yaml \
246-
-f ./eoapi/test-gcp-unittest-values.yaml \
247-
./eoapi
248-
249-
- name: sleep for 10s seconds while services boot
250-
shell: bash
251-
run: sleep 10s
252-
253-
# - name: Setup upterm session
254-
# uses: lhotari/action-upterm@v1
255-
256-
- id: watchservices
257-
name: watch services boot
258-
timeout-minutes: 10
259-
continue-on-error: true
260-
run: |
261-
kubectl config set-context --current --namespace=$RELEASE_NAME
262-
while [[ -z "$(kubectl get pod | grep "^raster-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /.*/healthz" | head -n 1)" ]]; do
263-
echo "still waiting for raster service to start..."
264-
sleep 1
265-
done
266-
echo "raster service has started, moving on..."
267-
while [[ -z "$(kubectl get pod | grep "^vector-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /healthz" | head -n 1)" ]]; do
268-
echo "still waiting for vector service to start..."
269-
sleep 1
270-
done
271-
echo "vector service has started, moving on..."
272-
while [[ -z "$(kubectl get pod | grep "^stac-$RELEASE_NAME-.*$" | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "GET /_mgmt/ping" | head -n 1)" ]]; do
273-
echo "still waiting for stac service to start..."
274-
sleep 1
275-
done
276-
echo "all services have started, moving on..."
277-
278-
- name: cleanup if services fail to boot
279-
if: steps.watchservices.outcome == 'failure'
280-
run: |
281-
echo "The previous step failed or timed out. Running cleanup logic..."
282-
helm uninstall $RELEASE_NAME
283-
284-
kubectl delete ns/$RELEASE_NAME
285-
286-
# force GH action to show failed result
287-
exit 128
288-
289-
- name: install python unit-test dependencies
290-
run: |
291-
python -m pip install pytest httpx
292-
293-
- name: run the tests
294-
id: testrunner
295-
continue-on-error: true
296-
run: |
297-
kubectl config set-context --current --namespace=$RELEASE_NAME
298-
PUBLICIP='https://${{ env.RELEASE_NAME }}.k8s.labs.ds.io'
299-
export VECTOR_ENDPOINT=$PUBLICIP/vector$RELEASE_NAME
300-
export STAC_ENDPOINT=$PUBLICIP/stac$RELEASE_NAME
301-
export RASTER_ENDPOINT=$PUBLICIP/raster$RELEASE_NAME
302-
303-
echo '#################################'
304-
echo $VECTOR_ENDPOINT
305-
echo $STAC_ENDPOINT
306-
echo $RASTER_ENDPOINT
307-
echo '#################################'
308-
309-
pytest .github/workflows/tests/test_vector.py
310-
pytest .github/workflows/tests/test_stac.py
311-
# TODO: fix raster tests
312-
#pytest .github/workflows/tests/test_raster.py
313-
314-
- name: cleanup if tests fail
315-
if: steps.testrunner.outcome == 'failure'
316-
run: |
317-
echo "The previous step failed or timed out. Running cleanup logic..."
318-
helm uninstall $RELEASE_NAME
319-
kubectl delete ns/$RELEASE_NAME
320-
# force GH action to show failed result
321-
exit 128
322-
323-
- name: helm uninstall eoapi templates
324-
run: |
325-
helm uninstall $RELEASE_NAME
326-
kubectl delete ns/$RELEASE_NAME

docs/gcp-gke.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Here's an example command to create a cluster. See the [gcloud docs](https://clo
4444

4545
You might need to iterate on the command above, so to delete the cluster:
4646
```
47-
gcloud container clusters delete my-cluster --zone=us-central1-a
47+
gcloud container clusters delete sandbox --zone=us-central1-a
4848
```
4949

5050
# Enable CSI Driver
@@ -55,10 +55,38 @@ CSI Driver is required for persistent volumes to be mounted to pods. You can ena
5555
gcloud container clusters update sandbox --update-addons=GcePersistentDiskCsiDriver=ENABLED --zone=us-central1-a
5656
```
5757

58+
# Connect to Your Cluster
59+
60+
See [GKE docs for installing and authenticating with kubectl](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl#install_plugin)
61+
62+
See [docs for installing Helm](https://helm.sh/docs/intro/install/)
63+
64+
Configure kubectl to connect to your GKE cluster:
65+
66+
```
67+
gcloud container clusters get-credentials sandbox \
68+
--region=us-central1-a
69+
```
70+
71+
To test the connection, run:
72+
73+
```
74+
kubectl get nodes
75+
```
76+
77+
You should see something like:
78+
79+
```
80+
NAME STATUS ROLES AGE VERSION
81+
gke-eoapi-test-default-pool-94a2b7e7-vg4f Ready <none> 5m v1.31.5-gke.1233000
82+
```
83+
5884
# Install NGINX Ingress Controller
5985

6086
NGINX Ingress Controller can be installed through `helm` using the following command:
6187
```
88+
kubectl create ns eoapi
89+
6290
helm upgrade --install ingress-nginx ingress-nginx \
6391
--repo https://kubernetes.github.io/ingress-nginx \
6492
--namespace eoapi
@@ -68,13 +96,17 @@ See the [NGINX Ingress Controller docs](https://kubernetes.github.io/ingress-ngi
6896

6997
# Install Cert Manager
7098

71-
Cert Manager can be installed through `helm` using the following command:
99+
Cert Manager can be installed through `helm` using the following commands:
72100
```
101+
helm repo add jetstack https://charts.jetstack.io
102+
103+
helm repo update
104+
73105
helm upgrade --install cert-manager jetstack/cert-manager \
74106
--namespace cert-manager \
75107
--create-namespace \
76108
--version v1.12.0 \
77109
--set installCRDs=true
78110
```
79111

80-
Now we are ready to install eoapi. See the [eoapi installation instructions](../README.md/#helm-installation) for more details.
112+
Now we are ready to install eoapi. See the [eoapi installation instructions](../README.md/#helm-installation) for more details.

helm-chart/eoapi/templates/_helpers.tpl

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -61,30 +61,6 @@ Create the name of the service account to use
6161
{{- end }}
6262
{{- end }}
6363

64-
{{/*
65-
Create pgstac host string depending if .Values.testing
66-
*/}}
67-
{{- define "eoapi.pgstacTempDbHostName" -}}
68-
{{- if .Values.testing }}
69-
{{- printf "%s-%s" "pgstac" .Release.Name }}
70-
{{- else }}
71-
{{/* need to match what is default in values.yamls */}}
72-
{{- printf "%s" "pgstac" }}
73-
{{- end }}
74-
{{- end }}
75-
76-
{{/*
77-
Create pgstac host string depending if .Values.testing
78-
*/}}
79-
{{- define "eoapi.pgstacHostName" -}}
80-
{{- if .Values.testing }}
81-
{{- printf "%s-%s" "pgstacbootstrap" .Release.Name }}
82-
{{- else }}
83-
{{/* need to match what is default in values.yamls */}}
84-
{{- printf "%s" "pgstacbootstrap" }}
85-
{{- end }}
86-
{{- end }}
87-
8864
{{/*
8965
Secrets for postgres/postgis access have to be
9066
derived from what the crunchydata operator creates

helm-chart/eoapi/templates/db/deployment.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
apiVersion: apps/v1
44
kind: Deployment
55
metadata:
6-
name: {{ include "eoapi.pgstacTempDbHostName" . | nindent 8 }}
6+
name: pgstac
77
labels:
8-
app: {{ include "eoapi.pgstacTempDbHostName" . | nindent 10 }}
8+
app: pgstac
99
spec:
1010
selector:
1111
matchLabels:
12-
app: {{ include "eoapi.pgstacTempDbHostName" . | nindent 12 }}
12+
app: pgstac
1313
strategy:
1414
type: Recreate
1515
template:
1616
metadata:
1717
labels:
18-
app: {{ include "eoapi.pgstacTempDbHostName" . | nindent 14 }}
18+
app: pgstac
1919
spec:
2020
restartPolicy: Always
2121
containers:
@@ -73,4 +73,4 @@ spec:
7373
- name: initdb-sh-volume-{{ $.Release.Name }}
7474
configMap:
7575
name: initdb-sh-config-{{ $.Release.Name }}
76-
{{- end }}
76+
{{- end }}

helm-chart/eoapi/templates/db/service.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ apiVersion: v1
44
kind: Service
55
metadata:
66
labels:
7-
app: {{ include "eoapi.pgstacTempDbHostName" . | nindent 10 }}
8-
name: {{ include "eoapi.pgstacTempDbHostName" . | nindent 8 }}
7+
app: pgstac
8+
name: pgstac
99
spec:
1010
ports:
1111
- name: "5432"
1212
port: 5432
1313
targetPort: 5432
1414
selector:
15-
app: {{ include "eoapi.pgstacTempDbHostName" . | nindent 10 }}
16-
{{- end }}
15+
app: pgstac
16+
{{- end }}

helm-chart/eoapi/templates/pgstacboostrap/job.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
apiVersion: batch/v1
44
kind: Job
55
metadata:
6-
name: {{ include "eoapi.pgstacHostName" . | nindent 8 }}
6+
name: pgstacbootstrap
77
labels:
8-
app: {{ include "eoapi.pgstacHostName" . | nindent 10 }}
8+
app: pgstacbootstrap
99
spec:
1010
template:
1111
metadata:
1212
labels:
13-
app: {{ include "eoapi.pgstacHostName" . | nindent 14 }}
13+
app: pgstacbootstrap
1414
spec:
1515
restartPolicy: Never
1616
containers:

helm-chart/eoapi/templates/services/ingress-nginx.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,14 @@ spec:
3232
paths:
3333
{{- range $serviceName, $v := .Values }}
3434
{{- if has $serviceName $.Values.apiServices }}
35-
{{- if (and (index $v "enabled") (not $.Values.testing)) }}
35+
{{- if (index $v "enabled") }}
3636
- pathType: ImplementationSpecific
3737
path: "/{{ $serviceName }}(/|$)(.*)"
3838
backend:
3939
service:
4040
name: {{ $serviceName }}
4141
port:
4242
number: {{ $.Values.service.port }}
43-
{{- else if (and (index $v "enabled") ($.Values.testing)) }}
44-
- pathType: ImplementationSpecific
45-
path: "/{{ $serviceName }}{{ $.Release.Name }}(/|$)(.*)"
46-
backend:
47-
service:
48-
name: {{ $serviceName }}-{{ $.Release.Name }}
49-
port:
50-
number: {{ $.Values.service.port }}
5143
{{- end }}{{/* END: if index $v "enabled" */}}
5244
{{- end }}{{/* END: if has $serviceName $.Values.apiServices */}}
5345
{{- end }}{{/* END: range $serviceName, $v := .Values*/}}

helm-chart/eoapi/templates/services/ingress-traefik.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,14 @@ spec:
4242
paths:
4343
{{- range $serviceName, $v := .Values }}
4444
{{- if has $serviceName $.Values.apiServices }}
45-
{{- if (and (index $v "enabled") (not $.Values.testing)) }}
45+
{{- if (index $v "enabled") }}
4646
- pathType: Prefix
4747
path: "/{{ $serviceName }}"
4848
backend:
4949
service:
5050
name: {{ $serviceName }}
5151
port:
5252
number: {{ $.Values.service.port }}
53-
{{- else if (and (index $v "enabled") ($.Values.testing)) }}
54-
- pathType: Prefix
55-
path: "/{{ $serviceName }}{{ $.Release.Name }}"
56-
backend:
57-
service:
58-
name: {{ $serviceName }}-{{ $.Release.Name }}
59-
port:
60-
number: {{ $.Values.service.port }}
6153
{{- end }}{{/* END: if index $v "enabled" */}}
6254
{{- end }}{{/* END: if has $serviceName $.Values.apiServices */}}
6355
{{- end }}{{/* END: range $serviceName, $v := .Values*/}}

helm-chart/eoapi/templates/services/nginx-doc-server.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ data:
1616
<li><a href="/raster" target="_blank" rel="noopener noreferrer">/raster</a></li>
1717
<li><a href="/vector" target="_blank" rel="noopener noreferrer">/vector</a></li>
1818
<li><a href="/stac" target="_blank" rel="noopener noreferrer">/stac</a></li>
19+
{{- if .Values.multidim.enabled }}
20+
<li><a href="/multidim" target="_blank" rel="noopener noreferrer">/multidim</a></li>
21+
{{- end}}
1922
</ul>
2023
</body>
2124
</html>

0 commit comments

Comments
 (0)