Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

k8s: Use configmap for API deployment #324

Merged
merged 6 commits into from
Sep 1, 2023
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
8 changes: 4 additions & 4 deletions kube/minikube/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,20 @@ kubectl logs <pod-name>

As kernelci-api relies on other deployments, it is important to get them up and running first and get kernelci-api up and running afterwards. Thus after completing all the above steps, you can apply ```api-deployment.yaml``` file that is present in the root of kube/minikube folder. To apply the YAML file in the minikube cluster, simply run
```
kubectly apply -f api-deployment.yaml
kubectl apply -f api-deployment.yaml
```

## Cleaning up everything afterwards

To clean up everything simply use the ```clean-all.sh``` script provided in the root of the kube/minikube/hack folder by running
To clean up everything simply use the ```clean-all.sh``` script provided in the root of the kube/minikube/scripts folder by running
```
./clean-all.sh
```

## Deploying all the resources at once

To apply all the resources at once, you can use the ```apply-all.sh``` script provided in the root of the kube/minikube/hack folder by running
To apply all the resources at once, you can use the ```deploy.sh``` script provided in the root of the kube/minikube/scripts folder by running
```
./apply-all.sh
./deploy.sh
```
This script would also do the clean up and will deploy everything afresh. But it can be time-consuming to deploy everything afresh, so if you want to reconfigure some deployment maybe because the image is updated, just reapply that deployment or do the rolling update instead of running this script.
10 changes: 8 additions & 2 deletions kube/minikube/api-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,15 @@ spec:
name: kernelci-api-secret
key: secret-key
- name: REDIS_HOST
value: "kernelci-api-redis.default.svc.cluster.local"
valueFrom:
configMapKeyRef:
name: kernelci-api-config
key: redis_host
- name: MONGO_SERVICE
value: "mongodb://kernelci-api-db.default.svc.cluster.local:27017"
valueFrom:
configMapKeyRef:
name: kernelci-api-config
key: mongo_service
volumeMounts:
- name: api-volume
mountPath: /home/kernelci/api
Expand Down
13 changes: 13 additions & 0 deletions kube/minikube/configmap/api-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Copyright (C) 2023 Collabora Limited
# Author: Jeny Sadadia <[email protected]>

apiVersion: v1
kind: ConfigMap
metadata:
name: kernelci-api-config
namespace: default
data:
redis_host: "kernelci-api-redis.default.svc.cluster.local"
mongo_service: "mongodb://kernelci-api-db.default.svc.cluster.local:27017"
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ check_job_completed "github-cloning-job"
kubectl create secret generic kernelci-api-secret --from-literal=secret-key=$(openssl rand -hex 32)
check_resource_exist "Secret" "kernelci-api-secret"

# Generate configmap
kubectl create -f ../configmap/api-configmap.yaml
check_resource_exist "configmaps" "kernelci-api-config"

# Set up persistent volume claim
kubectl apply -f ../pvc/db-pvc.yaml
check_pvc_bound "mongo-data-pvc"
Expand Down
Loading