-
Notifications
You must be signed in to change notification settings - Fork 243
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
odo list follow up implementation (#3964)
* initial work * build the repr for devfile when walking the path * introduce the devfile component * make devfile component similar to s2i component * resolve unit test * major refactor and implement json out for standard components * resolve lint * use shorter check * resolved some bugs * resolve failing unit test * resolve failing tests * addressed denis's suggestions * resolved failing intg tests * resolve failing tests * debug error * add debugging * more logging * set namespace in kclient * removed debugging * addressed cdrage's comment
- Loading branch information
1 parent
b3c126d
commit a28e378
Showing
13 changed files
with
294 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package component | ||
|
||
import ( | ||
applabels "github.com/openshift/odo/pkg/application/labels" | ||
componentlabels "github.com/openshift/odo/pkg/component/labels" | ||
"github.com/openshift/odo/pkg/config" | ||
appsv1 "k8s.io/api/apps/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
func NewDevfileComponent(componentName string) DevfileComponent { | ||
return DevfileComponent{ | ||
TypeMeta: metav1.TypeMeta{ | ||
Kind: "DevfileComponent", | ||
APIVersion: apiVersion, | ||
}, | ||
ObjectMeta: metav1.ObjectMeta{ | ||
Name: componentName, | ||
}, | ||
Spec: DevfileComponentSpec{ | ||
SourceType: string(config.LOCAL), | ||
}, | ||
} | ||
} | ||
|
||
func DevfileComponentsFromDeployments(deployList *appsv1.DeploymentList) []DevfileComponent { | ||
compList := []DevfileComponent{} | ||
for _, deployment := range deployList.Items { | ||
app := deployment.Labels[applabels.ApplicationLabel] | ||
cmpType := deployment.Labels[componentlabels.ComponentTypeLabel] | ||
|
||
comp := NewDevfileComponent(deployment.Name) | ||
comp.Status.State = StateTypePushed | ||
comp.Namespace = deployment.Namespace | ||
comp.Spec.App = app | ||
comp.Spec.Type = cmpType | ||
comp.Spec.Name = deployment.Name | ||
compList = append(compList, comp) | ||
} | ||
return compList | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.