GithubHelp home page GithubHelp logo

isabella232 / dropwizard-kubernetes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dropwizard/dropwizard-kubernetes

0.0 0.0 0.0 194 KB

A convenience library for the integration of the Fabric8 Kubernetes client in a Dropwizard service.

License: Apache License 2.0

Shell 0.59% Java 99.41%

dropwizard-kubernetes's Introduction

dropwizard-kubernetes

Build Status Coverage Status Maven Central

Provides easy integration for Dropwizard applications with the Fabric8 Kubernetes API client.

This bundle comes with out-of-the-box support for:

For more information on the Kubernetes API, take a look at the official documentation here: https://kubernetes.io/docs/reference/#api-reference

Dropwizard Version Support Matrix

dropwizard-kubernetes Dropwizard v1.3.x Dropwizard v2.0.x
v1.3.x
v1.4.x

Usage

Add dependency on library.

Maven:

<dependency>
  <groupId>io.dropwizard.modules</groupId>
  <artifactId>dropwizard-kubernetes</artifactId>
  <version>${dropwizard-kubernetes.version}</version>
</dependency>

Gradle:

compile "io.dropwizard.modules:dropwizard-kubernetes:$dropwizardKubernetesVersion"

Usage

In your application's Configuration class, add a KubernetesClientFactory object:

public class ExampleConfiguration extends Configuration {
    ...

    @Valid
    @NotNull
    @JsonProperty("kubernetes-client")
    private KubernetesClientFactory kubernetesClientFactory;

    public KubernetesClientFactory getKubernetesClientFactory() {
        return kubernetesClientFactory;
    }

    public void setKubernetesClientFactory(final KubernetesClientFactory kubernetesClientFactory) {
        this.kubernetesClientFactory = kubernetesClientFactory;
    }
}

Add a KubernetesClientBundle to the Boostrap object in your initialize method:

private final KubernetesClientBundle<ExampleConfiguration> kubernetesClient = new KubernetesClientBundle<ExampleConfiguration>() {
    @Override
    public KubernetesClientFactory getKubernetesClientFactory(ExampleConfiguration configuration) {
        return configuration.getKubernetesClientFactory();
    }
};

@Override
public void initialize(Bootstrap<ExampleConfiguration> bootstrap) {
    bootstrap.addBundle(kubernetesClient);
}

@Override
public void run(ExampleConfiguration config, Environment environment) {
    final KubernetesAPIThing kubernetesAPIThing = new KubernetesAPIThing(kubernetesClient.getKubernetesClient());
    environment.jersey().register(new KubernetesAPIThingResource(kubernetesAPIThing));
}

Configure your factory in your config.yml file:

kubernetes-client:
  name: my-k8s-usecase
  config:
    masterUrl: https://localhost:443
    apiVersion: v1
    namespace: default
    currentContext: my-context
    userAgent: generic-crud-app
  requestConfig:
    watchReconnectInterval: 3s
    watchReconnectLimit: 25
    connectionTimeout: 10s
    requestTimeout: 4s
    rollingTimeout: 5s
    scaleTimeout: 6s
    webSocketTimeout: 3s
    webSocketPingInterval: 10s
    loggingInterval: 20s
  httpClient:
    followRedirects: false
    followSslRedirects: false
    proxy:
      url: "https://127.0.0.1:6379"
      username: admin
      password: hunter2
    security:
      trustCerts: true
      caCert:
        type: string
        caCert: abc123def456
      trustStore: src/test/resources/truststore.p12
      trustStorePassword: changeit
    interceptors:
      - type: backwards-compatibility
      - type: oauth
        oAuthToken:
          type: string
          token: 123abc456def

Support

Please file bug reports and feature requests in GitHub issues.

dropwizard-kubernetes's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar joschi avatar pstackle avatar

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.