Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to have sources for integrations as ConfigMaps #1951

Closed
lancerdima opened this issue Jan 27, 2021 · 4 comments · Fixed by #1953
Closed

Ability to have sources for integrations as ConfigMaps #1951

lancerdima opened this issue Jan 27, 2021 · 4 comments · Fixed by #1953

Comments

@lancerdima
Copy link

Problem

Currently, sources for Integration CRDs are specified through content property under sources tag
spec:
sources:
- name: fileName.java
content: |
** source / bean definition **

Suggestion

Add ability to provide sources (especially sources with custom beans) as ConfigMaps. That should promote some modularity and reuse of sources between integrations.

@lburgazzoli
Copy link
Contributor

If you set contentRef: nameOfTheConfigMap, then the content is taken from the named config map

@lancerdima
Copy link
Author

Thanks for the hint @lburgazzoli, I've figured out the setup that works.
For future reference, the yaml should look like this.

spec:
  flows:
    - from:
        ...
        steps:
          - to: ...
  sources:
    - contentRef: configmapname
      contentKey: MySourceFile.java
      name: MySourceFile.java

The corresponding config map is:

apiVersion: v1
kind: ConfigMap
metadata:
  name: configmapname
data:
  content: |
    **my source code**

The only confusion I have is that contentKey seems does not have any effect, and I am required to use content property in configmap, instead of e.g. MySourceFile.java.
If that is expected, issue can be closed.

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Jan 27, 2021

As per the code, the contentKey should have been taken into account.

@squakez mind having a look if you have any spare time ?

@squakez
Copy link
Contributor

squakez commented Jan 27, 2021

Sure, I am already working on something similar.

squakez added a commit to squakez/camel-k that referenced this issue Jan 28, 2021
* If an integration is providing specifically a ConfigMap's item we now use its key, leaving "content" as default
* Added some unit test to check default and content ref behavior also for sources

Fix apache#1951
nicolaferraro pushed a commit that referenced this issue Jan 28, 2021
* If an integration is providing specifically a ConfigMap's item we now use its key, leaving "content" as default
* Added some unit test to check default and content ref behavior also for sources

Fix #1951
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants