eclipse-jkube / jkube

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

ConfigMapIT is failing on windows #3479

Open rohanKanojia opened 1 month ago

rohanKanojia commented 1 month ago

Component

None

Task description

Description

Related to #3406

⚠️ A windows machine is required to reproduce and fix problems in this issue

ConfigMapIT is failing on windows with this error message:

Error:  Errors: 
Error:    ConfigMapIT.k8sResource_whenRun_generatesK8sManifestsContainingConfigMap:37 � IllegalArgument Values not equal for entry: 'application.properties', expected 'environment = test
foo = bar' but was 'environment = test
foo = bar'
Error:    ConfigMapIT.ocResource_whenRun_generatesOpenShiftManifestsContainingConfigMap:56 � IllegalArgument Values not equal for entry: 'application.properties', expected 'environment = test
foo = bar' but was 'environment = test
foo = bar'

This issue looks related to one issue I had fixed https://github.com/eclipse-jkube/jkube/pull/3014

This issue looks similar to #3477 and #3478 but the code responsible for adding ConfigMap entries from file resides in fabric8 Kubernetes Client. Not sure whether to add handling for windows line breaks there or to add it in ConfigMapEnricher.

I think we need to debug here : https://github.com/eclipse-jkube/jkube/blob/78e8631c9c101e52dc94f14fb97c16383396afc5/jkube-kit/enricher/generic/src/main/java/org/eclipse/jkube/enricher/generic/ConfigMapEnricher.java#L80-L83 When I checked it I saw that configmap entries contain windows specific line breaks Screenshot 2024-10-20 202300

Expected Behavior

ConfigMapIT passes on windows and Linux

Acceptance Criteria

rexrk commented 1 month ago

@rohanKanojia since the configMapBuilder is from fabric8 client, i cant find any way to change the content of map from here directly as no direct setters implementation. There are some addToMap() method on configMapBuilder, can something be done by that? image image

rexrk commented 1 month ago

I guess following code worked : image and now the generated yml looks like : image

but now facing the same issue with another property :

java.lang.IllegalArgumentException: Values not equal for entry: 'test-configmap.properties', expected 'server.port = 8080
spring.application.name = configmap
' but was 'server.port = 8080
spring.application.name = configmap'

plese review it and tell me if I am going in right direction..