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

Adjust workflows to deploy to Minikube #11

Merged
merged 1 commit into from
Oct 15, 2024
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
33 changes: 33 additions & 0 deletions .github/workflows/ci-maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,39 @@ jobs:
- name: Build api-gateway with Maven
run: mvn -B package --file api-gateway/pom.xml

- name: Start minikube
uses: medyagh/setup-minikube@master

- name: Try the cluster !
run: kubectl get pods -A

- name: Build image
run: |
pwd
ls -la
eval $(minikube -p minikube docker-env)
cd api-gateway/
pwd
ls -la
docker build -t api-gateway .
echo -n "verifying images:"
docker images

- name: Deploy to minikube
run: |
pwd
ls -la
kubectl apply -f api-gateway/.helm/templates/k8s-api-gateway-app.yaml
kubectl wait --for=condition=ready pod -l app=api-gateway

- name: Test service URLs
run: |
minikube service list
SERVICE_URL=$(minikube service api-gateway-service --url)
HEALTH_URL="$SERVICE_URL/actuator/health"
echo "Service URL: $SERVICE_URL"
echo "Health URL: $HEALTH_URL"

build_openai_service:
runs-on: ubuntu-latest
# https://stackoverflow.com/a/70448851
Expand Down
35 changes: 35 additions & 0 deletions api-gateway/.helm/templates/k8s-api-gateway-app.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
apiVersion: apps/v1
kind: Deployment # Kubernetes resource kind
metadata:
name: api-gateway
spec:
selector:
matchLabels:
app: api-gateway
replicas: 3 # Number of replicas that will be created for this deployment
template:
metadata:
labels:
app: api-gateway
spec:
containers:
- name: api-gateway
image: api-gateway:latest # Image that will be used to containers in the cluster
imagePullPolicy: IfNotPresent
ports:
- containerPort: 8080 # The port that the container is running on in the cluster

---

apiVersion: v1 # Kubernetes API version
kind: Service # Kubernetes resource kind
metadata: # Metadata of the resource kind
name: api-gateway-service
spec:
selector:
app: api-gateway
ports:
- protocol: "TCP"
port: 8080 # The port that the service is running on in the cluster
targetPort: 8080 # The port exposed by the service
type: NodePort # Type of the service. Service types: NodePort, ClusterIp, LoadBalancer