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

odo link to link devfile components with each other #3423

Closed
2 of 3 tasks
dharmit opened this issue Jun 25, 2020 · 18 comments · Fixed by #4777
Closed
2 of 3 tasks

odo link to link devfile components with each other #3423

dharmit opened this issue Jun 25, 2020 · 18 comments · Fixed by #4777
Assignees
Labels
area/binding Issues or PRs related to `odo add/delete binding *` commands or Service Binding Operator area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/user-story An issue of user-story kind lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).

Comments

@dharmit
Copy link
Member

dharmit commented Jun 25, 2020

/kind user-story

User Story

As a user I want to link a devfile component with another devfile component so that I can develop and deploy and a multi-component microservices application on k8s/OCP.

Acceptance Criteria

  • odo push should create a Secret on the cluster for devfile components covered by odo link should store link information in devfile #4208.
  • odo link <component-name>, when executed from a devfile component directory, should link the component with another
  • It should prevent self-linking of component

Links

/area devfilev2
/area link

@openshift-ci-robot
Copy link
Collaborator

@dharmit: The label(s) area/link cannot be applied, because the repository doesn't have them

In response to this:

/kind user-story

User Story

As a user I want to link a devfile component with another devfile component so that I can develop and deploy and a multi-component microservices application on k8s/OCP.

Acceptance Criteria

  • odo link <component-name>, when executed from a devfile component directory, should link the component with another
  • It should prevent self-linking of component

Links

/area devfilev2
/area link

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci-robot openshift-ci-robot added kind/user-story An issue of user-story kind area/devfileV2 labels Jun 25, 2020
@dharmit dharmit added the area/binding Issues or PRs related to `odo add/delete binding *` commands or Service Binding Operator label Jun 25, 2020
@dharmit
Copy link
Member Author

dharmit commented Jun 25, 2020

Adding needs info to understand how much we need this in this sprint and also to research if we can use Service Binding Operator to link components. I remember reading in their README that we can but I need to read/understand beyond that.

/triage need-information

@openshift-ci-robot
Copy link
Collaborator

@dharmit: The label(s) triage/need-information cannot be applied, because the repository doesn't have them

In response to this:

Adding needs info to understand how much we need this in this sprint and also to research if we can use Service Binding Operator to link components. I remember reading in their README that we can but I need to read/understand beyond that.

/triage need-information

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dharmit
Copy link
Member Author

dharmit commented Jun 25, 2020

/triage needs-information

@openshift-ci-robot openshift-ci-robot added the triage/needs-information Indicates an issue needs more information in order to work on it. label Jun 25, 2020
@kadel kadel added area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. and removed area/devfileV2 labels Jun 25, 2020
@kadel kadel added the priority/Medium Nice to have issue. Getting it done before priority changes would be great. label Jul 14, 2020
@girishramnani
Copy link
Contributor

also consider the idea of linking a devfile component with an s2i component?

@dharmit
Copy link
Member Author

dharmit commented Sep 21, 2020

also consider the idea of linking a devfile component with an s2i component?

If an end-user comes with this request, we can consider adding the support. But since we plan to move away from s2i components, adding this feature doesn't help add much value presently.

@openshift-ci-robot openshift-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 25, 2021
@dharmit
Copy link
Member Author

dharmit commented Jan 29, 2021

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 29, 2021
@kadel
Copy link
Member

kadel commented Mar 3, 2021

With correct annotations on odo created Deployments we should be able to create a ServiceBinding between two odo components https://github.com/redhat-developer/service-binding-operator/blob/master/docs/User_Guide.md#binding-metadata-in-annotations

@kadel kadel added priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). and removed priority/Medium Nice to have issue. Getting it done before priority changes would be great. triage/needs-information Indicates an issue needs more information in order to work on it. labels Mar 3, 2021
@dharmit dharmit assigned mik-dass and unassigned dharmit Mar 22, 2021
@kadel
Copy link
Member

kadel commented May 5, 2021

  • odo push should create a Secret on the cluster for devfile components

Why it should create a Secret? Secret presence is not required for binding. The secret will be created by SBO.

@kadel
Copy link
Member

kadel commented May 20, 2021

each Service generated for odo devfile component should have annotations like this:

  annotations:
    service.binding/backend_ip: path={.spec.clusterIP}
    service.binding/backend_port: path={.spec.ports},elementType=sliceOfMaps,sourceKey=name,sourceValue=port

backend in this example is name of the odo component. It should match what is already in app.kubernetes.io/name label.

than the odo link command should create link between frontend and backend component

cd frontend
odo link backend

The resulting ServiceBinding should look like this

apiVersion: binding.operators.coreos.com/v1alpha1
kind: ServiceBinding
metadata:
  name: java-maven
spec:
  application:
    group: apps
    name: frontend
    resource: deployments
    version: v1
  bindAsFiles: false
  detectBindingResources: true
  services:
    - group: ""
      kind: Service
      name: backend
      version: v1

This will expose env variables in frontend compoentn

  SERVICE_BACKEND_IP: 10.217.4.62
  SERVICE_BACKEND_PORT_PORT-8080: 8080

Note:
PORT is twice there because in the example service port has name port-8080.

  ports:
  - name: port-8080
    port: 8080
    protocol: TCP
    targetPort: 8080

If port name is for example http the env variable will be SERVICE_BACKEND_PORT_HTTP: 8080
But it looks like odo currently autogenerates port names using PORT_<number> pattern. This is an issue that should be addressed separately #4737

@mik-dass
Copy link
Contributor

each Service generated for odo devfile component should have annotations like this:

Currently the devfile library generator doesn't allow to specify annotations while generating the service object https://github.com/devfile/library/blob/2aa02fa8648870c543dea5e45185a7333fcd35c3/pkg/devfile/generator/generators.go#L149. We will need to manually add it to the generated service object or make the required changes to the devfile library.

@kadel
Copy link
Member

kadel commented May 27, 2021

Currently the devfile library generator doesn't allow to specify annotations while generating the service object https://github.com/devfile/library/blob/2aa02fa8648870c543dea5e45185a7333fcd35c3/pkg/devfile/generator/generators.go#L149. We will need to manually add it to the generated service object or make the required changes to the devfile library.

The best approach might be to update devfile library to include the service annotations automatically

@mik-dass
Copy link
Contributor

mik-dass commented Jun 3, 2021

Currently the devfile library generator doesn't allow to specify annotations while generating the service object https://github.com/devfile/library/blob/2aa02fa8648870c543dea5e45185a7333fcd35c3/pkg/devfile/generator/generators.go#L149. We will need to manually add it to the generated service object or make the required changes to the devfile library.

We can specify the annotations with the current library version used by odo using the method

https://github.com/devfile/library/blob/bd6996094a73701919f96c9f3071623cfd27ddc3/pkg/devfile/generator/generators.go#L41.

The selectorLabels in ServiceParams are the labels used in the ServiceSpec of the generated service.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/binding Issues or PRs related to `odo add/delete binding *` commands or Service Binding Operator area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. kind/user-story An issue of user-story kind lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants