Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Commit

Permalink
Fix ci issues
Browse files Browse the repository at this point in the history
Signed-off-by: zzxwill <[email protected]>
  • Loading branch information
zzxwill committed Nov 21, 2020
1 parent f2c19bd commit 0af56ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
11 changes: 5 additions & 6 deletions pkg/controller/v1alpha2/applicationconfiguration/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,13 +157,13 @@ func (r *components) renderComponent(ctx context.Context, acc v1alpha2.Applicati
compInfoLabels[oam.LabelOAMResourceType] = oam.ResourceTypeTrait

componentName := acc.ComponentName
appliedTraits, err := r.getAppliedTraits(ac, componentName)
compatibleTraits, err := r.getAppliedTraits(ac, componentName)
if err != nil {
return nil, err
}
var preAppliedTraits, compatibleTraits []unstructured.Unstructured
var preAppliedTraits = make([]unstructured.Unstructured, 0)
for _, ct := range acc.Traits {
compatibleTraits = append(appliedTraits, preAppliedTraits...)
compatibleTraits = append(compatibleTraits, preAppliedTraits...)
t, traitDef, err := r.renderTrait(ctx, ct, ac, componentName, ref, dag, compatibleTraits)
if err != nil {
return nil, err
Expand Down Expand Up @@ -233,8 +233,8 @@ func (r *components) renderTrait(ctx context.Context, ct v1alpha2.ComponentTrait
}

for _, conflict := range traitDef.Spec.ConflictsWith {
for _, compatibleTrait := range compatibleTraits {
compatibleTraitDef, err := util.FetchTraitDefinition(ctx, r.client, r.dm, &compatibleTrait)
for j := range compatibleTraits {
compatibleTraitDef, err := util.FetchTraitDefinition(ctx, r.client, r.dm, &compatibleTraits[j])
if err != nil {
if apierrors.IsNotFound(err) {
return t, util.GetDummyTraitDefinition(t), nil
Expand Down Expand Up @@ -687,7 +687,6 @@ func getTraitName(ac *v1alpha2.ApplicationConfiguration, componentName string,
// getAppliedTraits gets all the traits which is already applied to a specified component
func (r *components) getAppliedTraits(ac *v1alpha2.ApplicationConfiguration, componentName string) ([]unstructured.Unstructured, error) {
var traits []v1alpha2.ComponentTrait
//var appliedTraits []unstructured.Unstructured
var appliedTraits = make([]unstructured.Unstructured, 0)
deployedComponents := make([]string, 0)
for _, w := range ac.Status.Workloads {
Expand Down
5 changes: 2 additions & 3 deletions test/e2e-test/traits_conflict_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@ package controllers_test
import (
"context"

"github.com/crossplane/oam-kubernetes-runtime/apis/core/v1alpha2"
"github.com/crossplane/oam-kubernetes-runtime/pkg/oam"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"

"github.com/crossplane/oam-kubernetes-runtime/apis/core/v1alpha2"
v1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down

0 comments on commit 0af56ec

Please sign in to comment.