mirror of
https://github.com/kubevela/kubevela.git
synced 2026-03-06 19:51:53 +00:00
* 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
28 lines
654 B
Go
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
|
|
}
|