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

Support Kubernetes Devfile component #4159

Closed
girishramnani opened this issue Oct 27, 2020 · 14 comments
Closed

Support Kubernetes Devfile component #4159

girishramnani opened this issue Oct 27, 2020 · 14 comments
Assignees
Labels
kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation 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)). triage/needs-information Indicates an issue needs more information in order to work on it.

Comments

@girishramnani
Copy link
Contributor

girishramnani commented Oct 27, 2020

/kind feature

service operations should occur on odo push. we need to store the service information in the Component as a CR in the devfile.

@openshift-ci-robot openshift-ci-robot added the kind/user-story An issue of user-story kind label Oct 27, 2020
@girishramnani girishramnani added kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation triage/needs-information Indicates an issue needs more information in order to work on it. and removed kind/user-story An issue of user-story kind labels Oct 27, 2020
@kadel kadel changed the title service operations should occur on odo push Support Kubernetes Devfile component Nov 6, 2020
@kadel
Copy link
Member

kadel commented Nov 6, 2020

In order for this to work, we first need to add support for kubernetes components.

Devfile can specify kubernetes component like this:

components:
  - name: my-mongo
    kubernetes:
      inlined: >
        apiVersion: v1
        kind: Pod
        metadata:
          name: nginx
          labels:
            name: nginx
        spec:
          containers:
          - name: nginx
            image: nginx
            ports:
            - containerPort: 80

or

components:
  - name: my-mongo
    kubernetes:
      inlined: >
        apiVersion: mongodb.com/v1
        kind: MongoDB
        metadata:
          name: my-replica-set
          namespace: tkral-test
        spec:
          credentials: my-credentials
          members: 3
          opsManager:
            configMapRef:
              name: my-project
          type: ReplicaSet
          version: 4.4.0-ent
          persistent: true
        status:
          phase: Running
          type: ReplicaSet

The idea is that the content of a kubernetes component can be any Kubernetes resource (core one, or custom resource).

odo push needs to recognize kubernetes components and apply them to the cluster.

@dharmit
Copy link
Member

dharmit commented Nov 10, 2020

In order for this to work, we first need to add support for kubernetes components.
odo push needs to recognize kubernetes components and apply them to the cluster.

I think we can take a small step first by adding the definition of the resource to the devfile. In the next step, we can ensure that odo push does something of it. I think there will be a lot of discussion for that. For example, I have asked some questions in #4160 (comment). I also remember we were playing with the idea of breaking down odo push so that individual pieces are pushed: a component, the URLs, service, etc.

Devfile can specify kubernetes component like this:
The idea is that the content of a kubernetes component can be any Kubernetes resource (core one, or custom resource).

+1 to the examples. Makes sense.

@kadel
Copy link
Member

kadel commented Nov 10, 2020

I think we can take a small step first by adding the definition of the resource to the devfile. In the next step, we can ensure that odo push does something of it.

I'm actually proposing doing it the other way around. The first step needs to be to ensure that odo push can correctly interpret kubernetes component.

I think there will be a lot of discussion for that. For example, I have asked some questions in #4160 (comment).

This issue is about odo push the #4160 is about odo create

@kadel kadel added the priority/High Important issue; should be worked on before any other issues (except priority/Critical issue(s)). label Nov 10, 2020
@dharmit
Copy link
Member

dharmit commented Nov 11, 2020

I'm actually proposing doing it the other way around. The first step needs to be to ensure that odo push can correctly interpret kubernetes component.

My concern on doing that first is that we're just getting started with refactoring and a lot of things are expected to change. I don't intend to wait till refactoring is over but, at the moment, there's almost no clarity on how odo push code is going to change.

@kadel
Copy link
Member

kadel commented Nov 16, 2020

My concern on doing that first is that we're just getting started with refactoring and a lot of things are expected to change. I don't intend to wait till refactoring is over but, at the moment, there's almost no clarity on how odo push code is going to change.

We will first need to address changes in devfile/parser or in parser in odo as there is no support for kubernetes component.
Before we get into writing the actual odo push logic the refactoring will probably be done, or at least it will be clear how much changes will be needed there.

