diff --git a/kube/minikube/README.md b/kube/minikube/README.md index 1dca3a24..0c08ef88 100644 --- a/kube/minikube/README.md +++ b/kube/minikube/README.md @@ -132,20 +132,20 @@ kubectl logs 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. diff --git a/kube/minikube/api-deployment.yaml b/kube/minikube/api-deployment.yaml index 362e04b8..280baf0c 100644 --- a/kube/minikube/api-deployment.yaml +++ b/kube/minikube/api-deployment.yaml @@ -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 diff --git a/kube/minikube/configmap/api-configmap.yaml b/kube/minikube/configmap/api-configmap.yaml new file mode 100644 index 00000000..81a1c8ad --- /dev/null +++ b/kube/minikube/configmap/api-configmap.yaml @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# Copyright (C) 2023 Collabora Limited +# Author: Jeny Sadadia + +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" diff --git a/kube/minikube/hack/clean-all.sh b/kube/minikube/scripts/clean-all.sh similarity index 100% rename from kube/minikube/hack/clean-all.sh rename to kube/minikube/scripts/clean-all.sh diff --git a/kube/minikube/hack/apply-all.sh b/kube/minikube/scripts/deploy.sh similarity index 95% rename from kube/minikube/hack/apply-all.sh rename to kube/minikube/scripts/deploy.sh index 36dfa561..3fcc51b6 100755 --- a/kube/minikube/hack/apply-all.sh +++ b/kube/minikube/scripts/deploy.sh @@ -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"