Files
kubevela/pkg/serverlib/component.go
Ryan Zhang d3511415c2 add webhooks to the rollout plan and use AC as App snapshot (#1031)
* add webhooks

* app controller change

* add component revision and appconfig revision and test

* solidify the component revision logic and fix component revisoin bugs

* fix command cli e2e failure

* fix the bug caused by rawExtention

* fix UT test

* retry on component not found

* lint

* revert component revision create order
2021-02-19 12:11:26 -08:00

28 lines
654 B
Go

package serverlib
import (
"context"
"github.com/oam-dev/kubevela/pkg/server/apis"
"sigs.k8s.io/controller-runtime/pkg/client"
)
// RetrieveComponent will get component status
func RetrieveComponent(ctx context.Context, c client.Reader, applicationName, componentName,
namespace string) (apis.ComponentMeta, error) {
var componentMeta apis.ComponentMeta
applicationMeta, err := RetrieveApplicationStatusByName(ctx, c, applicationName, namespace)
if err != nil {
return componentMeta, err
}
for _, com := range applicationMeta.Components {
if com.Name != componentName {
continue
}
return com, nil
}
return componentMeta, nil
}