Search in sources :

Example 1 with ImageStreamSpec

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);
            }
        }
    }
}
Also used : ImageStreamSpec(io.fabric8.openshift.api.model.ImageStreamSpec) TagReference(io.fabric8.openshift.api.model.TagReference)

Aggregations

ImageStreamSpec (io.fabric8.openshift.api.model.ImageStreamSpec)1 TagReference (io.fabric8.openshift.api.model.TagReference)1