首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何从编译8 maven插件中配置imagePullPolicy

如何从编译8 maven插件中配置imagePullPolicy
EN

Stack Overflow用户
提问于 2017-08-18 01:00:17
回答 1查看 1.3K关注 0票数 1

上下文:

我使用fabric8-maven-plugin生成对接映像,并将其部署到Kubernetes集群中。

问题:

可以配置默认值为imagePullPolicy IfNotPresent的参数

pom.xml中的当前配置

代码语言:javascript
复制
<build>
    <plugins>
        <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
            <version>3.5.25</version>
            <configuration>
                <images>
                    <image>
                        <name>my-service</name>
                        <alias>service</alias>
                        <build>
                            <from>java:8</from>
                            <tags>
                                <tag>latest</tag>
                                <tag>${project.version}</tag>
                            </tags>
                            <!--
                            The entry point path used is "maven/" since this is the default folder: https://dmp.fabric8.io/#building-images,
                            "launch.sh" is copied to the container based in the assembly.xml descriptor file.
                            -->
                            <entryPoint>
                                <exec>
                                    <arg>maven/launch.sh</arg>
                                </exec>
                            </entryPoint>
                            <assembly>
                                <descriptor>assembly.xml</descriptor>
                            </assembly>
                        </build>
                    </image>
                </images>
                <generator>
                    <includes>
                        <include>java-exec</include>
                    </includes>
                    <config>
                        <java-exec>
                            <webPort>8080</webPort>
                        </java-exec>
                    </config>
                </generator>
            </configuration>
        </plugin>
    </plugins>
</build>

我得到的是:

代码语言:javascript
复制
spec:
  containers:
  - env:
    - name: KUBERNETES_NAMESPACE
      valueFrom:
        fieldRef:
          fieldPath: metadata.namespace
    image: 394148814603.dkr.ecr.us-east-1.amazonaws.com/dkrecr-nafiux-ncp/kcluster-ncp-myservice
    imagePullPolicy: IfNotPresent <---- I want to personalize this value to Always, for instance.
    name: service
    securityContext:
      privileged: false

为什么要将值更改为 Why ?主要是因为我对集群做了很多测试,而且我不想为我所做的每一个测试分配一个新版本。

感谢你的支持。

EN

回答 1

Stack Overflow用户

发布于 2017-08-18 07:28:10

将以下内容与生成器、图像一起添加到pom.xml中。

代码语言:javascript
复制
            <configuration> 
                <enricher>
                    <config>
                        <fmp-controller>
                            <pullPolicy>Always</pullPolicy>
                        </fmp-controller>
                    </config>
                </enricher>
            </configuration>

虽然这不是理想的方式,但会暂时奏效。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45746984

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档