mirror of
https://github.com/kubevela/kubevela.git
synced 2026-08-23 22:46:53 +00:00
Chore: enhance deploy error display
Signed-off-by: Somefive <yd219913@alibaba-inc.com>
This commit is contained in:
@@ -117,6 +117,9 @@ type PlacementDecision struct {
|
||||
|
||||
// String encode placement decision
|
||||
func (in PlacementDecision) String() string {
|
||||
if in.Namespace == "" {
|
||||
return in.Cluster
|
||||
}
|
||||
return in.Cluster + "/" + in.Namespace
|
||||
}
|
||||
|
||||
|
||||
@@ -65,21 +65,21 @@ func TestImpersonatingRoundTripper(t *testing.T) {
|
||||
return ContextWithUserInfo(ctx, app)
|
||||
},
|
||||
expectedUser: "system:serviceaccount:vela-system:default",
|
||||
expectedGroup: []string{},
|
||||
expectedGroup: nil,
|
||||
},
|
||||
"without service account and app": {
|
||||
ctxFn: func(ctx context.Context) context.Context {
|
||||
return ContextWithUserInfo(ctx, nil)
|
||||
},
|
||||
expectedUser: "",
|
||||
expectedGroup: []string{},
|
||||
expectedGroup: nil,
|
||||
},
|
||||
"without service account": {
|
||||
ctxFn: func(ctx context.Context) context.Context {
|
||||
return ContextWithUserInfo(ctx, &v1beta1.Application{})
|
||||
},
|
||||
expectedUser: AuthenticationDefaultUser,
|
||||
expectedGroup: []string{},
|
||||
expectedGroup: nil,
|
||||
},
|
||||
"with user and groups": {
|
||||
ctxFn: func(ctx context.Context) context.Context {
|
||||
|
||||
@@ -29,8 +29,8 @@ import (
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
|
||||
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/common"
|
||||
"github.com/oam-dev/kubevela/apis/core.oam.dev/v1beta1"
|
||||
"github.com/oam-dev/kubevela/apis/types"
|
||||
"github.com/oam-dev/kubevela/pkg/features"
|
||||
"github.com/oam-dev/kubevela/pkg/oam"
|
||||
)
|
||||
@@ -40,7 +40,7 @@ var _ = Describe("Test Application Mutator", func() {
|
||||
var mutatingHandler *MutatingHandler
|
||||
|
||||
BeforeEach(func() {
|
||||
mutatingHandler = &MutatingHandler{}
|
||||
mutatingHandler = &MutatingHandler{skipUsers: []string{types.VelaCoreName}}
|
||||
Expect(mutatingHandler.InjectDecoder(decoder)).Should(BeNil())
|
||||
})
|
||||
|
||||
@@ -55,7 +55,7 @@ var _ = Describe("Test Application Mutator", func() {
|
||||
Expect(utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=true", features.AuthenticateApplication))).Should(Succeed())
|
||||
resp := mutatingHandler.Handle(ctx, admission.Request{
|
||||
AdmissionRequest: admissionv1.AdmissionRequest{
|
||||
UserInfo: authv1.UserInfo{Groups: []string{common.Group}},
|
||||
UserInfo: authv1.UserInfo{Username: types.VelaCoreName},
|
||||
}})
|
||||
Expect(resp.Allowed).Should(BeTrue())
|
||||
Expect(resp.Patches).Should(BeNil())
|
||||
|
||||
@@ -208,7 +208,7 @@ func applyComponents(apply oamProvider.ComponentApply, healthCheck oamProvider.C
|
||||
var reasons []string
|
||||
for i, res := range results {
|
||||
if res.err != nil {
|
||||
errs = append(errs, res.err)
|
||||
errs = append(errs, fmt.Errorf("error encountered in cluster %s: %w", todoTasks[i].placement.Cluster, res.err))
|
||||
}
|
||||
if !res.healthy {
|
||||
allHealthy = false
|
||||
|
||||
@@ -328,9 +328,11 @@ var _ = Describe("Test multicluster scenario", func() {
|
||||
envs[0].Placement.ClusterSelector.Name = WorkerClusterName
|
||||
bs, err = json.Marshal(&v1alpha1.EnvBindingSpec{Envs: []v1alpha1.EnvConfig{envs[0]}})
|
||||
Expect(err).Should(Succeed())
|
||||
Expect(k8sClient.Get(hubCtx, namespacedName, app)).Should(Succeed())
|
||||
app.Spec.Policies[0].Properties.Raw = bs
|
||||
Expect(k8sClient.Update(hubCtx, app)).Should(Succeed())
|
||||
Eventually(func(g Gomega) {
|
||||
g.Expect(k8sClient.Get(hubCtx, namespacedName, app)).Should(Succeed())
|
||||
app.Spec.Policies[0].Properties.Raw = bs
|
||||
g.Expect(k8sClient.Update(hubCtx, app)).Should(Succeed())
|
||||
}, 15*time.Second).Should(Succeed())
|
||||
Eventually(func(g Gomega) {
|
||||
deploys := &appsv1.DeploymentList{}
|
||||
g.Expect(k8sClient.List(hubCtx, deploys, client.InNamespace(testNamespace))).Should(Succeed())
|
||||
|
||||
Reference in New Issue
Block a user