0

We've been trying very hard for a while to build and push an image using fabric8, however no matter what we do to name the image, it is always named the same thing.

Building and deploying the image works fine, and we have it running on an OKD cluster. However no matter what we do the name is always the default

best-practice/best-practice-java:1.0.0

Rather than what we think we're specifying

internal/best-practice/best-practice-java:1.0.0

We run the following command

mvn clean package fabric8:build fabric8:push

This is the pom

<?xml version="1.0" encoding="UTF-8"?>
<!--
    Copyright 2016 Red Hat, Inc.
    Red Hat licenses this file to you under the Apache License, version
    2.0 (the "License"); you may not use this file except in compliance
    with the License.  You may obtain a copy of the License at
        http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
    implied.  See the License for the specific language governing
    permissions and limitations under the License.
-->
<project>

    <modelVersion>4.0.0</modelVersion>

    <artifactId>best-practice-java</artifactId>
    <groupId>com.example.best-practice</groupId>
    <version>1.0.0</version>
    <packaging>jar</packaging>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.3.3.RELEASE</version>
    </parent>

    <properties>
        <fabric8.mode>kubernetes</fabric8.mode>
        <fabric8.build.strategy>docker</fabric8.build.strategy>
        <docker.push.registry>artifactory.example.com</docker.push.registry>
        <docker.registry>artifactory.example.com</docker.registry>
        <docker.url>https://artifactory.example.com</docker.url>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vlkan.log4j2</groupId>
            <artifactId>log4j2-logstash-layout</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>io.fabric8</groupId>
                <artifactId>fabric8-maven-plugin</artifactId>
                <version>4.2.0</version>
                <configuration>
                    <generateRoute>true</generateRoute>
                    <images>
                        <image>
                            <name>{docker.push.registry}/internal/%g/%a:%v</name>
                        </image>
                    </images>
                    <enricher>
                        <config>
                            <fmp-controller>
                                <pullPolicy>Always</pullPolicy>
                            </fmp-controller>
                            <!-- Health check on the Spring Boot Actuator -->
                            <f8-healthcheck-spring-boot>
                                <timeoutSeconds>5</timeoutSeconds>
                                <readinessProbeInitialDelaySeconds>20</readinessProbeInitialDelaySeconds>
                                <failureThreshold>3</failureThreshold>
                                <successThreshold>1</successThreshold>
                            </f8-healthcheck-spring-boot>
                        </config>
                    </enricher>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

Leonhard Printz
  • 355
  • 2
  • 16
  • It is really strange, because if I specify internal/%g/%a:%v instead it'll complain [ERROR] F8: Could not connect to kubernetes cluster! [ERROR] F8: Have you started a local cluster via `mvn fabric8:cluster-start` or connected to a remote cluster via `kubectl`? But I don't want to push it locally. I want fabric8 to build an image using docker as specified, and upload the image to the registry I've specified. – Leonhard Printz Aug 24 '20 at 14:10
  • Did you fix your issue somehow? I am having a similar issue and maybe you can share your solution as an answer to your own question. – Asrail Mar 15 '21 at 18:29

0 Answers0