@dharmit
Copy link
Member

dharmit commented Dec 4, 2020

We're waiting on some movement on devfile/api#216 for this to be able to move further. The code for this needs to go into library and not in odo.

@dharmit dharmit removed this from For Consideration in Sprint 194 Dec 28, 2020
@dharmit dharmit added this to For Consideration in Sprint 195 Dec 28, 2020
@dharmit dharmit removed this from For Consideration in Sprint 195 Dec 30, 2020
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@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 Mar 4, 2021
@dharmit
Copy link
Member

dharmit commented Mar 4, 2021

/lifecycle frozen

@openshift-ci-robot openshift-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Mar 4, 2021
@openshift-ci-robot openshift-ci-robot added the lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. label Mar 4, 2021
@scottkurz
Copy link
Contributor

@kadel @dharmit - I'm noticing the recent updates like #4656 to support kubernetes-typed components focus on support operator-backed services.

I'm curious if a use case like Tomas's naked Mongo Pod described here: #4159 (comment)
is still considered a valid use case.

On the one-hand, I can see how using an operator would be more powerful for something like a database.

But I'm interested in where we're headed with this case. Is the inlined kubernetes component going to allow a devfile author to insert any yaml that will be kubectl apply(d)? Or is odo always going to carefully parse and validate it against the resources in the cluster?

That is, even if this isn't the most useful way to create a Mongo DB I'm curious if the vision is to allow any yaml to be applied via an inline component?

@dharmit
Copy link
Member

dharmit commented May 4, 2021

@scottkurz I'll try to answer that but will rely on @kadel to validate my response.

At a high level, odo is currently not focussing on the users who would modify devfile by hands. That is, if someone's editing it manually and not interacting with it via odo, there's no guarantee that things would work.

Having said that, we do understand that for architects or Devfile authors like you, Andy and others, modifying Devfile by hands could be a "norm".

What odo does in the code is use the dynamic client to create the Kubernetes inlined component: https://github.com/openshift/odo/blob/c0be940e1df15ca1ebf410de962932b327d9d5a7/pkg/service/service.go#L856-L867

Theoretically, you could very well create a Pod or any other Kubernetes resources of your choice using this. We haven't tested it, however, because such use cases are currently not a priority for odo.

@kadel correct me if I am wrong.

@kadel
Copy link
Member

kadel commented May 4, 2021

At a high level, odo is currently not focussing on the users who would modify devfile by hands. That is, if someone's editing it manually and not interacting with it via odo, there's no guarantee that things would work.

Not really. Odo uses Devfile v2. And as such, it needs to be able to correctly interpret any valid devfile.
It is perfectly valid odo use-case to write devfiles "by-hand" and use just odo push.
The thing that we are not focusing on and it will always be out of the scope for odo is providing a command to modify every aspect and field in devfile. Odo devfile editing capabilities will be always limited to just the most common use cases. Fot the rest usrs will have to edit devices directly.

Theoretically, you could very well create a Pod or any other Kubernetes resources of your choice using this. We haven't tested it, however, because such use cases are currently not a priority for odo.

@kadel correct me if I am wrong.

If that Devfile has Pod or any other k8s resource as a Kubernetes component odo needs to be able to interpret it.

@scottkurz
Copy link
Contributor

OK.. I opened #4685 to follow-up on this use case.

Let me just note again I'm not saying this is particularly important to the set of top Open Liberty use cases. I just view it as a test case understanding the full devfile vision.

@dharmit
Copy link
Member

dharmit commented Jul 8, 2021

Original request in the issue description is implemented.

/close

@openshift-ci openshift-ci bot closed this as completed Jul 8, 2021
@openshift-ci
Copy link

openshift-ci bot commented Jul 8, 2021

@dharmit: Closing this issue.

In response to this:

Original request in the issue description is implemented.

/close

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue as a feature request. For PRs, that means that the PR is the implementation 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)). triage/needs-information Indicates an issue needs more information in order to work on it.
Projects
None yet
Development

No branches or pull requests

6 participants