Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 111. Openshift


Openshift Component

Available as of Camel 2.14
The openshift component is a component for managing your OpenShift applications.
Maven users will need to add the following dependency to their pom.xml for this component:
<dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-openshift</artifactId>
    <version>x.x.x</version>
    <!-- use the same version as your Camel core version -->
</dependency>
Copy to Clipboard Toggle word wrap

URI format

openshift:clientId[?options]
Copy to Clipboard Toggle word wrap
You can append query options to the URI in the following format, ?option=value&option=value&...

Options

Expand
Name
Default Value
Description
domain
null
Domain name. If not specified then the default domain is used.
username
Mandatory: The username to login to openshift server.
password
Mandatory: The password for login to openshift server.
server
Url to the openshift server. If not specified then the default value from the local openshift configuration file ~/.openshift/express.conf is used. And if that fails as well then "openshift.redhat.com" is used.
delay
10s
Consumer only: How frequent to poll for state changes for the applications. By default we poll every 10 seconds.
operation
list
Producer only: The operation to perform which can be: list, start, stop, restart, and state. The list operation returns information about all the applications in json format. The state operation returns the state such as: started, stopped etc. The other operations does not return any value.
application
Producer only: The application name to start, stop, restart, or get the state.
mode
Producer only: Whether to output the message body as a pojo or json. For pojo the message is a List<com.openshift.client.IApplication> type.

Examples

Listing all applications

// sending route
from("direct:apps")
    .to("openshift:myClient?username=foo&password=secret&operation=list");
    .to("log:apps");
Copy to Clipboard Toggle word wrap
In this case the information about all the applications is returned as pojo. If you want a json response, then set mode=json.

Stopping an application

// stopping the foobar application
from("direct:control")
    .to("openshift:myClient?username=foo&password=secret&operation=stop&application=foobar");
Copy to Clipboard Toggle word wrap
In the example above we stop the application named foobar.
Polling for gear state changes
The consumer is used for polling state changes in gears. Such as when a new gear is added/removed/ or its lifecycle is changed, eg started, or stopped etc.
// trigger when state changes on our gears
from("openshift:myClient?username=foo&password=secret&delay=30s")
    .log("Event ${header.CamelOpenShiftEventType} on application ${body.name} changed state to ${header.CamelOpenShiftEventNewState}");
Copy to Clipboard Toggle word wrap
When the consumer emits an Exchange then the body contains the com.openshift.client.IApplication as the message body. And the following headers is included.
Expand
Header
May be null
Description
CamelOpenShiftEventType
No
The type of the event which can be one of: added, removed or changed.
CamelOpenShiftEventOldState
Yes
The old state, when the event type is changed.
CamelOpenShiftEventNewState
No
The new state, for any of the event types
Retour au début
Red Hat logoGithubredditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance. Découvrez nos récentes mises à jour.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez le Blog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

Theme

© 2025 Red Hat