Skip to content

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.

Notifications You must be signed in to change notification settings

himarygr/email-validator-ci-cd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Email Validator Application

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.

Table of Contents

Features

  • 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.

Prerequisites

  • Docker installed on your machine.
  • Minikube installed and running.
  • Kubectl command-line tool installed.

Installation

1. Clone the Repository

git clone https://github.com/himarygr/email-validator-ci-cd.git
cd email-validator-ci-cd

2. Start Minikube

Start Minikube if it's not already running:

minikube start

3. Build Docker Images

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

4. Deploy to Kubernetes

Apply the Kubernetes manifests to deploy the application:

kubectl apply -f k8s/

Usage

Accessing the Application

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.

Sending a Validation Request

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.

API Reference

POST /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"}

License

This project is licensed under the MIT License.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published