Skip to content

Commit d16fe59

Browse files
committed
Restapi 956 add docs to kong yml k8s and demo for api spec
1 parent 4f7ff85 commit d16fe59

16 files changed

+75
-4230
lines changed

.gitlab-ci.yml

+10-10
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ build_images:
2828
- unzip vault_1.11.0_linux_amd64.zip
2929
- export PATH=$PATH:$(pwd)
3030
- export VAULT_ADDR="$CI_VAULT_ADDR"
31-
31+
3232
- mkdir -p /kaniko/.docker
3333
- echo '{"auths":{"'$CI_REGISTRY'":{"username":"'$CI_REGISTRY_USER'","password":"'$CI_REGISTRY_PASSWORD'"}}}' > /kaniko/.docker/config.json
3434
- |
@@ -85,19 +85,22 @@ deploy_dev:
8585
- helm list -n ${CI_NAMESPACE_DEV} --kube-token=${CI_K8S_TOKEN}
8686

8787
- cd deploy/k8s
88-
88+
8989
- |
9090
## adding at the end of values-dev.yaml on global section
9191
echo -e "\n registry: ${CI_REGISTRY_PREFIX}\n tag: '${CI_COMMIT_SHORT_SHA}' \n namespace: ${CI_NAMESPACE_DEV}\n" >> values-dev.yaml
92-
92+
93+
# link API specification inside chart
94+
ln -s ../../../../doc/openapi/firecrest-api.yaml openapi/files/firecrest-api.yaml
95+
9396
for app in config certificator compute jaeger keycloak kong minio openapi reservations status storage tasks utilities; do
9497
helm uninstall -n ${CI_NAMESPACE_DEV} --kube-token=${CI_K8S_TOKEN} "$app" || true
9598
helm install --wait --wait-for-jobs --timeout 240s -n ${CI_NAMESPACE_DEV} -f values-dev.yaml --kube-token=${CI_K8S_TOKEN} "$app" $app;
9699
done
97100
# Cluster is deployed separatelly ALWAYS with tag = latest
98101
- |
99102
echo -e "global:\n registry: ${CI_REGISTRY_PREFIX}\n tag: latest\n namespace: ${CI_NAMESPACE_DEV}\n" > values-cluster-dev.yaml;
100-
103+
101104
helm uninstall -n ${CI_NAMESPACE_DEV} --kube-token=${CI_K8S_TOKEN} cluster || true;
102105
helm install --wait --wait-for-jobs --timeout 180s -n ${CI_NAMESPACE_DEV} -f values-cluster-dev.yaml --kube-token=${CI_K8S_TOKEN} cluster cluster;
103106
@@ -125,11 +128,8 @@ deploy_dev:
125128
while :
126129
do
127130
sleep 20s;
128-
129131
tester_pod=$(kubectl get pods --selector=job-name=job-tester -n ${CI_NAMESPACE_DEV} --token="${CI_K8S_TOKEN}" --output=jsonpath='{.items[*].metadata.name}');
130-
131132
echo "Tester pod is: $tester_pod";
132-
133133
pdstatus=$(kubectl get pods -n ${CI_NAMESPACE_DEV} --token="${CI_K8S_TOKEN}" $tester_pod -o jsonpath="{.status.phase}");
134134
135135
if [ "$pdstatus" = "Running" ] || [ "$pdstatus" = "Pending" ]; then
@@ -272,12 +272,12 @@ tag_release:
272272
273273
echo "Tagging image ${CI_REGISTRY_GROUP}/$img/$tag"
274274
jfrog rt copy --flat=true --url="https://${CI_REGISTRY}/artifactory" --user="${CI_REGISTRY_USER}" --password="${CI_REGISTRY_PASSWORD}" "${CI_REGISTRY_GROUP}/$img/${CI_COMMIT_SHORT_SHA}/" "${CI_REGISTRY_GROUP}/$img/$tag/";
275-
275+
276276
if [ "$code_tag" == "prod" && "$tag" != "prod" && "$img" != "reservations" ]; then
277277
# if code_tag indicates prod and tag is 'v1...', also publish to GitHub
278278
crane copy ${CI_REGISTRY_PREFIX}/${img}:${tag} ghcr.io/eth-cscs/firecrest/f7t-${img}:${tag}
279279
fi
280-
280+
281281
done
282282
done
283283
@@ -288,7 +288,7 @@ tag_release:
288288
helm package --version=$CI_COMMIT_TAG --app-version=$CI_COMMIT_TAG deploy/k8s/$img
289289
290290
file=$(find . -iname "$img-*.tgz" -print -maxdepth 1)
291-
291+
292292
sha1=`sha1sum $file | awk '{print $1}'`
293293
sha256=`sha256sum $file | awk '{print $1}'`
294294
md5=`md5sum $file | awk '{print $1}'`

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1919
- CI/CD pipeline is now adapted to create helm charts images and push to a repository when TDS or Prod are tagged
2020
- Also secrets now can be managed from ExternalSecrets on K8s deployment
2121
- Deployment on TDS triggers ArgoCD deployment
22+
- Demo and k8s deployments have the Swagger UI API specification at unauthenticated `/docs` endpoint
2223

