question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

imagePullPolicy configuration not working

See original GitHub issue

Info

I have a following configuration as mentioned by documentation.

<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>${fmp.version}</version>
<configuration>
    <images>
        <image>
            <name>username/repository:${project.build.finalName}</name>
            <build>
                <from>java:8</from>
                <maintainer>maintainer</maintainer>
                <assembly>
                    <name>assembly</name>
                    <targetDir>/user/local/projects</targetDir>
                    <descriptorRef>artifact</descriptorRef>
                </assembly>
                <entryPoint>
                    <exec>
                        <arg>java</arg>
                        <arg>-Xmx128m</arg>
                        <arg>-jar</arg>
                        <arg>/user/local/projects/${project.build.finalName}.jar</arg>
                    </exec>
                </entryPoint>
                <ports>
                    <port>${port}</port>
                </ports>
                <imagePullPolicy>Always</imagePullPolicy>
            </build>
        </image>
    </images>
</configuration>
</plugin>

Also my deployment.yml is minimal.

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ${project.artifactId}
  labels:
    app: ${project.artifactId}
spec:
  replicas: 1
  selector:
    matchLabels:
      app: ${project.artifactId}
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: ${project.artifactId}

Everything works fine, only imagePullPolicy is always ifNotPresent in generated deployment.yml file. I am trying to make it to Always as you can see in configuration file. I tried using enricher as well as mentioned in this https://stackoverflow.com/questions/45746984/how-to-configure-imagepullpolicy-from-fabric8-maven-plugin, but no success yet.

  • f-m-p version : 4.1.0
  • Maven version (mvn -v) : 3.3.9

UPDATE The above mentioned stackoverflow solution works only in case we don’t have explicitly written deployment.yml under fabric8 folder. In case we are enriching already existing deployment.yml file, we must use fmp-controller-from-configuration.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rohanKanojiacommented, May 10, 2019

@mani-rai : DefaultControllerEnricher was splitted into two enrichers, see #401 , now fragments are handled by a different enricher. So you should use this configuration:

        <configuration>
                <enricher>
                    <config>
                        <fmp-controller-from-configuration>
                            <pullPolicy>Always</pullPolicy>
                        </fmp-controller-from-configuration>
                    </config>
                </enricher>
        </configuration>

0reactions
mani-raicommented, May 11, 2019

Thanks @rohanKanojia. The given solution is working.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Kubernetes: --image-pull-policy always does not work
The image pull policy specifies how to acquire the image to run the container. Always means it will try to pull a new...
Read more >
imagePullPolicy Setup Seems to not working as expected
hello,. I setup pull_policy = "if-not-present" in my runner config for k8s and for docker but the runner is still getting images from...
Read more >
Images - Kubernetes
Image pull policy · IfNotPresent: the image is pulled only if it is not already present locally. · Always: every time the kubelet...
Read more >
Kubernetes Image Pull Policy: A Definitive Guide - ContainIQ
To use an image in a cluster, its name and registry are specified in the POD or Deployment configuration file. If a registry...
Read more >
Kubernetes How to: Ensure imagePullPolicy set to Always
In the Kubernetes config, you can just specify tag 1.2, ... Avoid problems with images by ensuring that imagePullPolicy is set to Always....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found