You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@camel.apache.org by GitBox <gi...@apache.org> on 2019/08/06 17:57:55 UTC

[GitHub] [camel-k] bfitzpat opened a new issue #900: Issues with pre-published Kubernetes secret and Camel-K integration

bfitzpat opened a new issue #900: Issues with pre-published Kubernetes secret and Camel-K integration
URL: https://github.com/apache/camel-k/issues/900
 
 
   So I have been able to publish a config-map using kubectl with `kubectl create configmap <config-id> --from-file=<config.file>` and then run an integration with `kamel run --configmap=<config-id> <myintegration.file>` and have that work fine. 
   
   But when I attempt the same approach with secrets, I'm hitting weird issues.
   
   First, I'm assuming the secret itself is a base64-encoded list of name/value pairs. 
   
   Second, I was able to create a secret config-map yaml file by hand and it worked just fine. 
   
   If I create the secret yaml file by hand so it looks like what you have in https://camel.apache.org/staging/camel-k/latest/configuration/configmap-secret.html, it works. Run `kubectl apply -f my-secret.yaml` and then use `kamel run --secret=<secret-id-from-my-secret-yaml> <myintegration.file>`. That works great. 
   
   Unfortunately I run into issues if I go a slightly different route...
   
   If I create my secret with `kubectl create secret generic <secret-id> --from-file=<base64-encoded-secret.file>`, I see the secret in my Kubernetes system. And then I use `kamel run --secret=<secret-id> <myintegration.file>`, I'm getting very weird results.
   
   Two new config maps are created -- <secret-id>-properties and <secret-id>-source-000 -- 
   and I'm seeing errors in the camel log:
   
   ```Exception in thread "main" org.apache.camel.RuntimeCamelException: java.lang.IllegalArgumentException: PropertiesComponent with name properties must be defined in CamelContext to support property placeholders. Property with key [telegram.APIKey] not found in properties from text: telegram:bots/{{telegram.APIKey}}?chatId={{telegram.chatID}}
   	at org.apache.camel.RuntimeCamelException.wrapRuntimeCamelException(RuntimeCamelException.java:52)
   	at org.apache.camel.model.RouteDefinitionHelper.initRouteInput(RouteDefinitionHelper.java:445)
   	at org.apache.camel.model.RouteDefinitionHelper.prepareRouteImp(RouteDefinitionHelper.java:361)
   	at org.apache.camel.model.RouteDefinitionHelper.prepareRoute(RouteDefinitionHelper.java:333)
   	at org.apache.camel.model.RoutesDefinition.route(RoutesDefinition.java:193)
   	at org.apache.camel.model.RoutesDefinition.from(RoutesDefinition.java:164)
   	at org.apache.camel.builder.RouteBuilder.from(RouteBuilder.java:212)
   	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
   	at org.apache.camel.k.loader.groovy.dsl.IntegrationConfiguration.from(IntegrationConfiguration.groovy:72)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
   	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
   	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1217)
   	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
   	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:821)
   	at org.apache.camel.k.loader.groovy.dsl.IntegrationConfiguration.invokeMethod(IntegrationConfiguration.groovy)
   	at groovy.util.DelegatingScript.invokeMethod(DelegatingScript.java:110)
   	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:70)
   	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
   	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:156)
   	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:168)
   	at Script1.run(Script1.groovy:7)
   	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
   	at org.apache.camel.k.loader.groovy.GroovyRoutesLoader$1$_configure_closure1.doCall(GroovyRoutesLoader.groovy:58)
   	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
   	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   	at java.lang.reflect.Method.invoke(Method.java:498)
   	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:101)
   	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:323)
   	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:263)
   	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1041)
   	at groovy.lang.Closure.call(Closure.java:405)
   	at groovy.lang.Closure.call(Closure.java:421)
   	at org.codehaus.groovy.runtime.IOGroovyMethods.withCloseable(IOGroovyMethods.java:1608)
   	at org.codehaus.groovy.runtime.dgm$913.doMethodInvoke(Unknown Source)
   	at org.codehaus.groovy.vmplugin.v7.IndyInterface.selectMethod(IndyInterface.java:234)
   	at org.apache.camel.k.loader.groovy.GroovyRoutesLoader$1.configure(GroovyRoutesLoader.groovy:52)
   	at org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:442)
   	at org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:409)
   	at org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:390)
   	at org.apache.camel.impl.engine.AbstractCamelContext.lambda$addRoutes$0(AbstractCamelContext.java:1077)
   	at org.apache.camel.impl.engine.AbstractCamelContext.doWithDefinedClassLoader(AbstractCamelContext.java:2404)
   	at org.apache.camel.impl.engine.AbstractCamelContext.addRoutes(AbstractCamelContext.java:1077)
   	at org.apache.camel.main.MainSupport.postProcessCamelContext(MainSupport.java:779)
   	at org.apache.camel.main.MainSupport.initCamelContext(MainSupport.java:646)
   	at org.apache.camel.main.Main.doInit(Main.java:108)
   	at org.apache.camel.support.service.ServiceSupport.init(ServiceSupport.java:61)
   	at org.apache.camel.support.service.ServiceSupport.start(ServiceSupport.java:88)
   	at org.apache.camel.main.MainSupport.run(MainSupport.java:196)
   	at org.apache.camel.k.main.ApplicationRuntime.run(ApplicationRuntime.java:70)
   	at org.apache.camel.k.main.Application.main(Application.java:44)
   Caused by: java.lang.IllegalArgumentException: PropertiesComponent with name properties must be defined in CamelContext to support property placeholders. Property with key [telegram.APIKey] not found in properties from text: telegram:bots/{{telegram.APIKey}}?chatId={{telegram.chatID}}
   	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.getPropertyValue(DefaultPropertiesParser.java:247)
   	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.readProperty(DefaultPropertiesParser.java:144)
   	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.doParse(DefaultPropertiesParser.java:103)
   	at org.apache.camel.component.properties.DefaultPropertiesParser$ParsingContext.parse(DefaultPropertiesParser.java:87)
   	at org.apache.camel.component.properties.DefaultPropertiesParser.parseUri(DefaultPropertiesParser.java:57)
   	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:219)
   	at org.apache.camel.component.properties.PropertiesComponent.parseUri(PropertiesComponent.java:171)
   	at org.apache.camel.impl.engine.AbstractCamelContext.resolvePropertyPlaceholders(AbstractCamelContext.java:1682)
   	at org.apache.camel.model.ProcessorDefinitionHelper.resolvePropertyPlaceholders(ProcessorDefinitionHelper.java:734)
   	at org.apache.camel.model.RouteDefinitionHelper.initRouteInput(RouteDefinitionHelper.java:443)
   	... 53 more```
   
   Is there a structure to the secret file that I feed to `kubectl create secret generic` that I need to follow? 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services