Coder Social home page Coder Social logo

manusa / yakc Goto Github PK

View Code? Open in Web Editor NEW
42.0 4.0 13.0 8.7 MB

Yet another Kubernetes Client - Lower level Java REST client for Kubernetes API

Home Page: https://blog.marcnuri.com/tag/yakc/

License: Apache License 2.0

Java 97.49% HTML 0.01% JavaScript 2.46% CSS 0.01% Mustache 0.03%
kubernetes rest reactive rxjava reactivex kubernetes-client

yakc's Introduction

YAKC - Yet Another Kubernetes Client

Lower level Java REST client for Kubernetes API.

This project is still in an early stage, public API and classes are subject to changes.

Please try it out and share your opinion, but use at your own risk.

Quick start

TL;DR

Maven

<dependencies>
  <dependency>
    <groupId>com.marcnuri.yakc</groupId>
    <artifactId>kubernetes-api</artifactId>
    <version>0.0.28</version>
  </dependency>
  <dependency>
    <groupId>com.marcnuri.yakc</groupId>
    <artifactId>kubernetes-client</artifactId>
    <version>0.0.28</version>
  </dependency>
</dependencies>

Gradle

dependencies {
  implementation 'com.marcnuri.yakc:kubernetes-api:0.0.28'
  implementation 'com.marcnuri.yakc:kubernetes-client:0.0.28'
}

List all Pods

try (KubernetesClient kc = new KubernetesClient()) {
  kc.create(CoreV1Api.class).listPodForAllNamespaces().stream().forEach(p ->
    System.out.printf("%-15s %s%n", p.getMetadata().getNamespace(), p.getMetadata().getName())
  );
}

Quick start example projects

Check the quickstarts directory for projects ready to use with illustrative examples on how to use the client.

  • Quarkus Kubernetes Dashboard, full featured reactive Kubernetes dashboard built with Quarkus and ReactJS. See nested README.md for more information. You can also checkout a demo on YouTube.
  • Pods contains a Maven project with examples to the diverse available API operations for Pod resources. See nested README.md for more information.
  • Pod Logs contains a Maven project with an example showcasing how to retrieve Pod logs, both with follow and no-follow options. See nested README.md for more information.
  • Pod Exec contains a Maven project with an example showcasing how to execute commands in a Pod container. See nested README.md for more information.
  • Top for Nodes contains a Maven project with an example on how to query Nodes and Pod containers to calculate resource availability and usage. See nested README.md for more information.
  • Custom Resource Definition contains a Maven project with a complete example on how to create Custom Resource Definitions and how to create and use an API to manipulate those custom resources. See nested README.md for more information.
  • Access Cluster from Pod demonstrates how to access the underlying k8s cluster's REST API from within a Pod. See nested README.md for more information.

Katacoda

Check out the different Katacoda scenarios where you can try YAKC from your browser and without installing anything in your machine.

We'll be adding several scenarios with increasing complexity, as of now you can try out how to setup Maven to use YAKC.

Modules

Core

kubernetes-client-api

Maven Central javadoc

Provides the basic interfaces and Exception types to be used across the different modules.

kubernetes-model

Maven Central javadoc

Kubernetes model objects to be used for REST API serialization/deserialization.

Model types are generated for Kubernetes equivalents in versions ranging from 1.15 to 1.25.

kubernetes-api

Maven Central javadoc

Retrofit API client Java interfaces for the latest Kubernetes JSON OpenAPI schema.

API methods for Kubernetes REST endpoints in versions ranging from 1.15 to 1.25.

kubernetes-client

Maven Central javadoc

Kubernetes Retrofit2 based Java client to be used with kubernetes-api or any of the provided apis.

Apis

cert-manager

Maven Central javadoc

Retrofit API client Java interfaces for Kubernetes cert-manager (1.0.4 - 1.5.3).

cert-manager provides support for x509 certificate management for Kubernetes. It's a Kubernetes add-on that automates the management and issuance of TLS certificates, making it very easy to provide certificates for developers working within your cluster.

