{"action":"created","issue":{"url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/106","repository_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes","labels_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/106/labels{/name}","comments_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/106/comments","events_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/106/events","html_url":"https://github.com/spring-cloud-incubator/spring-cloud-kubernetes/issues/106","id":237870896,"number":106,"title":"K8S ConfigMap doesn't work very well with profile","user":{"login":"cmoulliard","id":463790,"avatar_url":"https://avatars2.githubusercontent.com/u/463790?v=4","gravatar_id":"","url":"https://api.github.com/users/cmoulliard","html_url":"https://github.com/cmoulliard","followers_url":"https://api.github.com/users/cmoulliard/followers","following_url":"https://api.github.com/users/cmoulliard/following{/other_user}","gists_url":"https://api.github.com/users/cmoulliard/gists{/gist_id}","starred_url":"https://api.github.com/users/cmoulliard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmoulliard/subscriptions","organizations_url":"https://api.github.com/users/cmoulliard/orgs","repos_url":"https://api.github.com/users/cmoulliard/repos","events_url":"https://api.github.com/users/cmoulliard/events{/privacy}","received_events_url":"https://api.github.com/users/cmoulliard/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/milestones/1","html_url":"https://github.com/spring-cloud-incubator/spring-cloud-kubernetes/milestone/1","labels_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/milestones/1/labels","id":2665978,"number":1,"title":"0.2.0","description":"","creator":{"login":"spencergibb","id":594085,"avatar_url":"https://avatars3.githubusercontent.com/u/594085?v=4","gravatar_id":"","url":"https://api.github.com/users/spencergibb","html_url":"https://github.com/spencergibb","followers_url":"https://api.github.com/users/spencergibb/followers","following_url":"https://api.github.com/users/spencergibb/following{/other_user}","gists_url":"https://api.github.com/users/spencergibb/gists{/gist_id}","starred_url":"https://api.github.com/users/spencergibb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/spencergibb/subscriptions","organizations_url":"https://api.github.com/users/spencergibb/orgs","repos_url":"https://api.github.com/users/spencergibb/repos","events_url":"https://api.github.com/users/spencergibb/events{/privacy}","received_events_url":"https://api.github.com/users/spencergibb/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":47,"state":"closed","created_at":"2017-07-27T18:56:02Z","updated_at":"2017-07-27T19:43:47Z","due_on":null,"closed_at":"2017-07-27T19:43:47Z"},"comments":1,"created_at":"2017-06-22T14:46:37Z","updated_at":"2018-05-21T11:44:44Z","closed_at":"2017-06-23T07:14:50Z","author_association":"CONTRIBUTOR","body":"When the following configMap is defined \r\n\r\n```\r\nmetadata:\r\n  name: store\r\ndata:\r\n  application.yml: |-\r\n    greeting:\r\n      message: Say Hello to the World\r\n    ---\r\n    spring:\r\n      profiles: development\r\n    greeting:\r\n      message: Say Hello to the Developers\r\n    ---\r\n    spring:\r\n      profiles: production\r\n    greeting:\r\n      message: Say Hello to the Ops\r\n```\r\n\r\nand the profile `development` specified\r\n\r\n```\r\nexec java -Dspring.profiles.active=development -javaagent:/opt/jolokia/jolokia.jar=config=/opt/jolokia/etc/jolokia.properties -cp . -jar /deployments/store-1.0-SNAPSHOT.jar\r\nI> No access restrictor found, access to any MBean is allowed\r\nJolokia: Agent started with URL https://172.17.0.13:8778/jolokia/\r\n14:40:35.904 [background-preinit] INFO  o.h.validator.internal.util.Version - HV000001: Hibernate Validator 5.3.5.Final\r\n14:40:36.195 [main] INFO  o.s.c.a.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7e0babb1: startup date [Thu Jun 22 14:40:36 UTC 2017]; root of context hierarchy\r\n14:40:36.524 [main] INFO  o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'configurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$f55351cc] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)\r\n  .   ____          _            __ _ _\r\n /\\\\ / ___'_ __ _ _(_)_ __  __ _ \\ \\ \\ \\\r\n( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\\r\n \\\\/  ___)| |_)| | | | | || (_| |  ) ) ) )\r\n  '  |____| .__|_| |_|_| |_\\__, | / / / /\r\n =========|_|==============|___/=/_/_/_/\r\n :: Spring Boot ::        (v1.5.3.RELEASE)\r\n14:40:37.000 [main] INFO  o.s.c.b.c.PropertySourceBootstrapConfiguration - Located property source: ConfigMapPropertySource [name='configmap.store.jbcnf']\r\n14:40:37.004 [main] INFO  o.s.c.b.c.PropertySourceBootstrapConfiguration - Located property source: SecretsPropertySource [name='secrets.store.jbcnf']\r\n14:40:37.068 [main] INFO  my.cool.store.HelloWorld - The following profiles are active: development,kubernetes\r\n```\r\n\r\nthe rest endpoint defined within the controller\r\n\r\n```\r\n@EnableConfigurationProperties\r\n@ConfigurationProperties(\"greeting\")\r\n@RestController\r\npublic class SayController {\r\n\r\n\tpublic String getMessage() {\r\n\t\treturn Message;\r\n\t}\r\n\r\n\tpublic void setMessage(String message) {\r\n\t\tMessage = message;\r\n\t}\r\n\r\n\tpublic String Message;\r\n\r\n\t@RequestMapping(\"/say\")\r\n\tpublic String sayHello() {\r\n\t\treturn \"Message : \" + Message;\r\n\t}\r\n}\r\n\r\n```\r\n\r\nreturns the wrong message\r\n\r\n```\r\nhttp http://store-jbcnf.192.168.64.25.nip.io/say\r\nHTTP/1.1 200\r\nCache-control: private\r\nContent-Length: 30\r\nContent-Type: text/plain;charset=UTF-8\r\nDate: Thu, 22 Jun 2017 14:45:54 GMT\r\nSet-Cookie: 81040242305c5dd1b337c37d137087e7=91b529ca60b772928dda9f65023ba587; path=/; HttpOnly\r\n\r\nMessage : Say Hello to the Ops\r\n```\r\n\r\nIt seems that only the latest key is loaded ...\r\n\r\nKeys/values are well parsed \r\n\r\n```\r\n18:33:35.519 [main] DEBUG o.s.b.f.c.YamlPropertiesFactoryBean - Loading from YAML: Byte array resource [resource loaded from byte array]\r\n18:33:35.520 [main] DEBUG o.s.b.f.c.YamlPropertiesFactoryBean - Merging document (no matchers set): {greeting={message=Say Hello to the World}}\r\n18:33:35.521 [main] DEBUG o.s.b.f.c.YamlPropertiesFactoryBean - Merging document (no matchers set): {spring={profiles=development}, greeting={message=Say Hello to the Developers}}\r\n18:33:35.522 [main] DEBUG o.s.b.f.c.YamlPropertiesFactoryBean - Merging document (no matchers set): {spring={profiles=production}, greeting={message=Say Hello to the Ops}}\r\n18:33:35.522 [main] DEBUG o.s.b.f.c.YamlPropertiesFactoryBean - Loaded 3 documents from YAML resource: Byte array resource [resource loaded from byte array]\r\n18:33:35.533 [main] INFO  o.s.c.b.c.PropertySourceBootstrapConfiguration - Located property source: ConfigMapPropertySource [name='configmap.store.jbcnf']\r\n```\r\n\r\nThe existing code should take care of the profile as the class `org.springframework.boot.env.YamlPropertySourceLoader` of spring Boot does\r\n\r\n```\r\n/**\r\n\t * {@link YamlProcessor} to create a {@link Map} containing the property values.\r\n\t * Similar to {@link YamlPropertiesFactoryBean} but retains the order of entries.\r\n\t */\r\n\tprivate static class Processor extends YamlProcessor {\r\n\r\n\t\tProcessor(Resource resource, String profile) {\r\n\t\t\tif (profile == null) {\r\n\t\t\t\tsetMatchDefault(true);\r\n\t\t\t\tsetDocumentMatchers(new SpringProfileDocumentMatcher());\r\n\t\t\t}\r\n\t\t\telse {\r\n\t\t\t\tsetMatchDefault(false);\r\n\t\t\t\tsetDocumentMatchers(new SpringProfileDocumentMatcher(profile));\r\n\t\t\t}\r\n```"},"comment":{"url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/comments/390631396","html_url":"https://github.com/spring-cloud-incubator/spring-cloud-kubernetes/issues/106#issuecomment-390631396","issue_url":"https://api.github.com/repos/spring-cloud-incubator/spring-cloud-kubernetes/issues/106","id":390631396,"user":{"login":"geoand","id":4374975,"avatar_url":"https://avatars2.githubusercontent.com/u/4374975?v=4","gravatar_id":"","url":"https://api.github.com/users/geoand","html_url":"https://github.com/geoand","followers_url":"https://api.github.com/users/geoand/followers","following_url":"https://api.github.com/users/geoand/following{/other_user}","gists_url":"https://api.github.com/users/geoand/gists{/gist_id}","starred_url":"https://api.github.com/users/geoand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geoand/subscriptions","organizations_url":"https://api.github.com/users/geoand/orgs","repos_url":"https://api.github.com/users/geoand/repos","events_url":"https://api.github.com/users/geoand/events{/privacy}","received_events_url":"https://api.github.com/users/geoand/received_events","type":"User","site_admin":false},"created_at":"2018-05-21T11:44:44Z","updated_at":"2018-05-21T11:44:44Z","author_association":"NONE","body":"This seems to be an issue again (most likely due to the refactoring work done for Spring Boot 2.x)"}}
{"actor":{"display_login":"geoand"}}