use of io.fabric8.openshift.api.model.DoneableImageStream in project fabric8 by fabric8io.
the class Controller method applyImageStream.
public void applyImageStream(ImageStream entity, String sourceName) {
OpenShiftClient openShiftClient = getOpenShiftClientOrNull();
if (openShiftClient != null && openShiftClient.supportsOpenShiftAPIGroup(OpenShiftAPIGroups.IMAGE)) {
String kind = getKind(entity);
String name = getName(entity);
String namespace = getNamespace();
try {
Resource<ImageStream, DoneableImageStream> resource = openShiftClient.imageStreams().inNamespace(namespace).withName(name);
ImageStream old = resource.get();
if (old == null) {
LOG.info("Creating " + kind + " " + name + " from " + sourceName);
resource.create(entity);
} else {
LOG.info("Updating " + kind + " " + name + " from " + sourceName);
copyAllImageStreamTags(entity, old);
resource.replace(old);
}
openShiftClient.resource(entity).inNamespace(namespace).apply();
} catch (Exception e) {
onApplyError("Failed to create " + kind + " from " + sourceName + ". " + e, e);
}
}
}
Aggregations