eclipse-jkube / jkube

Build and Deploy java applications on Kubernetes
https://www.eclipse.dev/jkube/
Eclipse Public License 2.0
775 stars 521 forks source link

XML configuration ConfigMap resource file not filtered #1291

Open tipame opened 2 years ago

tipame commented 2 years ago

Description

I create ConfigMap configuration like that:

<configuration>
  <filter>@</filter>
  <resources>
    <configMap>
      <name>configmap-test</name>
      <entries>
        <entry>
          <file>src/test/resources/test-application.yaml</file>
        </entry>
       </entries>
    </configMap>
  </resources>
</configuration>

In resource file test-application.yaml:

some.property: @property.placeholder@

This property is not resolved during resource goal execution (as expected). Work only If same file content placed in /jkube/test-configmap.yaml:

data:
  test-application.yaml: |
    some.property: @property.placeholder@  

Info

manusa commented 2 years ago

I don't think filtering is supported when using the jkube-configmap-file.

In your case, you are including a source file which in the end (if in Maven) should be processed by the Maven Resources Plugin. I understand that you are using this approach because this file is also used for other purposes. Why aren't you including the file that should be placed in target/test-classes/ directory instead?

tipame commented 2 years ago

Ok. I can make filtration with resource plugin, but it's also can be done for all files in jkube directory. Doing so - we bring unnessesery copy of files as jkube already has filtration future (and copies files from jkube source dir to target). In my opinion it should be fixed.

manusa commented 2 years ago

The thing is that you are using a file that is not "handled by JKube". We can evaluate this, because it might make sense from a UX perspective (although I'm still not sure about this). From a technical perspective it doesn't because that resource is not handled by JKube and it's not a Fragment.

For me the question is, where else are you using that test resource? and why doesn't it need filtering for that other use case (or what's performing the filtering in that case)?

tipame commented 2 years ago

My motivation - is to use IDE formating futures wich are not working when file is part of configmap.yaml. I have a number of platform dependend variables wich should be replaced during build.

tipame commented 2 years ago

What do you mean "esource is not handled by JKube and it's not a Fragment"? I use file tag to refer to the content of a file. JKube creates configmap.yaml and puts file content inside it, but not fillter that file:

    <configMap>
      <name>configmap-test</name>
      <entries>
        <entry>
          <file>src/test/resources/test-application.properties</file>
        </entry>
       </entries>
    </configMap>