use of io.fabric8.kubernetes.api.model.Event in project fabric8 by jboss-fuse.
the class FabricBlueprintBundleListener method blueprintEvent.
@Override
public void blueprintEvent(BlueprintEvent event) {
long bundleId = event.getBundle().getBundleId();
ModuleStatus moduleStatus = toModuleStatus(event.getType());
updateBundle(bundleId, moduleStatus);
}
use of io.fabric8.kubernetes.api.model.Event in project fabric8 by jboss-fuse.
the class AutoScaleController method groupEvent.
@Override
public void groupEvent(Group<AutoScalerNode> group, GroupEvent event) {
DataStore dataStore = fabricService.get().adapt(DataStore.class);
switch(event) {
case CONNECTED:
case CHANGED:
if (isValid()) {
AutoScalerNode state = createState();
try {
if (group.isMaster()) {
enableMasterZkCache(curator.get());
LOGGER.info("AutoScaleController is the master");
group.update(state);
dataStore.trackConfiguration(runnable);
enableTimer();
onConfigurationChanged();
} else {
LOGGER.info("AutoScaleController is not the master");
group.update(state);
disableTimer();
dataStore.untrackConfiguration(runnable);
disableMasterZkCache();
}
} catch (IllegalStateException e) {
// Ignore
}
} else {
LOGGER.info("Not valid with master: " + group.isMaster() + " fabric: " + fabricService.get() + " curator: " + curator.get());
}
break;
case DISCONNECTED:
dataStore.untrackConfiguration(runnable);
}
}
use of io.fabric8.kubernetes.api.model.Event in project jointware by isdream.
the class KubernetesKeyValueStyleGeneratorTest method testKubernetesWithAllKind.
protected static void testKubernetesWithAllKind() throws Exception {
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ServiceAccount());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ThirdPartyResource());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ResourceQuota());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Node());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ConfigMap());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new NetworkPolicy());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new CustomResourceDefinition());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Ingress());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Service());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Namespace());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Secret());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new LimitRange());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Event());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new PersistentVolume());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new StatefulSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new PersistentVolumeClaim());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new DaemonSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new HorizontalPodAutoscaler());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Pod());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ReplicaSet());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Job());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new ReplicationController());
info(KUBERNETES_KIND, KubernetesDocumentKeyValueStyleGenerator.class.getName(), new Deployment());
}
use of io.fabric8.kubernetes.api.model.Event in project kubernetes by ballerinax.
the class DockerHandler method pushImage.
/**
* Push docker image.
*
* @param dockerModel DockerModel
* @throws InterruptedException When error with docker build process
* @throws IOException When error with docker build process
*/
public void pushImage(DockerModel dockerModel) throws InterruptedException, IOException, KubernetesPluginException {
AuthConfig authConfig = new AuthConfigBuilder().withUsername(dockerModel.getUsername()).withPassword(dockerModel.getPassword()).build();
Config config = new ConfigBuilder().withDockerUrl(dockerModel.getDockerHost()).addToAuthConfigs(RegistryUtils.extractRegistry(dockerModel.getName()), authConfig).build();
DockerClient client = new DefaultDockerClient(config);
final DockerError dockerError = new DockerError();
OutputHandle handle = client.image().withName(dockerModel.getName()).push().usingListener(new EventListener() {
@Override
public void onSuccess(String message) {
pushDone.countDown();
}
@Override
public void onError(String message) {
pushDone.countDown();
dockerError.setErrorMsg("error pushing docker image: " + message);
}
@Override
public void onError(Throwable t) {
pushDone.countDown();
dockerError.setErrorMsg("error pushing docker image: " + t.getMessage());
}
@Override
public void onEvent(String event) {
printDebug(event);
}
}).toRegistry();
pushDone.await();
handle.close();
client.close();
handleError(dockerError);
}
use of io.fabric8.kubernetes.api.model.Event in project fabric8 by jboss-fuse.
the class Logs method newInstance.
public static LogEvent newInstance(PaxLoggingEvent event) {
LogEvent answer = new LogEvent();
try {
answer.setLevel(toString(event.getLevel()));
} catch (NoClassDefFoundError error) {
// ENTESB-2234, KARAF-3350: Ignore NoClassDefFoundError exceptions
// Those exceptions may happen if the underlying pax-logging service
// bundle has been refreshed somehow.
answer.setLevel("LOG");
}
answer.setMessage(event.getMessage());
answer.setLogger(event.getLoggerName());
answer.setTimestamp(new Date(event.getTimeStamp()));
answer.setThread(event.getThreadName());
answer.setException(addMavenCoord(event.getThrowableStrRep()));
Map eventProperties = event.getProperties();
if (eventProperties != null && eventProperties.size() > 0) {
Map<String, String> properties = new HashMap<String, String>();
Set<Map.Entry> set = eventProperties.entrySet();
for (Map.Entry entry : set) {
Object key = entry.getKey();
Object value = entry.getValue();
if (key != null && value != null) {
properties.put(toString(key), toString(value));
}
}
MavenCoordinates.addMavenCoord(properties);
answer.setProperties(properties);
}
// event.getFQNOfLoggerClass()
try {
PaxLocationInfo locationInformation = event.getLocationInformation();
if (locationInformation != null) {
answer.setClassName(locationInformation.getClassName());
answer.setFileName(locationInformation.getFileName());
answer.setMethodName(locationInformation.getMethodName());
answer.setLineNumber(locationInformation.getLineNumber());
}
} catch (NoClassDefFoundError error) {
// ENTESB-2234, KARAF-3350: Ignore NoClassDefFoundError exceptions
}
return answer;
}
Aggregations