The Email Validator is a simple web API that checks the validity of email addresses. It is built with Flask and deployed on Kubernetes using Minikube.
- Email Validation: Validates email addresses for proper format.
- RESTful API: Provides an easy-to-use endpoint for integration.
- Scalable Deployment: Deployed on Kubernetes for scalability and reliability.
- Docker installed on your machine.
- Minikube installed and running.
- Kubectl command-line tool installed.
git clone https://github.com/himarygr/email-validator-ci-cd.git
cd email-validator-ci-cd
Start Minikube if it's not already running:
minikube start
Build the Docker images for the application:
# Switch to Minikube's Docker daemon
eval $(minikube docker-env)
# Build the proper solution image
docker build -t email-validator-proper:latest ./proper_solution
# Build the fallback solution image
docker build -t email-validator-fallback:latest ./fallback_solution
Apply the Kubernetes manifests to deploy the application:
kubectl apply -f k8s/
Since direct access may not be available due to network configurations, use port forwarding to access the application:
kubectl port-forward service/email-validator-service 8080:80
Keep this terminal window open to maintain the port forwarding session.
In a new terminal window, you can test the application using curl
:
curl -X POST -H "Content-Type: application/json" \
-d '{"email": "[email protected]"}' \
http://localhost:8080/validate
Expected Response:
{"valid": true}
Replace "[email protected]"
with the email address you want to validate.
Validates the provided email address.
-
URL:
/validate
-
Method:
POST
-
Headers:
Content-Type: application/json
-
Body Parameters:
email
(string): The email address to validate.
-
Success Response:
-
Code:
200 OK
-
Content:
{"valid": true}
-
-
Error Response:
-
Code:
400 Bad Request
-
Content:
{"error": "Invalid request"}
-
This project is licensed under the MIT License.