-
Notifications
You must be signed in to change notification settings - Fork 244
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
Support link command for devfile #2920
Comments
There is also this issue that is related #2534 We might need to first figure out how to store the service information. Storing in devfile.yamlBenefits:
Challenges:
Storing in env.yamlBenefits:
Challenges:
Not storing it at allBenefits:
Challenges:
|
/triage needs-information |
the discussed workflow was
|
I tried to link a nodejs devfile component with the etcd cluster by following the steps mentioned in https://github.com/redhat-developer/service-binding-operator/blob/master/examples/nodejs_etcd_operator/README.md. But it's not working yet. So far, I think it's because service binding operator expects us to set name value in the Will be looking at this more and keep this issue updated. |
+1, but let's break this into two stages. We should start with the implementation that uses ServiceBindingOperator and than add the fall back after we have this. |
+1. Even with SBO, it's not really apparent so far. The example I mentioned in #2920 (comment) is still not working. I'll open an issue on the project repo to get help from their experts. |
Had a call with a member from the SBO team and we tried to create a binding request. But it failed. Tracking it in redhat-developer/service-binding-operator#467. |
My research so far has been based on the SBO. I've not tried linking the component and service without the operator. The yaml file that I used to create a binding between a component and etcd cluster is: apiVersion: apps.openshift.io/v1alpha1
kind: ServiceBindingRequest
metadata:
name: binding-request
namespace: sbo
spec:
applicationSelector:
group: apps
version: v1
resource: deployments
resourceref: nodejs-rest-http-crud
backingServiceSelector:
group: etcd.database.coreos.com
kind: EtcdCluster
version: v1beta2
resourceRef: example
mountPathPrefix: ""
customEnvVar: []
detectBindingResources: true The code/API to do this is under https://github.com/redhat-developer/service-binding-operator/blob/master/pkg/controller/servicebindingrequest/servicebinder.go. |
There was a tiny error in the yaml because of which the linking didn't work. The linking wasn't working because I had used I'll be adding https://github.com/redhat-developer/service-binding-operator/ as a dependency in odo to be able to use it to bind the components & services. |
Scope of this issue based on my research and understanding so far:
Above scope is based on the assumption that we'll be using SBO to link. Linking without SBO should be a separate issue/PR, IMO. It also doesn't account for what's discussed in #2920 (comment) because for that we first need to agree upon:
Above scope also doesn't include linking s2i components with the service. It should be a separate issue/PR, IMO. |
/area linking |
I added dependency on the Service Binding Operator but the binary's failing to build with below error: $ make
go build -ldflags="-w -X github.com/openshift/odo/pkg/version.GITCOMMIT=72190cfe5" cmd/odo/odo.go
# github.com/openshift/odo/pkg/lclient
pkg/lclient/fakeclient.go:65:3: cannot use container.HostConfig literal (type container.HostConfig) as type struct { NetworkMode string "json:\",omitempty\"" } in field value
pkg/lclient/fakeclient.go:84:3: cannot use container.HostConfig literal (type container.HostConfig) as type struct { NetworkMode string "json:\",omitempty\"" } in field value
pkg/lclient/fakeclient.go:148:6: cannot use &containerElement.HostConfig (type *struct { NetworkMode string "json:\",omitempty\"" }) as type *container.HostConfig in field value
make: *** [Makefile:53: bin] Error 2 Apparently the definition of // Container contains response of Engine API:
// GET "/containers/json"
type Container struct {
ID string `json:"Id"`
Names []string
Image string
ImageID string
Command string
Created int64
Ports []Port
SizeRw int64 `json:",omitempty"`
SizeRootFs int64 `json:",omitempty"`
Labels map[string]string
State string
Status string
HostConfig container.HostConfig
NetworkSettings *SummaryNetworkSettings
Mounts []MountPoint
} to: // Container contains response of Engine API:
// GET "/containers/json"
type Container struct {
ID string `json:"Id"`
Names []string
Image string
ImageID string
Command string
Created int64
Ports []Port
SizeRw int64 `json:",omitempty"`
SizeRootFs int64 `json:",omitempty"`
Labels map[string]string
State string
Status string
HostConfig struct {
NetworkMode string `json:",omitempty"`
}
NetworkSettings *SummaryNetworkSettings
Mounts []MountPoint
} I need help to move ahead on this. I'm kind of clueless as to how to fix this. How can I replace a struct with just a string? To add the dependency I did: $ glide get github.com/redhat-developer/service-binding-operator/
$ glide update -v I've pushed the resulting repo to https://github.com/dharmit/odo/tree/fix-2920. ping @yangcao77 (since I see that you worked on this in the past) UPDATE: I've deleted the branch mentioned above in favour of just copying the structs to odo repo instead of adding dependency on SBO. |
We should take the current purpose of the service binding specification into account when we design this feature: https://github.com/application-stacks/service-binding-specification/#application-projection |
@elsony the way we've done it right now is:
To be able to execute this final step of link (or "service") creation, we create a YAML from the struct we're working with in step 2 and use the So we're basically just offloading the task of mounting/injecting relevant information, from an Operator backed service into the component, to the Service Binding Operator. However, if we intend to add some flags to |
Maybe I'm missing something. But
using |
We are creating a link using the "Service Binding Operator". In a way we're creating a service from an Operator. Hence, it shows up under
At the moment, $ odo service list
NAME TYPE AGE
example Cockroachdb 3s
example EtcdCluster 3m22s Can you elaborate on what you're expecting from |
It does. But isn't this going to confuse odo users? We might try hide
It depends on how you define If help is going to say
If help is going to say
Also keep in mind that |
Yes, I agree. It could confuse. The most epic situation would be when someone tries to link a component to an existing SBR. 😂 Tangential question/discussion which we could cover in a dedicated issue:
This might be a better option since we want components to link to either Operator backed service or Service Catalog backed service. But how about below instead: $ odo service list
NAME AGE
Cockroachdb/example 3s
EtcdCluster/example 3m22s
EtcdCluster/myawesomeetcd 3s It still follows the
But this is how we're listing things right now. |
Current status of this issue
ProblemThe way this "injection of environment variables" happens is by modifying the Deployment of the component (a.k.a. application). This causes the underlying pod to be terminated and a new one is spun up which contains the environment variable(s). Presently, for devfile components, odo uses A possible solutionStore the information about the link ( Upon a successful Another solution (probably for a longer term) could be to use some persistent form of storage to store the code in the pod instead of using @kadel please correct me if I'm mistaken in summarizing our discussion. |
We need to decide how we would like to store this information in the Do we want to make it a part of If yes, what pieces of information do we want to store? Here's a few that I can think of:
However, I'm sceptical about how things will work out when we try to link with a Service Catalog backed service.
This is the approach that we thought would be helpful in averting the problem mentioned in #2920 (comment). If there's any other approach that anyone would like to share, please mention. |
Is this an upstream issue? Like the pod shouldnt be recreated due to just injection of env variables. |
The deployment's definition changes as a result of the injection of environment variable. And hence the underlying pod's going to be recreated. It's more of design than an issue. |
/kind user-story
User Story
As a user, I want to use the
link
command to link a service to a given componentAcceptance Criteria
link
command should behave the same as the existinglink
s2i style command[ ] check and disallow self linking of componentscovered by self linking of the component should not be there using odo link #1052Links
/kind user-story
/area devfile
The text was updated successfully, but these errors were encountered: