/kubernetes-operator-api

The Kubernetes API is a sample Kubernetes operator API using the Java Kubernetes Client. The API is designed for master-worker deployment to satisfy the requirements.

Primary LanguageJavaMIT LicenseMIT

Kubernetes Operator Api

The Kubernetes API is a sample Kubernetes operator API using the Java Kubernetes Client.
The API is designed for master-worker deployment to satisfy the requirements.

Overview

  • The CI/CD tool we used before this API started to not be enough.
    The reasons why it is not enough are:

    • Deployments take too long to create, scale, and terminate.
    • In synchronous requests, some of the scenarios' statuses were pending or failed.
    • The pending scenarios could not be retried.
    • Rollbacks could not be performed automatically.
    • Since there was a strict structure to the deployment process, we could not do the business development at any stage.

    By using this API, above problems have been solved. You can use this API for such requirements.

  • In the resources folder of our application we have:
    master-deployment.yaml, worker-deployment.yaml, master-service.yaml, master-service-ui.yaml
    You must customize these files to suit you. This pattern __ was used in file reading operations. Let's not overlook it.
    Note that you must use all four of these deployment yaml's.

  • The strategy pattern has been used so that the project can work with more than one data center.
    You must define the data center strategy you want to use. After that, it will be enough to send it in the data_center field.

The following are the flows that we have implemented in this project.

Create deployment flow

  - Deploy master
  - Roll out status
  - Deploy worker
  - Roll out status
  - Create service
  - Create service ui 
  - Print pod status 
  - Retrieve service list
  - Print service status

Scale deployment flow

  - Scale deployment
  - Roll out status

Terminate deployment flow

  - Delete master deployment
  - Delete worker deployment
  - Delete master service
  - Delete master ui service

Tech Stack
  • Java 11
  • Spring Boot
  • Kubernetes Client
Requirements

For building and running the application, you need:

Build & Run
  mvn clean install 
  mvn --projects kubernetes-operator-api spring-boot:run
Port
  http://localhost:1234
License

Distributed under the MIT License. See LICENSE for more information.