Git Product home page Git Product logo

librarybookoperatorinjava's Introduction

Simple Kubernetes Operator demonstrating Library Management

This is a simple demo Kubernetes Operator written to mimic Library Management using Quarkus Fabric8 Kubernetes Client Extension. It operates on the following Custom Resources:

  • Book
  • BookIssueRequest

Scenarios Considered:

  • User creates a BookIssueRequest which updates the requested Book setting it's issued status to true and updating issuedTo section in Book's status.

  • On Deleting any BookIssueRequest, Book is updated again and is marked available for issue(by setting issued status to false

  • Any update in BookIssueRequest object would update specified Book resource in case it's different from previous value

Both Book and BookIssueRequest CustomResources are watched in specified namespace and Operator tries to issue/free any book which is requested via adding/deleting any BookIssueRequest.

How to Build

You can build it as any standard maven project

mvn clean install

Installing Custom Resource Definitions

As an administrator, you would need to create these CRDs in your Kubernetes cluster:

kubectl create -f src/main/resources/k8s/crds/book-crd.yaml
kubectl create -f src/main/resources/k8s/crds/bookissuerequest-crd.yaml

How to Run

Make sure that you have access to a Kubernetes Cluster(minikube or crc). You can start your Operator locally using standard Quarkus Maven Plugin goals:

mvn quarkus:dev

Deploying to Kubernetes using Eclipse JKube

In order to deploy this Operator to Kubernetes, we will be using Eclipse JKube. First we would need to deploy Role, RoleBinding and ServiceAccount for our Operator to Kubernetes

kubectl create -f src/main/resources/k8s/role.yaml
kubectl create -f src/main/resources/k8s/rolebinding.yaml
kubectl create -f src/main/resources/k8s/serviceaccount.yaml

Then you should be able to deploy the Operator using this command:

mvn k8s:deploy -PKubernetes

librarybookoperatorinjava's People

Contributors

rohankanojia avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

zyd8888102

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.