Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 0 additions & 126 deletions .github/workflows/ci.bkup

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/deploy_mkdocs.bkup

This file was deleted.

63 changes: 38 additions & 25 deletions .github/workflows/helm-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ jobs:
- uses: actions/checkout@v3

- uses: azure/setup-helm@v3
with:
helm-version: v3.8.2
github-token: ${{ secrets.GITHUB_TOKEN }}

- name: start minikube
uses: medyagh/setup-minikube@master
Expand Down Expand Up @@ -80,37 +83,47 @@ jobs:
cd helm-chart/eoapi
kubectl apply -f eoapi-manfests.yaml

- name: sleep for 5s seconds while services boot
run: sleep 5s
- name: sleep for 20s seconds while services boot
shell: bash
run: sleep 20s

- name: restart the services
run: |
# usually if a pod fails b/c the DB isn't up yet it will go into CrashLoopBack state
# and try to restart itself then on the second try be able to connect
# minikube doesn't seem to do this by default so we force it to happen by deleting the `/pod`
# and therefore the deployment will restart the pod
kubectl get pod | grep '^vector-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}
kubectl get pod | grep '^stac-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}
kubectl get pod | grep '^raster-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}

- name: sleep for 10s seconds while services restart
run: sleep 10s
shell: bash
# usually if a pod fails b/c the DB isn't up yet it will go into CrashLoopBackOff state, so bounce them
#kubectl get pod | grep '^vector-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}
kubectl rollout restart deploy/vector
#kubectl get pod | grep '^stac-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}
kubectl rollout restart deploy/stac
#kubectl get pod | grep '^raster-.*$' | cut -d' ' -f1 | xargs -I{} kubectl delete pod/{}
kubectl rollout restart deploy/raster

sleep 10s