2324
## [1.13.1]
2425

deploy/demo/README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# FirecREST demo
22

3-
This demo uses [Docker Compose](https://docs.docker.com/compose/install/) to setup containers for FirecREST microservices, a template client, Keycloak, Kong, Redis, Minio and a dummy cluster with Slurm.
3+
This demo uses [Docker Compose](https://docs.docker.com/compose/install/) to setup containers for FirecREST microservices, a template client, Keycloak, Kong, Redis, Minio and a dummy cluster with Slurm. It should also work with Podman and [Podman Compose](https://github.com/containers/podman-compose) for a rootless setup.
44

55
## Quick start
66

@@ -19,7 +19,9 @@ To start containers:
1919

2020
`docker-compose up`
2121

22-
Then, go to `http://localhost:7000` User is `test1` and password is `test11`
22+
The web client is available at `http://localhost:7000` User is `test1` and password is `test11`
23+
24+
The API is at `http://localhost:8000` and the specification is at `http://localhost:8000/docs`
2325

2426

2527
To stop all containers:

deploy/demo/docker-compose.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ services:
103103
F7T_S3_REGION: us-east-1
104104
F7T_STORAGE_POLLING_INTERVAL: 60
105105
F7T_CERT_CIPHER_KEY: 'Df6UZuoPoJ2u5yRwxNfFQ46Nwy8eW1OGTcuhlqn4ONo='
106-
#debug: "True"
107106
networks:
108107
firecrest-internal:
109108
ipv4_address: 192.168.220.5
@@ -124,7 +123,6 @@ services:
124123
environment:
125124
- F7T_PERSIST_PORT=6379
126125
- F7T_PERSIST_PWD=rediS2200
127-
- F7T_DEBUG_MODE=True
128126
- F7T_COMPUTE_TASK_EXP_TIME=86400
129127
- F7T_STORAGE_TASK_EXP_TIME=2678400
130128
depends_on:
@@ -226,7 +224,7 @@ services:
226224
- ./logs/keycloak:/opt/jboss/keycloak/standalone/log/:delegated
227225

228226
kong:
229-
image: kong:2.5.0
227+
image: kong:2.8.4
230228
container_name: kong
231229
environment:
232230
- KONG_DATABASE=off
@@ -281,12 +279,14 @@ services:
281279
- ./ssl:/ssl
282280

283281
openapi:
284-
image: swaggerapi/swagger-ui:v3.47.1
282+
image: swaggerapi/swagger-ui:v4.19.1
285283
container_name: openapi
286-
ports:
287-
- "9090:8080"
284+
networks:
285+
firecrest-internal:
286+
ipv4_address: 192.168.220.41
288287
environment:
289288
SWAGGER_JSON: /tmp/firecrest-api.yaml
289+
BASE_URL: /docs
290290
volumes:
291291
- ../../doc/openapi/:/tmp/
292292

deploy/demo/kong/kong.yml

+14
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ plugins:
4747
consumers:
4848
- username: firecrest
4949
custom_id: firecrest
50+
- username: docs
51+
custom_id: docs
5052

5153
jwt_secrets:
5254
- consumer: firecrest
@@ -69,6 +71,18 @@ services:
6971
methods: [DELETE,GET,POST]
7072
paths:
7173
- /compute/
74+
- name: docs
75+
url: http://192.168.220.41:8080
76+
routes:
77+
- name: docs
78+
methods: [GET]
79+
paths:
80+
- /docs
81+
strip_path: false
82+
plugins:
83+
- name: jwt
84+
config:
85+
anonymous: docs
7286
- name: status
7387
url: https://192.168.220.4:5001
7488
routes:

deploy/k8s/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Kubernetes deployment with Helm
2+
3+
## Before deploying
4+
Helm only allows to include files inside the chart directory. To install the 'openapi' chart (SwaggerUI) it is required to make symlink to the OpenAPI specification
5+
6+
`ln -s ../../../../doc/openapi/firecrest-api.yaml openapi/files/firecrest-api.yaml`

0 commit comments

Comments
 (0)