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

kamelets: source/sink binding #1676

Closed
lburgazzoli opened this issue Aug 27, 2020 · 9 comments · Fixed by #1602
Closed

kamelets: source/sink binding #1676

lburgazzoli opened this issue Aug 27, 2020 · 9 comments · Fixed by #1602
Assignees
Labels
area/core Core features of the integration platform area/kamelets
Milestone

Comments

@lburgazzoli
Copy link
Contributor

lburgazzoli commented Aug 27, 2020

To have a generic mechanics to use kamelet to materialize sources and sinks, we should introduce a new resource named KameletBinding like:

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: twitter-directmessage-source
spec:
  configuration:
    - type: "property"
      value: "key=value"
    - property:
        name: user
        value: my-user
    - property:
        name: password
        valueFrom:
          secretKeyRef:
            name: the-password
            key: password
  source:
    ref:
      apiVersion: camel.apache.org/v1alpha1
      kind: Kamelet
      name: twitter-directmessage
  sink:
    ref:
      apiVersion: messaging.knative.dev/v1alpha1
      kind: InMemoryChannel
      name: twitter

The operator should translate the binding into a real integration as example, for knative sources and sinks it could generate a source like:

- from:
    uri: "kamelet:witter-directmessage"
    steps:
      - to: "knative:channel/twitter"
@lburgazzoli lburgazzoli added this to the 1.2.0 milestone Aug 27, 2020
@lburgazzoli lburgazzoli added the area/core Core features of the integration platform label Aug 31, 2020
@nicolaferraro
Copy link
Member

nicolaferraro commented Aug 31, 2020

Can we have something like this instead:

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: twitter-directmessage-source
spec:
  properties:
    key: value
    user: my-user
    password: just-provide-it-in-plain-text-for-now
  source:
    ref:
      apiVersion: camel.apache.org/v1alpha1
      kind: Kamelet
      name: twitter-directmessage
  sink:
    ref:
      apiVersion: messaging.knative.dev/v1alpha1
      kind: InMemoryChannel
      name: twitter

(edited after comment)

There are multiple reasons:

  • The configuration I propose is compatible with the JSON schema exposed by the Kamelet definition (so it can be validated), while the array of configuration items is not
  • We currently don't support per-property secret entries iirc, but only global secrets and it seems not easy to create them now, considering also that kamelet properties are locally scoped

Wdyt @lburgazzoli ?

@lburgazzoli
Copy link
Contributor Author

We can but how do you define which secrets/configmaps the source need to mount ?

@nicolaferraro
Copy link
Member

We can but how do you define which secrets/configmaps the source need to mount ?

Using a spec->integration field (same trick as in Knative CamslSources), until we figure out a better way to handle them.

@lburgazzoli
Copy link
Contributor Author

lburgazzoli commented Aug 31, 2020

so I guess this should be named properties instead of configuration to avoid confusion ? in that case yes we can use plain key/value pairs

@nicolaferraro
Copy link
Member

A better format:

apiVersion: camel.apache.org/v1alpha1
kind: KameletBinding
metadata:
  name: twitter-directmessage-source
spec:
  source:
    ref:
      apiVersion: camel.apache.org/v1alpha1
      kind: Kamelet
      name: twitter-directmessage
    properties:
      key: value
      user: my-user
      password: just-provide-it-in-plain-text-for-now
  sink:
    ref:
      apiVersion: messaging.knative.dev/v1alpha1
      kind: InMemoryChannel
      name: twitter

They can be optionally used also in the sink part.

This removes the ambiguity about what endpoint the properties refer to.
Wdyt @lburgazzoli ?

@nicolaferraro nicolaferraro self-assigned this Sep 1, 2020
@lburgazzoli
Copy link
Contributor Author

LGTM, I think source and sink can be backed by the same struct at this point

@lburgazzoli
Copy link
Contributor Author

btw, we can use the syntax:

password: #property:my-property-stored-in-a-secret

for sensitive info

@nicolaferraro
Copy link
Member

btw, we can use the syntax:

password: #property:my-property-stored-in-a-secret

for sensitive info

Right! That can be done manually by the user.

@nicolaferraro
Copy link
Member

LGTM, I think source and sink can be backed by the same struct at this point

Yes, I'm calling it "Endpoint", as we do in Camel ;)

nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 1, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 1, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 14, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 15, 2020
nicolaferraro added a commit to nicolaferraro/camel-k that referenced this issue Sep 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/core Core features of the integration platform area/kamelets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants