0

一段时间以来,我们一直在努力使用fabric8构建和推送图像,但是无论我们如何命名图像,它总是被命名为相同的东西。

构建和部署镜像工作正常,我们让它在 OKD 集群上运行。但是,无论我们做什么,名称始终是默认值

最佳实践/最佳实践-java:1.0.0

而不是我们认为我们指定的

内部/最佳实践/最佳实践-java:1.0.0

我们运行以下命令

mvn clean package fabric8:build fabric8:push

这是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>

4

0 回答 0