This project provides a Kubernetes API wrapper with authentication and various Kubernetes resource management endpoints. 🎯
- 🔐 Authentication (Basic Auth, Google, and GitHub)
- 👥 User management
- 📅 Event viewing
- 📦 Kubernetes resource management (Pods, Deployments, Namespaces)
- 📚 Swagger documentation
- Web Framework: Echo v4 🌐
- Logging: ZapLogger 📄
- Kubernetes Client: k8s.io/client-go 🐳
- Database: PostgreSQL 🗄️
- Configuration: yaml and viper for environment mapping 📑
/auth/login
- Log in with basic authentication 🔑
/auth/google_login
- Log in with Google 🌍/auth/google_callback
- Google login callback/auth/github_login
- Log in with GitHub 🐙/auth/github_callback
- GitHub login callback
/users
- Create users
- Edit users
- Retrieve all users (paginated)
- Retrieve user details
- Delete users
/events
- List events/events/:id
- Get event details
/pods
- Create pods
- Edit pods
- Retrieve all pods (paginated)
- Retrieve pod details
- Delete pods
/deployments
- Create deployments
- Edit deployments
- Retrieve all deployments (paginated)
- Retrieve deployment details
- Delete deployments
/namespaces
- Create namespaces
- Edit namespaces
- Retrieve all namespaces (paginated)
- Retrieve namespace details
- Delete namespaces
You can access the Swagger documentation at the following URL:
/swagger/index.html
- Kubernetes 🐋
- Go (version 1.23.1 or later) ⚙️
- kubectl configured with access to your Kubernetes cluster 📡
To set up the PostgreSQL database for the Kubernetes API, follow these steps:
-
Create Environment File
Copy the example environment file to create your .env file:
cp .env_example .env
Ensure that you update the .env file with your specific environment variables.
-
Run PostgreSQL Setup Script
Execute the postgres_setup.sh script to initialize the PostgreSQL database:
./postgres_setup.sh
This script will:
- Set up the PostgreSQL container if it's not already running.
- Create the necessary tables in the database.
-
Clone the repository:
git clone https://github.com/fleimkeipa/kubernetes-api.git cd kubernetes-api
-
Install dependencies:
go mod download
-
Build the application:
go build
-
Run the application:
./kubernetes-api
Here are some example API calls using curl:
-
Login (Basic Auth):
curl -X POST http://localhost:8080/auth/login -u username:password
We welcome contributions to the kubernetes-api project! Here's how you can contribute:
- Fork the repository 🍴
- Create your feature branch (
git checkout -b feature/AmazingFeature
) 🌿 - Commit your changes (
git commit -m 'Add some AmazingFeature'
) 💬 - Push to the branch (
git push origin feature/AmazingFeature
) 🚀 - Open a Pull Request 📝
Please make sure to update tests as appropriate and adhere to the project's coding standards.
This project is licensed under the MIT License - see the LICENSE.md file for details.
If you encounter any problems or have any questions, please open an issue in the GitHub repository.