io.vertx.servicediscovery.kubernetes

## Class KubernetesServiceImporter

- java.lang.Object
- - io.vertx.servicediscovery.kubernetes.KubernetesServiceImporter

- All Implemented Interfaces:
    io.fabric8.kubernetes.client.Watcher<io.fabric8.kubernetes.api.model.Service>, ServiceImporter

      public class KubernetesServiceImporter
      extends Object
      implements io.fabric8.kubernetes.client.Watcher<io.fabric8.kubernetes.api.model.Service>, ServiceImporter

  A discovery bridge listening for kubernetes services and publishing them in the Vert.x service discovery. This bridge only supports the importation of services from kubernetes in vert.x (and not the opposite).

  The bridge is configured using:

  * the oauth token (using the content of `/var/run/secrets/kubernetes.io/serviceaccount/token` by default) * the namespace in which the service are searched (defaults to `default`).

  Be aware that the application must have access to Kubernetes and must be able to read the chosen namespace.

  `Record` are created from Kubernetes Service. The service type is deduced from the `service.type` label. If not set, the service is imported as `unknown`. Only `http-endpoint` are supported for now.

  Author:
    Clement Escoffier

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface io.fabric8.kubernetes.client.Watcher

      `io.fabric8.kubernetes.client.Watcher.Action`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `KubernetesServiceImporter()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `eventReceived(io.fabric8.kubernetes.client.Watcher.Action action, io.fabric8.kubernetes.api.model.Service service)`
    `void` | `onClose(io.fabric8.kubernetes.client.KubernetesClientException e)`
    `void` | `start(Vertx vertx, ServicePublisher publisher, JsonObject configuration, Future<Void> completion)` Starts the bridge.
    `void` | `stop(Vertx vertx, ServicePublisher publisher, Future<Void> future)` Stops the bridge.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### KubernetesServiceImporter

          public KubernetesServiceImporter()

  - ### Method Detail

    - #### start

          public void start(Vertx vertx,
                            ServicePublisher publisher,
                            JsonObject configuration,
                            Future<Void> completion)

      Description copied from interface: `ServiceImporter`
      Starts the bridge.
      Specified by:
        `start` in interface `ServiceImporter`
      Parameters:
        `vertx` - the vertx instance
        `publisher` - the service discovery instance
        `configuration` - the bridge configuration if any
        `completion` - a future on which the bridge must report the completion of the starting

    - #### stop

          public void stop(Vertx vertx,
                           ServicePublisher publisher,
                           Future<Void> future)

      Description copied from interface: `ServiceImporter`
      Stops the bridge.
      Specified by:
        `stop` in interface `ServiceImporter`
      Parameters:
        `vertx` - the vertx instance
        `publisher` - the service discovery instance
        `future` - the future on which the bridge must report the completion of the stopping process

    - #### eventReceived

          public void eventReceived(io.fabric8.kubernetes.client.Watcher.Action action,
                                    io.fabric8.kubernetes.api.model.Service service)

      Specified by:
        `eventReceived` in interface `io.fabric8.kubernetes.client.Watcher<io.fabric8.kubernetes.api.model.Service>`

    - #### onClose

          public void onClose(io.fabric8.kubernetes.client.KubernetesClientException e)

      Specified by:
        `onClose` in interface `io.fabric8.kubernetes.client.Watcher<io.fabric8.kubernetes.api.model.Service>`

Copyright © 2016. All rights reserved.