Giter Site home page Giter Site logo

konveyor / tackle2-addon-jkube Goto Github PK

View Code? Open in Web Editor NEW
1.0 10.0 3.0 42 KB

Tackle (2nd generation) addon for generating K8s manifests for Java applications

Dockerfile 3.72% Makefile 3.85% Go 82.08% Shell 10.35%
jkube kubernetes application-modernization java

tackle2-addon-jkube's Introduction

Tackle2 Addon Jkube

This project exposes JKube's kubernetes-maven-plugin as an addon for Tackle2, enabling Java applications with Maven integration to have container image and Kubernetes manifests built for them.

This addon focus on two tasks:

  • Generates container images with flexible and powerful configuration.
  • Generates vanilla Kubernetes descriptors (YAML files).

It leverages the Kubernetes Maven plugin to generate container image and Kubernetes manifests.

Development

To browse code - Open in VSCode

We use tackle2-hub addon package to integrate addon with tackle2-hub. Here is a good starter template to build an addon - Test Addon. Tackle Hub handles all requests to an addon via Task APIs and forward these requests to desired addon.

A simple request for an addon would look like this:

host="${HOST:-localhost:8080/hub}"

# Make a request to hub
request_cmd="$(curl -i -o - -X POST ${host}/tasks -d \
'{
    "name":"Jkube",
    "state": "Ready",
    "locator": "jkube",
    "addon": "jkube",
    "application": {"id": 2},
    "data": {}
}')"

In above request we mention addon: jkube as an addon identifier and application: {id: 2} states the application against which this addon will be executed. The data field here is empty because we are not accepting any data for this addon, but we can pass data during api request to addons which accepts data, and we use this struct to receive data for the addon.

Once a request is received - addon will fetch the application mentioned in the request and perform the operations defined in the addon. For this addon we perform following operations:

  • Fetch the application (clone GitHub/subversion repository)
  • Parse the maven config file and add kubernetes-maven-plugin to pom.xml
  • Build the application using maven build
  • Use kubernetes-maven-plugin to generate container image and k8s manifests
  • Commit the generated resources to repo

Development Environment Setup

Steps to successfully execute Jkube addon:

  1. Clone this repo

    https://github.com/konveyor/tackle2-addon-jkube.git
  2. Start a minikube environment and install tackle

    make start-minikube install-tackle
  3. Add Jkube addon to tackle - jkube addon

    kubectl apply -f hack/addon.yml
  4. Create an application in Tackle using this command

    host="${HOST:-localhost:8080/hub}"
    # Create an Application
    curl -X POST ${host}/applications -d \
    '{
        "createUser": "tackle",
        "name":"JkubeDemo",
        "description": "Spring Boot demo application.",
        "repository": {
          "name": "jkube_demo",
          "url": "https://github.com/mundra-ankur/jkube_demo.git",
          "branch": "main"
        },
        "businessService": {"id":1}
    }' | jq -M .
  5. Get an application id (required in step 7), list all applications using

    kubectl port-forward service/tackle-ui 8080:8080 -n konveyor-tackle
    curl -X GET localhost:8080/hub/applications | jq .
  6. Populate required data in tackle, including application against which addon will be executed - reference, jkube-data

    bash hack/task.sh
  7. Create task to run JKube addon against our application - task

    bash hack/task_ready.sh

Follow the Jkube Addon Demonstration for end-to-end setup and execution.

Reference - Windup Addon

For Windup addon, we have build an end-to-end pipeline to test the addon.

Here you will find everything you need to successfully execute an addon, we did it using GitHub actions. This pipeline is very loosely coupled, and you can utilize its pieces to create your own workflow, to test your addon quickly.

Output

  • Deployment artifacts
    • Dockerfile
    • Kubernetes Manifests

Jkube Addon Demonstration

Jkube_Addon_Demonstration.-.HD.1080p.mov

๐Ÿ“ฝ๏ธ Watch on YouTube

tackle2-addon-jkube's People

Contributors

jmontleon avatar mundra-ankur avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tackle2-addon-jkube's Issues

Expand README

This project is an excellent example of how to build an addon for Tackle, we should make it accessible to newcomers looking to build an addon with things like:

  • A video demonstration/walkthrough of the addon being executed + it's results
  • A text walkthrough of enabling the addon + execution + results

Idea here is to have a README that talks about what this project is and how to use it with Tackle.

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.