while [[ -z "$(kubectl get pod | grep '^raster-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do
echo "still waiting for raster service to start..."
sleep 1
done
echo "raster service has started, moving on..."
while [[ -z "$(kubectl get pod | grep '^vector-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do
echo "still waiting for vector service to start..."
sleep 1
done
echo "vector service has started, moving on..."
while [[ -z "$(kubectl get pod | grep '^stac-.*$' | cut -d' ' -f1 | xargs -I{} kubectl logs pod/{} | grep "startup complete" | head -n 1)" ]]; do
echo "still waiting for stac service to start..."
sleep 1
done
echo "all services have started, moving on..."

sleep 10s

- name: test service urls
run: |
minikube service list
# echo "------------------opening the service------------------"
# URL=$(minikube service vector --url)
# curl -XGET "$URL/collections"
# URL=$(minikube service stac --url)
# curl -XGET "$URL"
# URL=$(minikube service raster --url)
# curl -XGET "$URL"

# - name: setup upterm session
# uses: lhotari/action-upterm@v1
# curl -XGET "$(minikube service vector --url)"
# curl -XGET "$(minikube service stac --url)"
# curl -XGET "$(minikube service raster --url)"

- name: install python unit-test dependencies
run: |
Expand All @@ -121,17 +134,17 @@ jobs:
# first substitute test enpoints in the test files
# TODO: pytest should be able to have a pattern for injection here but htis is quicker
URL=$(minikube service vector --url)
sed -i "s|vector_endpoint\=.*$|vector_endpoint\='$URL/vector'|g" .github/workflows/tests/test_vector.py
sed -i "s|vector_endpoint\=.*$|vector_endpoint\='$URL'|g" .github/workflows/tests/test_vector.py
head -n 5 .github/workflows/tests/test_vector.py
pytest .github/workflows/tests/test_vector.py

URL=$(minikube service stac --url)
sed -i "s|stac_endpoint\=.*$|stac_endpoint\='$URL/stac'|g" .github/workflows/tests/test_stac.py
sed -i "s|stac_endpoint\=.*$|stac_endpoint\='$URL'|g" .github/workflows/tests/test_stac.py
head -n 5 .github/workflows/tests/test_stac.py
pytest .github/workflows/tests/test_stac.py

URL=$(minikube service raster --url)
sed -i "s|raster_endpoint\=.*$|raster_endpoint\='$URL/raster'|g" .github/workflows/tests/test_raster.py
sed -i "s|raster_endpoint\=.*$|raster_endpoint\='$URL'|g" .github/workflows/tests/test_raster.py
head -n 5 .github/workflows/tests/test_raster.py
pytest .github/workflows/tests/test_raster.py

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests/test_raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import httpx

raster_endpoint = "http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/raster"
raster_endpoint="http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/raster"


def test_raster_api():
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests/test_stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import httpx

stac_endpoint = "http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/stac/"
stac_endpoint="http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/stac/"


def test_stac_api():
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests/test_vector.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import httpx

vector_endpoint = "http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/vector/"
vector_endpoint="http://k8s-gcorradi-nginxing-553d3ea33b-3eef2e6e61e5d161.elb.us-west-1.amazonaws.com/vector/"


def test_vector_api():
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# k8s-eoapi

<p align="center">
<a href="https://github.com/developmentseed/k8s-eoapi/actions?query=workflow%3Ahelm-tests" target="_blank">
<img src="https://github.com/developmentseed/k8s-eoapi/actions/workflows/helm-tests.yml/badge.svg" alt="Test">
</a>
<a href="https://github.com/developmentseed/k8s-eoapi/blob/main/LICENSE" target="_blank">
<img src="https://img.shields.io/github/license/developmentseed/titiler.svg" alt="Downloads">
</a>
</p>

---

## Getting Started

If you don't have a k8s cluster set up on AWS or GCP then follow an IAC guide below that is relevant to you. This helm chart hasn't been
tested on [minikube](https://github.com/kubernetes/minikube) yet:
If you don't have a k8s cluster set up on AWS or GCP then follow an IAC guide below that is relevant to you

> &#9432; The helm chart in this repo assumes your cluster has a few third-party add-ons and controllers installed. So
> it's in your best interest to read through the IAC guides to understand what those defaults are
Expand Down
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.tipg
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/developmentseed/tipg:uvicorn-latest
FROM ghcr.io/developmentseed/tipg:uvicorn-0.2.0
2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.titiler
Original file line number Diff line number Diff line change
@@ -1 +1 @@
FROM ghcr.io/stac-utils/titiler-pgstac:uvicorn-latest
FROM ghcr.io/stac-utils/titiler-pgstac:uvicorn-0.4.1
6 changes: 3 additions & 3 deletions helm-chart/eoapi/templates/db/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
name: pgstac-secrets
ports:
- containerPort: 5432
{{- if not (eq $.Values.ingress.className "minikube") }}
{{- if not (eq .Values.providerContext "minikube") }}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pgstac-claim
Expand All @@ -47,7 +47,7 @@ spec:
ports:
- containerPort: 6543
volumeMounts:
{{- if not (eq $.Values.ingress.className "minikube") }}
{{- if not (eq .Values.providerContext "minikube") }}
- mountPath: /var/lib/postgresql/data
name: pgstac-claim
{{ end }}
Expand All @@ -59,7 +59,7 @@ spec:
name: initdb-sh-volume
{{- end }}
volumes:
{{- if not (eq $.Values.ingress.className "minikube") }}
{{- if not (eq .Values.providerContext "minikube") }}
- name: pgstac-claim
persistentVolumeClaim:
claimName: pgstac-claim
Expand Down
2 changes: 1 addition & 1 deletion helm-chart/eoapi/templates/services/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ spec:
spec:
containers:
- image: {{ index $v "image" "name" }}:{{ index $v "image" "tag" }}
{{- if (and ($.Values.ingress.className) (eq $.Values.ingress.className "minikube")) }}
{{- if (eq $.Values.providerContext "minikube") }}
imagePullPolicy: Never
{{- end }}
name: {{ $serviceName }}
Expand Down
2 changes: 2 additions & 0 deletions helm-chart/eoapi/test-helm-values.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# this file is used with `helm-tests` job in CI
providerContext: "aws"

ingress:
enabled: true

Expand Down
Loading