[ https://issues.apache.org/jira/browse/FLINK-26570?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17505350#comment-17505350 ]
Fil Karnicki edited comment on FLINK-26570 at 3/21/22, 9:14 PM: ---------------------------------------------------------------- hi [~trohrmann] could you please assign this issue to me? My plan is to: # add a test yaml in statefun-flink/statefun-flink-core/src/test/resources/remote-module {code:java} kind: com.foo.bar/test.component.1 spec: static: staticValue placeholder: ${key1} valueDoesNotExist: ${iDoNotExist} --- kind: com.foo.bar/test.component.2 spec: front: ${key1}bar back: foo${key2} two: ${key1}${key2} mixed: a${key1}b${key2}c array: - a: ${key2} - a: fizz --- kind: com.foo.bar/test.component.3 spec: frontAndBack: fizz${key1}buzz ---{code} 2. Add a test in org.apache.flink.statefun.flink.core.jsonmodule.{*}RemoteModuleTest{*} to check if the specs are resolved correctly 3. Use pattern {code:java} Pattern.compile("\\$\\{(.*?)\\}"){code} in org.apache.flink.statefun.flink.core.jsonmodule.{*}RemoteModule{*} to traverse the spec tree and replace it with values from globalConfiguration (still need to think if those can already include system and env props, or if those sources would need to be added to the resolution only (and not to globalConfiguration at the start)) 4. Add placeholders to the java e2e test 5. Update the documentation something along the lines of [https://github.com/FilKarnicki/flink-statefun/pull/4/files|https://github.com/FilKarnicki/flink-statefun/pull/3/files] was (Author: JIRAUSER284249): hi [~trohrmann] could you please assign this issue to me? My plan is to: # add a test yaml in statefun-flink/statefun-flink-core/src/test/resources/remote-module {code:java} kind: com.foo.bar/test.component.1 spec: static: staticValue placeholder: ${key1} valueDoesNotExist: ${iDoNotExist} --- kind: com.foo.bar/test.component.2 spec: front: ${key1}bar back: foo${key2} two: ${key1}${key2} mixed: a${key1}b${key2}c array: - a: ${key2} - a: fizz --- kind: com.foo.bar/test.component.3 spec: frontAndBack: fizz${key1}buzz ---{code} 2. Add a test in org.apache.flink.statefun.flink.core.jsonmodule.{*}RemoteModuleTest{*} to check if the specs are resolved correctly 3. Use pattern {code:java} Pattern.compile("\\$\\{(.*?)\\}"){code} in org.apache.flink.statefun.flink.core.jsonmodule.{*}RemoteModule{*} to traverse the spec tree and replace it with values from globalConfiguration (still need to think if those can already include system and env props, or if those sources would need to be added to the resolution only (and not to globalConfiguration at the start)) 4. Add placeholders to the java e2e test 5. Update the documentation something along the lines of [https://github.com/FilKarnicki/flink-statefun/pull/3/files] > Remote module configuration interpolation > ----------------------------------------- > > Key: FLINK-26570 > URL: https://issues.apache.org/jira/browse/FLINK-26570 > Project: Flink > Issue Type: Improvement > Components: Stateful Functions > Reporter: Fil Karnicki > Assignee: Fil Karnicki > Priority: Major > Labels: pull-request-available > > Add the ability for users to provide placeholders in module.yaml, e.g. > {code:java} > kind: com.foo.bar/test > spec: > something: ${REPLACE_ME} > transport: > password: ${REPLACE_ME_WITH_A_SECRET} > array: > - ${REPLACE_ME} > - sthElse {code} > These placeholders would be resolved in > org.apache.flink.statefun.flink.core.jsonmodule.RemoteModule#bindComponent > using > {code:java} > ParameterTool.fromSystemProperties().mergeWith(ParameterTool.fromMap(globalConfiguration) > {code} > by traversing the ComponentJsonObject.specJsonNode() and replacing values > that contain placeholders with values from the combined system+globalConfig > map -- This message was sent by Atlassian Jira (v8.20.1#820001)