The Java types provided by YAKC will further improve the developer experience by enabling developers to interact with cert-manager from Java.

Chaos Mesh

Maven Central javadoc

Retrofit API client Java interfaces for Chaos Mesh (1.1.0 - 2.0.0).

Chaos Mesh is chaos engineering platform that orchestrates chaos on Kubernetes environments.

Dapr

Maven Central javadoc

Retrofit API client Java interfaces for Dapr - Distributed Application Runtime (1.0.1 - 1.4.1).

Dapr is a portable, event-driven, runtime for building distributed applications across cloud and edge.

Istio

Maven Central javadoc

Retrofit API client Java interfaces for Istio (1.7 - 1.11.3).

Istio is a service-mesh for distributed applications. Istio leverages the required features to run a successful and efficient distributed microservice architecture by providing a uniform way to secure, monitor and connect microservices.

Knative

Maven Central javadoc

Retrofit API client Java interfaces for Knative (0.19.0 - 0.22.0).

Knative is a Kubernetes-based platform to manage and deploy serverless workloads.

KUDO - Kubernetes Universal Declarative Operator (KUDO)

Maven Central javadoc

Retrofit API client Java interfaces for KUDO (0.18.2 - 0.19.0).

Kubernetes Universal Declarative Operator (KUDO) provides a declarative approach to building production-grade Kubernetes Operators covering the entire application lifecycle.

metrics-server

Maven Central javadoc

Retrofit API client Java interfaces for Kubernetes Metrics Server (0.4.0).

Metrics server collects resource metrics from Pods and Nodes making them ready to be consumed via the Metrics API by Horizontal Pod Autoscaler and other scaling solutions.

YAKC provides the means to access the Metrics API from Java.

OpenShift

Maven Central javadoc

Retrofit API client Java interfaces for OpenShift (3.11 - 4.4).

This module contains models for OpenShift specific Kubernetes resources and the Retrofit APIs to access them.

Extensions

YAKC Quarkus Extension

Maven Central javadoc

This extension provides the requirements to be able to produce Quarkus native images for your application running with YAKC.

The extension is hosted in a separate repository.

yakc's People

Contributors

manusa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

yakc's Issues

Quarkus-Undertow + ServerSentEvents problems

Description

After adding quarkus-undertow extension when implementing [Dashboard] feat: Pod container terminal initial implementation, watcher implementation is "broken" or not working as expected.

Adding undertow implies that RESTEasy runs as a Servlet Filter instead of running on top of Vert.x

This fact causes that client disconnections will no longer be detected and if SSE Observable has been subscribed in other threads, this will cause the Thread to keep running. This combined with the fact of the new self-healing behavior means that Threads are spawned continuously, especially in those environments when access to some resources is forbidden. In addition subscriptions are never disposed.

Relates to:

Automate release to Maven Central

Description

Maven Central release process should be fully automated upon release version tagging.

Tasks

  • Create Gradle build script to enable publishing of public modules
  • Create GitHub actions task to be run on tag

Modularize Project

Description

In order to make use of incremental Gradle builds and prevent annotation processor from running several times for model and API classes, create separate Gradle modules for the client and the API (kubernetes-client, API)

get deployment resource

Is there a feature planned tp get deployment resource definitions?
I would like to ask for the replicas coont.

Customized retrofit Call

Description

  • Allows for better/simpler object retrieval
  • Provides typed exceptions
  • Method for a reactive stream watch implementation

Project bootrstrap

API Information

  • Run Minikube for a given k8s version (--kubernetes-version=1.17.2)
  • Run kubectl proxy to expose API kubectl proxy --port=8080
  • Check OpenAPI v2 spec: http://localhost:8080/openapi/v2

Libraries

Tools

Configuration Defaults

Configuration helper class to retrieve unspecified configuration arguments.

KubernetesClient should work without any kind of configuration (Zero Config).

This class should provide the default values for the necessary arguments:

  • Read/Connection timeouts
  • Default URL
  • ...

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.