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

Creation of resources specified as kubernetes components #216

Closed
dharmit opened this issue Nov 12, 2020 · 6 comments
Closed

Creation of resources specified as kubernetes components #216

dharmit opened this issue Nov 12, 2020 · 6 comments
Labels
area/library Common devfile library for interacting with devfiles

Comments

@dharmit
Copy link

dharmit commented Nov 12, 2020

Is your feature request related to a problem? Please describe.
In odo, we're planning to store the information about Operator backed services in the devfile under "components -> kubernetes" when user does, say, odo service create etcdoperator.v0.9.4-clusterwide/EtcdCluster or odo link EtcdCluster/example.

In this approach, we intend to store the CRD yaml in "components -> kubernetes -> inlined".

Describe the solution you'd like
When the user does odo service create or odo link as mentioned above, the CRD of the Operator backed service should be stored under "components -> kubernetes -> inlined".

Next, these kubernetes components should be created for the user on the kubernetes/OpenShift cluster when they do odo push.

Describe alternatives you've considered
NA.

Additional context
Some discussion on this has happened on redhat-developer/odo#4159.

Does devfile library support or plan to support creation of such resources under "components -> kubernetes"?

@kadel
Copy link
Member

kadel commented Jan 21, 2021

It looks like the library can already extract inlined kubernetes components.
I completely missed that originallyly.

If I understand it correctly, this is how you can easily extract inlined kubernetes from devfile:

package main

import (
	"fmt"
	"github.com/devfile/library/pkg/devfile"
	"github.com/devfile/library/pkg/devfile/parser/data/v2/common"
)

func main() {

	devfileObj, err := devfile.ParseAndValidate("./devfile.yaml")
	if err != nil {
		panic(err)
	}

	components, err :=devfileObj.Data.GetComponents(common.DevfileOptions{})
	if err != nil {
		panic(err)
	}

	for _, component := range components {
		if component.Kubernetes != nil {
			fmt.Println(component.Kubernetes.Inlined)
		}
	}

}

@elsony
Copy link
Contributor

elsony commented Jan 21, 2021

Closing this since the support is already there

@elsony elsony closed this as completed Jan 21, 2021
@dharmit
Copy link
Author

dharmit commented Feb 24, 2021

@maysunfaisal @yangcao77 does library provide a way to delete a component from the devfile? I don't see a method for that in the interface: https://github.com/devfile/library/blob/master/pkg/devfile/parser/data/interface.go#L25-L28

How do you recommend component deletion from devfile?

EDIT: I made a comment about this on #306 (comment).

@maysunfaisal
Copy link
Member

@dharmit looking at the odo issue redhat-developer/odo#4160, does this delete entail deleting the entry from the devfile? like for example odo service delete deletes the appropriate kubernetes component?
@yangcao77

@yangcao77
Copy link
Contributor

you are right. currently there is no easy way provided by library to perform deletion.
@maysunfaisal we will need to provide delete apis in the interface, and odo service delete will just call deleteComponent(componentName), and then call writer to override the devfile.

@dharmit
Copy link
Author

dharmit commented Feb 25, 2021

does this delete entail deleting the entry from the devfile? like for example odo service delete deletes the appropriate kubernetes component?

Yes, that's how it's intended to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/library Common devfile library for interacting with devfiles
Projects
None yet
Development

No branches or pull requests

5 participants