use of io.fabric8.openshift.api.model.ImageStreamSpec in project fabric8 by fabric8io.
the class Controller method copyAllImageStreamTags.
protected void copyAllImageStreamTags(ImageStream from, ImageStream to) {
ImageStreamSpec toSpec = to.getSpec();
if (toSpec == null) {
toSpec = new ImageStreamSpec();
to.setSpec(toSpec);
}
List<TagReference> toTags = toSpec.getTags();
if (toTags == null) {
toTags = new ArrayList<>();
toSpec.setTags(toTags);
}
ImageStreamSpec fromSpec = from.getSpec();
if (fromSpec != null) {
List<TagReference> fromTags = fromSpec.getTags();
if (fromTags != null) {
// lets remove all the tags with these names first
for (TagReference tag : fromTags) {
removeTagByName(toTags, tag.getName());
}
// now lets add them all in case 2 tags have the same name
for (TagReference tag : fromTags) {
toTags.add(tag);
}
}
}
}
Aggregations