Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions pkg/cmd/promote.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,16 +227,7 @@
if ref == nil {
return nil, nil
}
ik := v1.NewIntegrationKit(ref.Namespace, ref.Name)
key := k8sclient.ObjectKey{
Name: ref.Name,
Namespace: ref.Namespace,
}
if err := c.Get(o.Context, key, ik); err != nil {
return nil, err
}

return ik, nil
return kubernetes.GetIntegrationKit(o.Context, c, ref.Name, ref.Namespace)

Check failure on line 230 in pkg/cmd/promote.go

View workflow job for this annotation

GitHub Actions / validate

return with no blank line before (nlreturn)
}

func (o *promoteCmdOptions) editIntegration(it *v1.Integration, kit *v1.IntegrationKit) *v1.Integration {
Expand Down
15 changes: 9 additions & 6 deletions pkg/trait/jvm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
"github.com/apache/camel-k/v2/pkg/builder"
"github.com/apache/camel-k/v2/pkg/util"
"github.com/apache/camel-k/v2/pkg/util/camel"
"github.com/apache/camel-k/v2/pkg/util/envvar"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
"github.com/apache/camel-k/v2/pkg/util/sets"
)

Expand Down Expand Up @@ -221,18 +221,21 @@
}

func (t *jvmTrait) getIntegrationKit(e *Environment) (*v1.IntegrationKit, error) {
kit := e.IntegrationKit
if e.IntegrationKit != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check is redundant. We can keep as it was.

return e.IntegrationKit, nil
}

if kit == nil && e.Integration.Status.IntegrationKit != nil {
if e.Integration.Status.IntegrationKit != nil {
name := e.Integration.Status.IntegrationKit.Name
ns := e.Integration.GetIntegrationKitNamespace(e.Platform)
kit = v1.NewIntegrationKit(ns, name)
if err := t.Client.Get(e.Ctx, ctrl.ObjectKeyFromObject(kit), kit); err != nil {
kit, err := kubernetes.GetIntegrationKit(e.Ctx, t.Client, name, ns)
if err != nil {
return nil, fmt.Errorf("unable to find integration kit %s/%s: %w", ns, name, err)
}
return kit, nil

Check failure on line 235 in pkg/trait/jvm.go

View workflow job for this annotation

GitHub Actions / validate

return with no blank line before (nlreturn)
}

return kit, nil
return nil, nil
}

func (t *jvmTrait) enableDebug(e *Environment) string {
Expand Down
8 changes: 2 additions & 6 deletions pkg/trait/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@
"regexp"
"strings"

ctrl "sigs.k8s.io/controller-runtime/pkg/client"

v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
"github.com/apache/camel-k/v2/pkg/client"
"github.com/apache/camel-k/v2/pkg/util"
"github.com/apache/camel-k/v2/pkg/util/camel"
"github.com/apache/camel-k/v2/pkg/util/kubernetes"
"github.com/apache/camel-k/v2/pkg/util/property"
"github.com/apache/camel-k/v2/pkg/util/sets"
)
Expand All @@ -53,10 +52,7 @@
if integration.Status.IntegrationKit == nil {
return nil, nil
}
kit := v1.NewIntegrationKit(integration.Status.IntegrationKit.Namespace, integration.Status.IntegrationKit.Name)
err := c.Get(ctx, ctrl.ObjectKeyFromObject(kit), kit)

return kit, err
return kubernetes.GetIntegrationKit(ctx, c, integration.Status.IntegrationKit.Name, integration.Status.IntegrationKit.Namespace)

Check failure on line 55 in pkg/trait/util.go

View workflow job for this annotation

GitHub Actions / validate

return with no blank line before (nlreturn)
}

func collectConfigurationPairs(configurationType string, configurable ...v1.Configurable) []variable {
Expand Down
Loading