This is an automated email from the ASF dual-hosted git repository.

lburgazzoli pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/main by this push:
     new 8fa8846a7 feat(lint): enabe magic number detector (mld)
8fa8846a7 is described below

commit 8fa8846a71cd9e31bd1e0c29279e3931b99b2d61
Author: Luca Burgazzoli <lburgazz...@gmail.com>
AuthorDate: Fri May 10 14:56:31 2024 +0200

    feat(lint): enabe magic number detector (mld)
---
 .golangci.yml                                      | 37 +++++++++++++++++++++-
 addons/keda/duck/v1alpha1/zz_generated.deepcopy.go |  2 +-
 cmd/util/json-schema-gen/main.go                   |  4 ++-
 e2e/advanced/deployment_test.go                    |  3 +-
 e2e/advanced/dump_test.go                          |  3 +-
 e2e/install/cli/uninstall_test.go                  |  5 +--
 e2e/knative/gc_test.go                             |  3 +-
 e2e/knative/openapi_test.go                        |  3 +-
 e2e/native/native_binding_test.go                  |  3 +-
 e2e/support/test_util.go                           |  3 +-
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   |  2 +-
 pkg/apis/camel/v1/zz_generated.deepcopy.go         |  1 +
 pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go   |  3 +-
 pkg/builder/image.go                               |  8 +++--
 pkg/builder/project.go                             |  5 ++-
 pkg/builder/quarkus.go                             |  4 ++-
 pkg/cmd/builder/builder.go                         |  4 ++-
 pkg/cmd/operator.go                                | 10 ++++--
 pkg/cmd/util_config.go                             |  6 ++--
 pkg/controller/build/build_controller.go           |  9 ++++--
 pkg/controller/build/recovery.go                   | 16 +++++++---
 pkg/controller/catalog/catalog_controller.go       |  6 +++-
 pkg/controller/integrationkit/build.go             |  6 +++-
 .../integrationkit/integrationkit_controller.go    |  6 +++-
 .../integrationplatform_controller.go              |  6 +++-
 .../integrationprofile_controller.go               |  6 +++-
 pkg/install/cluster.go                             |  3 ++
 pkg/kamelet/repository/repository.go               |  1 +
 pkg/platform/defaults.go                           |  9 ++++--
 pkg/trait/affinity.go                              |  7 +++-
 pkg/trait/builder.go                               |  5 +--
 pkg/trait/camel.go                                 |  4 ++-
 pkg/trait/container.go                             |  6 ++--
 pkg/trait/cron.go                                  | 25 +++++++++------
 pkg/trait/dependencies.go                          |  7 +++-
 pkg/trait/deployer.go                              |  7 +++-
 pkg/trait/deployment.go                            | 14 ++++++--
 pkg/trait/environment.go                           |  5 ++-
 pkg/trait/error_handler.go                         |  7 +++-
 pkg/trait/gc.go                                    |  7 +++-
 pkg/trait/health.go                                |  5 ++-
 pkg/trait/ingress.go                               |  7 +++-
 pkg/trait/init.go                                  |  9 ++++--
 pkg/trait/istio.go                                 |  7 +++-
 pkg/trait/jolokia.go                               | 11 +++++--
 pkg/trait/jvm.go                                   | 17 +++++++---
 pkg/trait/kamelets.go                              |  6 ++--
 pkg/trait/knative.go                               | 12 ++++---
 pkg/trait/knative_service.go                       |  8 +++--
 pkg/trait/logging.go                               |  5 ++-
 pkg/trait/mount.go                                 |  7 +++-
 pkg/trait/openapi.go                               | 11 +++++--
 pkg/trait/owner.go                                 |  7 +++-
 pkg/trait/pdb.go                                   |  7 +++-
 pkg/trait/platform.go                              |  7 +++-
 pkg/trait/pod.go                                   |  4 ++-
 pkg/trait/prometheus.go                            |  7 +++-
 pkg/trait/pull_secret.go                           |  7 +++-
 pkg/trait/quarkus.go                               | 14 ++++----
 pkg/trait/registry.go                              |  7 +++-
 pkg/trait/route.go                                 |  7 +++-
 pkg/trait/security_context.go                      |  5 +--
 pkg/trait/service.go                               |  9 ++++--
 pkg/trait/service_binding.go                       |  5 ++-
 pkg/trait/toleration.go                            |  7 +++-
 pkg/util/camel/camel_dependencies.go               |  2 ++
 pkg/util/io/io.go                                  | 28 ++++++++++++++++
 pkg/util/jvm/keystore.go                           |  6 +++-
 pkg/util/knative/uri.go                            |  1 +
 pkg/util/kubernetes/log/annotation_scraper.go      |  6 +++-
 pkg/util/maven/maven_command.go                    |  2 ++
 pkg/util/registry/registry.go                      |  4 ++-
 pkg/util/util.go                                   | 12 ++++---
 script/Makefile                                    |  4 +--
 74 files changed, 414 insertions(+), 120 deletions(-)

diff --git a/.golangci.yml b/.golangci.yml
index 21b1f5b97..02d8810a1 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -18,11 +18,47 @@
 linters-settings:
   lll:
     line-length: 170
+  mnd:
+    checks:
+      - argument
+      - case
+      - operation
+      - return
+      - assign
+    ignored-functions:
+      - '^len\.'
+      - '^strings\.SplitN$'
+      - '^matchOrEmpty$'
+      - '^make$'
+    ignored-files:
+      # ignore install files that are part of features being deprecated
+      # such ass install anc the kamel cli
+      #
+      # files are individually listed as if any new file is added or those not 
listed here are amended
+      # then best practices must be followed
+      - 'pkg/install/cluster.go'
+      - 'pkg/cmd/install.go'
+      - 'pkg/cmd/debug.go'
+      - 'pkg/cmd/describe.go'
+      - 'pkg/cmd/describe_integration.go'
+      - 'pkg/cmd/describe_kamelet.go'
+      - 'pkg/cmd/dump.go'
+      - 'pkg/cmd/get.go'
+      - 'pkg/cmd/install.go'
+      - 'pkg/cmd/log.go'
+      - 'pkg/cmd/kamelet_get.go'
+      - 'pkg/cmd/kit_get.go'
+      - 'pkg/cmd/uninstall.go'
+      - 'pkg/cmd/run_support.go'
+      # seems to be used only by the "kamel cli" command
+      - 'pkg/util/kubernetes/log/pod_scraper.go'
+      - 'pkg/util/indentedwriter/writer.go'
 run:
   tests: false
 issues:
   exclude-files:
     - test_support.go
+
 linters:
   enable-all: true
   disable:
@@ -62,6 +98,5 @@ linters:
     - execinquery
     # TODO: too much work at this stage as many files are impacted by the lint 
suggestions, however the reported
     #       lint violation make a lot of sense so we should re-enable the 
lints below and work to fix the findings
-    - mnd
     - perfsprint
     - goconst
diff --git a/addons/keda/duck/v1alpha1/zz_generated.deepcopy.go 
b/addons/keda/duck/v1alpha1/zz_generated.deepcopy.go
index 7bbeb3f44..6eac54df6 100644
--- a/addons/keda/duck/v1alpha1/zz_generated.deepcopy.go
+++ b/addons/keda/duck/v1alpha1/zz_generated.deepcopy.go
@@ -6,7 +6,7 @@
 package v1alpha1
 
 import (
-       "k8s.io/api/core/v1"
+       v1 "k8s.io/api/core/v1"
        "k8s.io/apimachinery/pkg/runtime"
 )
 
diff --git a/cmd/util/json-schema-gen/main.go b/cmd/util/json-schema-gen/main.go
index 5ddb32932..c81652522 100644
--- a/cmd/util/json-schema-gen/main.go
+++ b/cmd/util/json-schema-gen/main.go
@@ -25,6 +25,8 @@ import (
        "reflect"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        "github.com/apache/camel-k/v2/pkg/util"
 
        apiextensionsv1 
"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
@@ -99,7 +101,7 @@ func generate(crdFilename, dslFilename, path string, isArray 
bool, destination s
        if err != nil {
                return err
        }
-       return os.WriteFile(destination, result, 0o600)
+       return os.WriteFile(destination, result, io.FilePerm600)
 }
 
 func remapRef(ref string) string {
diff --git a/e2e/advanced/deployment_test.go b/e2e/advanced/deployment_test.go
index ba3b93192..6821b26b7 100644
--- a/e2e/advanced/deployment_test.go
+++ b/e2e/advanced/deployment_test.go
@@ -26,9 +26,10 @@ import (
        "context"
        "testing"
 
+       "os/exec"
+
        . "github.com/onsi/gomega"
        corev1 "k8s.io/api/core/v1"
-       "os/exec"
 
        . "github.com/apache/camel-k/v2/e2e/support"
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
diff --git a/e2e/advanced/dump_test.go b/e2e/advanced/dump_test.go
index 37b5e0bcc..fd9b5c4af 100644
--- a/e2e/advanced/dump_test.go
+++ b/e2e/advanced/dump_test.go
@@ -25,9 +25,10 @@ package advanced
 import (
        "context"
        "fmt"
-       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        "testing"
 
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+
        . "github.com/onsi/gomega"
 
        corev1 "k8s.io/api/core/v1"
diff --git a/e2e/install/cli/uninstall_test.go 
b/e2e/install/cli/uninstall_test.go
index f50b8bbd3..ee38cac6d 100644
--- a/e2e/install/cli/uninstall_test.go
+++ b/e2e/install/cli/uninstall_test.go
@@ -25,11 +25,12 @@ package cli
 import (
        "context"
        "fmt"
-       . "github.com/onsi/gomega"
        "testing"
 
+       . "github.com/onsi/gomega"
+
        . "github.com/apache/camel-k/v2/e2e/support"
-       "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        "github.com/apache/camel-k/v2/pkg/util/olm"
 )
 
diff --git a/e2e/knative/gc_test.go b/e2e/knative/gc_test.go
index d6f0a8457..f5e7e64fa 100644
--- a/e2e/knative/gc_test.go
+++ b/e2e/knative/gc_test.go
@@ -24,9 +24,10 @@ package knative
 
 import (
        "context"
+       "testing"
+
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        corev1 "k8s.io/api/core/v1"
-       "testing"
 
        . "github.com/apache/camel-k/v2/e2e/support"
        . "github.com/onsi/gomega"
diff --git a/e2e/knative/openapi_test.go b/e2e/knative/openapi_test.go
index 4b58e1daa..e09dde16b 100644
--- a/e2e/knative/openapi_test.go
+++ b/e2e/knative/openapi_test.go
@@ -26,10 +26,11 @@ import (
        "context"
        "testing"
 
+       "io/ioutil"
+
        . "github.com/apache/camel-k/v2/e2e/support"
        . "github.com/onsi/gomega"
        "github.com/stretchr/testify/require"
-       "io/ioutil"
 )
 
 func TestOpenAPIService(t *testing.T) {
diff --git a/e2e/native/native_binding_test.go 
b/e2e/native/native_binding_test.go
index b4af7a4b2..bb7aeb6e8 100644
--- a/e2e/native/native_binding_test.go
+++ b/e2e/native/native_binding_test.go
@@ -24,11 +24,12 @@ package native
 
 import (
        "context"
+       "testing"
+
        . "github.com/apache/camel-k/v2/e2e/support"
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        . "github.com/onsi/gomega"
        corev1 "k8s.io/api/core/v1"
-       "testing"
 )
 
 func TestNativeBinding(t *testing.T) {
diff --git a/e2e/support/test_util.go b/e2e/support/test_util.go
index d110c34f8..188ca0eaa 100644
--- a/e2e/support/test_util.go
+++ b/e2e/support/test_util.go
@@ -24,12 +24,13 @@ package support
 
 import (
        "context"
-       "github.com/apache/camel-k/v2/pkg/util/log"
        "os"
        "os/exec"
        "strings"
        "testing"
 
+       "github.com/apache/camel-k/v2/pkg/util/log"
+
        . "github.com/onsi/gomega"
        "github.com/onsi/gomega/gexec"
        . "github.com/onsi/gomega/gstruct"
diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
index c8c03773e..24d07ba99 100644
--- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
@@ -6,7 +6,7 @@
 package trait
 
 import (
-       "k8s.io/api/core/v1"
+       v1 "k8s.io/api/core/v1"
        networkingv1 "k8s.io/api/networking/v1"
        "k8s.io/apimachinery/pkg/util/intstr"
 )
diff --git a/pkg/apis/camel/v1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/zz_generated.deepcopy.go
index 67149a356..27dc283d1 100644
--- a/pkg/apis/camel/v1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/zz_generated.deepcopy.go
@@ -7,6 +7,7 @@ package v1
 
 import (
        "encoding/json"
+
        "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
        corev1 "k8s.io/api/core/v1"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
diff --git a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
index ee2885294..41c08cc1b 100644
--- a/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1alpha1/zz_generated.deepcopy.go
@@ -7,7 +7,8 @@ package v1alpha1
 
 import (
        "encoding/json"
-       "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
+
+       v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        corev1 "k8s.io/api/core/v1"
        "k8s.io/apimachinery/pkg/runtime"
 )
diff --git a/pkg/builder/image.go b/pkg/builder/image.go
index a3abe1757..25d7de5b4 100644
--- a/pkg/builder/image.go
+++ b/pkg/builder/image.go
@@ -22,6 +22,8 @@ import (
        "path"
        "path/filepath"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        "k8s.io/apimachinery/pkg/labels"
        "k8s.io/apimachinery/pkg/selection"
 
@@ -88,7 +90,7 @@ func executableDockerfile(ctx *builderContext) error {
                USER nonroot
        `)
 
-       err := os.WriteFile(filepath.Join(ctx.Path, ContextDir, "Dockerfile"), 
dockerfile, 0o400)
+       err := os.WriteFile(filepath.Join(ctx.Path, ContextDir, "Dockerfile"), 
dockerfile, io.FilePerm400)
        if err != nil {
                return err
        }
@@ -112,7 +114,7 @@ func jvmDockerfile(ctx *builderContext) error {
                USER 1000
        `)
 
-       err := os.WriteFile(filepath.Join(ctx.Path, ContextDir, "Dockerfile"), 
dockerfile, 0o400)
+       err := os.WriteFile(filepath.Join(ctx.Path, ContextDir, "Dockerfile"), 
dockerfile, io.FilePerm400)
        if err != nil {
                return err
        }
@@ -154,7 +156,7 @@ func imageContext(ctx *builderContext, selector 
artifactsSelector) error {
 
        contextDir := filepath.Join(ctx.Path, ContextDir)
 
-       err = os.MkdirAll(contextDir, 0o700)
+       err = os.MkdirAll(contextDir, io.FilePerm700)
        if err != nil {
                return err
        }
diff --git a/pkg/builder/project.go b/pkg/builder/project.go
index 41e44263e..84a39735c 100644
--- a/pkg/builder/project.go
+++ b/pkg/builder/project.go
@@ -25,6 +25,8 @@ import (
        "regexp"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        "github.com/apache/camel-k/v2/pkg/util/camel"
        "github.com/apache/camel-k/v2/pkg/util/jvm"
@@ -57,6 +59,7 @@ type projectSteps struct {
        CommonSteps []Step
 }
 
+//nolint:mnd
 var Project = projectSteps{
        CleanUpBuildDir:         NewStep(ProjectGenerationPhase-1, 
cleanUpBuildDir),
        GenerateJavaKeystore:    NewStep(ProjectGenerationPhase, 
generateJavaKeystore),
@@ -76,7 +79,7 @@ func cleanUpBuildDir(ctx *builderContext) error {
                return err
        }
 
-       return os.MkdirAll(ctx.Build.BuildDir, 0o700)
+       return os.MkdirAll(ctx.Build.BuildDir, io.FilePerm700)
 }
 
 func generateJavaKeystore(ctx *builderContext) error {
diff --git a/pkg/builder/quarkus.go b/pkg/builder/quarkus.go
index 3c074f540..49611466b 100644
--- a/pkg/builder/quarkus.go
+++ b/pkg/builder/quarkus.go
@@ -24,6 +24,8 @@ import (
        "path/filepath"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
        "github.com/apache/camel-k/v2/pkg/util/camel"
        "github.com/apache/camel-k/v2/pkg/util/defaults"
@@ -221,7 +223,7 @@ func BuildQuarkusRunnerCommon(ctx context.Context, mc 
maven.Context, project mav
 }
 
 func computeApplicationProperties(appPropertiesPath string, 
applicationProperties map[string]string) error {
-       f, err := os.OpenFile(appPropertiesPath, 
os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
+       f, err := os.OpenFile(appPropertiesPath, 
os.O_APPEND|os.O_CREATE|os.O_WRONLY, io.FilePerm644)
        if err != nil {
                return fmt.Errorf("failure while opening/creating 
application.properties: %w", err)
        }
diff --git a/pkg/cmd/builder/builder.go b/pkg/cmd/builder/builder.go
index 7252fd89d..58d95c02a 100644
--- a/pkg/cmd/builder/builder.go
+++ b/pkg/cmd/builder/builder.go
@@ -25,6 +25,8 @@ import (
        "runtime"
        "syscall"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        "k8s.io/apimachinery/pkg/types"
 
        ctrl "sigs.k8s.io/controller-runtime/pkg/client"
@@ -104,7 +106,7 @@ func exitOnError(err error, msg string) {
 
 func writeTerminationMessage(message string) {
        // #nosec G306
-       err := os.WriteFile(terminationMessagePath, []byte(message), 0o644)
+       err := os.WriteFile(terminationMessagePath, []byte(message), 
io.FilePerm644)
        if err != nil {
                log.Error(err, "cannot write termination message")
        }
diff --git a/pkg/cmd/operator.go b/pkg/cmd/operator.go
index f46a6dac1..f474abe1a 100644
--- a/pkg/cmd/operator.go
+++ b/pkg/cmd/operator.go
@@ -24,7 +24,11 @@ import (
        "github.com/spf13/cobra"
 )
 
-const operatorCommand = "operator"
+const (
+       operatorCommand       = "operator"
+       defaultHealthPort     = 8081
+       defaultMonitoringPort = 8080
+)
 
 func newCmdOperator(rootCmdOptions *RootCmdOptions) (*cobra.Command, 
*operatorCmdOptions) {
        options := operatorCmdOptions{}
@@ -38,8 +42,8 @@ func newCmdOperator(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *operatorCm
                Run:     options.run,
        }
 
-       cmd.Flags().Int32("health-port", 8081, "The port of the health 
endpoint")
-       cmd.Flags().Int32("monitoring-port", 8080, "The port of the metrics 
endpoint")
+       cmd.Flags().Int32("health-port", defaultHealthPort, "The port of the 
health endpoint")
+       cmd.Flags().Int32("monitoring-port", defaultMonitoringPort, "The port 
of the metrics endpoint")
        cmd.Flags().Bool("leader-election", true, "Use leader election")
        cmd.Flags().String("leader-election-id", "", "Use the given ID as the 
leader election Lease name")
 
diff --git a/pkg/cmd/util_config.go b/pkg/cmd/util_config.go
index 6212426f3..ce4a5d52f 100644
--- a/pkg/cmd/util_config.go
+++ b/pkg/cmd/util_config.go
@@ -23,6 +23,8 @@ import (
        "reflect"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        "github.com/apache/camel-k/v2/pkg/util"
        p "github.com/gertd/go-pluralize"
 
@@ -147,7 +149,7 @@ func (cfg *Config) Delete(path string) {
 func (cfg *Config) Save() error {
        root := filepath.Dir(cfg.location)
        if _, err := os.Stat(root); os.IsNotExist(err) {
-               if e := os.MkdirAll(root, 0o600); e != nil {
+               if e := os.MkdirAll(root, io.FilePerm600); e != nil {
                        return e
                }
        }
@@ -156,7 +158,7 @@ func (cfg *Config) Save() error {
        if err != nil {
                return err
        }
-       return os.WriteFile(cfg.location, data, 0o600)
+       return os.WriteFile(cfg.location, data, io.FilePerm600)
 }
 
 func (cfg *Config) navigate(values map[string]interface{}, prefix string, 
create bool) map[string]interface{} {
diff --git a/pkg/controller/build/build_controller.go 
b/pkg/controller/build/build_controller.go
index 48dce5894..4c95574e4 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -39,6 +39,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/monitoring"
 )
 
+const (
+       requeueAfterDuration    = 5 * time.Second
+       podRequeueAfterDuration = 1 * time.Second
+)
+
 // Add creates a new Build Controller and adds it to the Manager. The Manager 
will set fields on the Controller
 // and Start it when the Manager is Started.
 func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
@@ -224,13 +229,13 @@ func (r *reconcileBuild) Reconcile(ctx context.Context, 
request reconcile.Reques
 
        if target.Status.Phase == v1.BuildPhaseScheduling || 
target.Status.Phase == v1.BuildPhaseFailed {
                // Requeue scheduling (resp. failed) build so that it re-enters 
the build (resp. recovery) working queue
-               return reconcile.Result{RequeueAfter: 5 * time.Second}, nil
+               return reconcile.Result{RequeueAfter: requeueAfterDuration}, nil
        }
 
        if target.BuilderConfiguration().Strategy == v1.BuildStrategyPod &&
                (target.Status.Phase == v1.BuildPhasePending || 
target.Status.Phase == v1.BuildPhaseRunning) {
                // Requeue running Build to poll Pod and signal timeout
-               return reconcile.Result{RequeueAfter: 1 * time.Second}, nil
+               return reconcile.Result{RequeueAfter: podRequeueAfterDuration}, 
nil
        }
 
        return reconcile.Result{}, nil
diff --git a/pkg/controller/build/recovery.go b/pkg/controller/build/recovery.go
index 55ab7698c..8fac2f177 100644
--- a/pkg/controller/build/recovery.go
+++ b/pkg/controller/build/recovery.go
@@ -28,13 +28,20 @@ import (
        v1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1"
 )
 
+const (
+       defaultRecoveryBackoffMinDuration = 5 * time.Second
+       defaultRecoveryBackoffMaxDuration = 1 * time.Second
+       defaultRecoveryBackoffFactor      = 2
+       defaultRecoveryMaxAttempt         = 5
+)
+
 func newErrorRecoveryAction() Action {
        // TODO: externalize options
        return &errorRecoveryAction{
                backOff: backoff.Backoff{
-                       Min:    5 * time.Second,
-                       Max:    1 * time.Minute,
-                       Factor: 2,
+                       Min:    defaultRecoveryBackoffMinDuration,
+                       Max:    defaultRecoveryBackoffMaxDuration,
+                       Factor: defaultRecoveryBackoffFactor,
                        Jitter: false,
                },
        }
@@ -59,8 +66,7 @@ func (action *errorRecoveryAction) Handle(ctx 
context.Context, build *v1.Build)
                        Reason: build.Status.Error,
                        Time:   metav1.Now(),
                        Recovery: v1.FailureRecovery{
-                               Attempt:    0,
-                               AttemptMax: 5,
+                               AttemptMax: defaultRecoveryMaxAttempt,
                        },
                }
                return build, nil
diff --git a/pkg/controller/catalog/catalog_controller.go 
b/pkg/controller/catalog/catalog_controller.go
index 6957bc297..b0bcfb79c 100644
--- a/pkg/controller/catalog/catalog_controller.go
+++ b/pkg/controller/catalog/catalog_controller.go
@@ -41,6 +41,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/monitoring"
 )
 
+const (
+       requeueAfterDuration = 5 * time.Second
+)
+
 // Add creates a new Catalog Controller and adds it to the Manager. The 
Manager will set fields on the Controller
 // and Start it when the Manager is Started.
 func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
@@ -205,6 +209,6 @@ func (r *reconcileCatalog) Reconcile(ctx context.Context, 
request reconcile.Requ
 
        // Requeue
        return reconcile.Result{
-               RequeueAfter: 5 * time.Second,
+               RequeueAfter: requeueAfterDuration,
        }, nil
 }
diff --git a/pkg/controller/integrationkit/build.go 
b/pkg/controller/integrationkit/build.go
index b68c63c66..1a537c049 100644
--- a/pkg/controller/integrationkit/build.go
+++ b/pkg/controller/integrationkit/build.go
@@ -37,6 +37,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/kubernetes"
 )
 
+const (
+       buildTimeout = 10 * time.Minute
+)
+
 // NewBuildAction creates a new build request handling action for the kit.
 func NewBuildAction() Action {
        return &buildAction{}
@@ -112,7 +116,7 @@ func (action *buildAction) handleBuildSubmitted(ctx 
context.Context, kit *v1.Int
                if layout := labels[v1.IntegrationKitLayoutLabel]; 
env.Platform.Spec.Build.Timeout == nil && layout == 
v1.IntegrationKitLayoutNativeSources {
                        // Increase the timeout to a sensible default
                        timeout = metav1.Duration{
-                               Duration: 10 * time.Minute,
+                               Duration: buildTimeout,
                        }
                }
 
diff --git a/pkg/controller/integrationkit/integrationkit_controller.go 
b/pkg/controller/integrationkit/integrationkit_controller.go
index b1431fa3a..9df46854c 100644
--- a/pkg/controller/integrationkit/integrationkit_controller.go
+++ b/pkg/controller/integrationkit/integrationkit_controller.go
@@ -45,6 +45,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/monitoring"
 )
 
+const (
+       requeueAfterDuration = 2 * time.Second
+)
+
 // Add creates a new IntegrationKit Controller and adds it to the Manager. The 
Manager will set fields on the Controller
 // and Start it when the Manager is Started.
 func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
@@ -316,7 +320,7 @@ func (r *reconcileIntegrationKit) Reconcile(ctx 
context.Context, request reconci
        if targetPhase == v1.IntegrationKitPhaseWaitingForCatalog {
                // Requeue
                return reconcile.Result{
-                       RequeueAfter: 2 * time.Second,
+                       RequeueAfter: requeueAfterDuration,
                }, nil
        }
 
diff --git 
a/pkg/controller/integrationplatform/integrationplatform_controller.go 
b/pkg/controller/integrationplatform/integrationplatform_controller.go
index 3ae36d8d6..00ba04f03 100644
--- a/pkg/controller/integrationplatform/integrationplatform_controller.go
+++ b/pkg/controller/integrationplatform/integrationplatform_controller.go
@@ -41,6 +41,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/monitoring"
 )
 
+const (
+       requeueAfterDuration = 5 * time.Second
+)
+
 // Add creates a new IntegrationPlatform Controller and adds it to the 
Manager. The Manager will set fields
 // on the Controller and Start it when the Manager is Started.
 func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
@@ -213,6 +217,6 @@ func (r *reconcileIntegrationPlatform) Reconcile(ctx 
context.Context, request re
 
        // Requeue
        return reconcile.Result{
-               RequeueAfter: 5 * time.Second,
+               RequeueAfter: requeueAfterDuration,
        }, nil
 }
diff --git a/pkg/controller/integrationprofile/integrationprofile_controller.go 
b/pkg/controller/integrationprofile/integrationprofile_controller.go
index 7cee70007..68569230e 100644
--- a/pkg/controller/integrationprofile/integrationprofile_controller.go
+++ b/pkg/controller/integrationprofile/integrationprofile_controller.go
@@ -41,6 +41,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/monitoring"
 )
 
+const (
+       requeueAfterDuration = 5 * time.Second
+)
+
 // Add creates a new IntegrationProfile Controller and adds it to the Manager. 
The Manager will set fields
 // on the Controller and Start it when the Manager is Started.
 func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
@@ -211,6 +215,6 @@ func (r *reconcileIntegrationProfile) Reconcile(ctx 
context.Context, request rec
 
        // Requeue
        return reconcile.Result{
-               RequeueAfter: 5 * time.Second,
+               RequeueAfter: requeueAfterDuration,
        }, nil
 }
diff --git a/pkg/install/cluster.go b/pkg/install/cluster.go
index ba54fe737..da21b7bae 100644
--- a/pkg/install/cluster.go
+++ b/pkg/install/cluster.go
@@ -295,6 +295,9 @@ func WaitForAllCrdInstallation(ctx context.Context, 
clientProvider client.Provid
        }
 }
 
+// TODO those error codes are a little bit obscure, what do they mean ? it 
would be better to return an custom error
+//
+//nolint:mnd
 func areAllCrdInstalled(c client.Client) (int, error) {
        if ok, err := isCrdInstalled(c, "IntegrationPlatform", "v1"); err != 
nil {
                return 1, fmt.Errorf("error installing IntegrationPlatform 
CRDs: %w", err)
diff --git a/pkg/kamelet/repository/repository.go 
b/pkg/kamelet/repository/repository.go
index f169df226..996564151 100644
--- a/pkg/kamelet/repository/repository.go
+++ b/pkg/kamelet/repository/repository.go
@@ -144,6 +144,7 @@ func newFromURI(ctx context.Context, uri string) 
(KameletRepository, error) {
                owner := parts[0]
                repo := parts[1]
                var path string
+
                if len(parts) >= 3 {
                        path = strings.Join(parts[2:], "/")
                }
diff --git a/pkg/platform/defaults.go b/pkg/platform/defaults.go
index 44f304c94..2e4222adf 100644
--- a/pkg/platform/defaults.go
+++ b/pkg/platform/defaults.go
@@ -42,8 +42,11 @@ import (
        image "github.com/apache/camel-k/v2/pkg/util/registry"
 )
 
-// BuilderServiceAccount --.
-const BuilderServiceAccount = "camel-k-builder"
+const (
+       BuilderServiceAccount = "camel-k-builder"
+
+       defaultBuildTimeout = 5 * time.Minute
+)
 
 // ConfigureDefaults fills with default values all missing details about the 
integration platform.
 // Defaults are set in the status fields, not in the spec.
@@ -325,7 +328,7 @@ func setPlatformDefaults(p *v1.IntegrationPlatform, verbose 
bool) error {
        // Build timeout
        if p.Status.Build.GetTimeout().Duration == 0 {
                p.Status.Build.Timeout = &metav1.Duration{
-                       Duration: 5 * time.Minute,
+                       Duration: defaultBuildTimeout,
                }
        } else {
                d := p.Status.Build.GetTimeout().Duration.Truncate(time.Second)
diff --git a/pkg/trait/affinity.go b/pkg/trait/affinity.go
index d3fad6cea..373d7cb9e 100644
--- a/pkg/trait/affinity.go
+++ b/pkg/trait/affinity.go
@@ -31,6 +31,11 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       affinityTraitID    = "affinity"
+       affinityTraitOrder = 1500
+)
+
 type affinityTrait struct {
        BaseTrait
        traitv1.AffinityTrait `property:",squash"`
@@ -38,7 +43,7 @@ type affinityTrait struct {
 
 func newAffinityTrait() Trait {
        return &affinityTrait{
-               BaseTrait: NewBaseTrait("affinity", 1500),
+               BaseTrait: NewBaseTrait(affinityTraitID, affinityTraitOrder),
                AffinityTrait: traitv1.AffinityTrait{
                        PodAffinity:     pointer.Bool(false),
                        PodAntiAffinity: pointer.Bool(false),
diff --git a/pkg/trait/builder.go b/pkg/trait/builder.go
index afbc66688..a97d41f71 100644
--- a/pkg/trait/builder.go
+++ b/pkg/trait/builder.go
@@ -36,7 +36,8 @@ import (
 )
 
 const (
-       builderTraitID = "builder"
+       builderTraitID    = "builder"
+       builderTraitOrder = 600
 )
 
 var commandsRegexp = regexp.MustCompile(`"[^"]+"|[\w/-]+`)
@@ -48,7 +49,7 @@ type builderTrait struct {
 
 func newBuilderTrait() Trait {
        return &builderTrait{
-               BasePlatformTrait: NewBasePlatformTrait("builder", 600),
+               BasePlatformTrait: NewBasePlatformTrait(builderTraitID, 
builderTraitOrder),
        }
 }
 
diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index 8902d24ad..080976fc9 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -35,6 +35,8 @@ import (
 
 const (
        CamelPropertiesType = "camel-properties"
+       camelTraitID        = "camel"
+       camelTraitOrder     = 200
 )
 
 type camelTrait struct {
@@ -44,7 +46,7 @@ type camelTrait struct {
 
 func newCamelTrait() Trait {
        return &camelTrait{
-               BasePlatformTrait: NewBasePlatformTrait("camel", 200),
+               BasePlatformTrait: NewBasePlatformTrait(camelTraitID, 
camelTraitOrder),
        }
 }
 
diff --git a/pkg/trait/container.go b/pkg/trait/container.go
index 788f3c95e..1a217ef06 100644
--- a/pkg/trait/container.go
+++ b/pkg/trait/container.go
@@ -43,7 +43,9 @@ import (
 )
 
 const (
-       containerTraitID     = "container"
+       containerTraitID    = "container"
+       containerTraitOrder = 1600
+
        defaultContainerName = "integration"
        defaultContainerPort = 8080
        defaultServicePort   = 80
@@ -61,7 +63,7 @@ type containerTrait struct {
 
 func newContainerTrait() Trait {
        return &containerTrait{
-               BasePlatformTrait: NewBasePlatformTrait(containerTraitID, 1600),
+               BasePlatformTrait: NewBasePlatformTrait(containerTraitID, 
containerTraitOrder),
                ContainerTrait: traitv1.ContainerTrait{
                        Port:                     defaultContainerPort,
                        ServicePort:              defaultServicePort,
diff --git a/pkg/trait/cron.go b/pkg/trait/cron.go
index 67bbd7efb..4eee0a46c 100644
--- a/pkg/trait/cron.go
+++ b/pkg/trait/cron.go
@@ -36,6 +36,17 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/uri"
 )
 
+const (
+       cronTraitID               = "cron"
+       cronTraitOrder            = 1000
+       cronStrategySelectorOrder = 1000
+
+       defaultCronActiveDeadlineSeconds   = int64(60)
+       defaultCronBackoffLimit            = int32(2)
+       genericCronComponent               = "cron"
+       genericCronComponentFallbackScheme = "quartz"
+)
+
 type cronTrait struct {
        BaseTrait
        traitv1.CronTrait `property:",squash"`
@@ -52,11 +63,6 @@ type cronInfo struct {
 // cronExtractor extracts cron information from a Camel URI.
 type cronExtractor func(string) *cronInfo
 
-const (
-       genericCronComponent               = "cron"
-       genericCronComponentFallbackScheme = "quartz"
-)
-
 var (
        camelTimerPeriodMillis = regexp.MustCompile(`^[0-9]+$`)
 
@@ -69,7 +75,7 @@ var (
 
 func newCronTrait() Trait {
        return &cronTrait{
-               BaseTrait: NewBaseTrait("cron", 1000),
+               BaseTrait: NewBaseTrait(cronTraitID, cronTraitOrder),
        }
 }
 
@@ -215,12 +221,12 @@ func (t *cronTrait) getCronJobFor(e *Environment) 
*batchv1.CronJob {
                }
        }
 
-       activeDeadline := int64(60)
+       activeDeadline := defaultCronActiveDeadlineSeconds
        if t.ActiveDeadlineSeconds != nil {
                activeDeadline = *t.ActiveDeadlineSeconds
        }
 
-       backoffLimit := int32(2)
+       backoffLimit := defaultCronBackoffLimit
        if t.BackoffLimit != nil {
                backoffLimit = *t.BackoffLimit
        }
@@ -285,7 +291,7 @@ func (t *cronTrait) SelectControllerStrategy(e 
*Environment) (*ControllerStrateg
 }
 
 func (t *cronTrait) ControllerStrategySelectorOrder() int {
-       return 1000
+       return cronStrategySelectorOrder
 }
 
 // Gathering cron information
@@ -380,6 +386,7 @@ func getCronForURI(camelURI string) *cronInfo {
 
 // timerToCronInfo converts a timer endpoint to a Kubernetes cron schedule
 
+//nolint:mnd
 func timerToCronInfo(camelURI string) *cronInfo {
        if uri.GetQueryParameter(camelURI, "delay") != "" ||
                uri.GetQueryParameter(camelURI, "repeatCount") != "" ||
diff --git a/pkg/trait/dependencies.go b/pkg/trait/dependencies.go
index b2dc4b7f9..b598f1293 100644
--- a/pkg/trait/dependencies.go
+++ b/pkg/trait/dependencies.go
@@ -27,6 +27,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/sets"
 )
 
+const (
+       dependenciesTraitID    = "dependencies"
+       dependenciesTraitOrder = 500
+)
+
 type dependenciesTrait struct {
        BasePlatformTrait
        traitv1.DependenciesTrait `property:",squash"`
@@ -34,7 +39,7 @@ type dependenciesTrait struct {
 
 func newDependenciesTrait() Trait {
        return &dependenciesTrait{
-               BasePlatformTrait: NewBasePlatformTrait("dependencies", 500),
+               BasePlatformTrait: NewBasePlatformTrait(dependenciesTraitID, 
dependenciesTraitOrder),
        }
 }
 
diff --git a/pkg/trait/deployer.go b/pkg/trait/deployer.go
index 6cab16078..754751722 100644
--- a/pkg/trait/deployer.go
+++ b/pkg/trait/deployer.go
@@ -35,6 +35,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/patch"
 )
 
+const (
+       deployerTraitID    = "deployer"
+       deployerTraitOrder = 900
+)
+
 type deployerTrait struct {
        BasePlatformTrait
        traitv1.DeployerTrait `property:",squash"`
@@ -46,7 +51,7 @@ var hasServerSideApply = true
 
 func newDeployerTrait() Trait {
        return &deployerTrait{
-               BasePlatformTrait: NewBasePlatformTrait("deployer", 900),
+               BasePlatformTrait: NewBasePlatformTrait(deployerTraitID, 
deployerTraitOrder),
        }
 }
 
diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index 600a843f0..2b071bb8d 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -30,6 +30,14 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       deploymentTraitID               = "deployment"
+       deploymentTraitOrder            = 1100
+       deploymentStrategySelectorOrder = 10000
+
+       defaultProgressDeadline = int32(60)
+)
+
 type deploymentTrait struct {
        BasePlatformTrait
        traitv1.DeploymentTrait `property:",squash"`
@@ -39,7 +47,7 @@ var _ ControllerStrategySelector = &deploymentTrait{}
 
 func newDeploymentTrait() Trait {
        return &deploymentTrait{
-               BasePlatformTrait: NewBasePlatformTrait("deployment", 1100),
+               BasePlatformTrait: NewBasePlatformTrait(deploymentTraitID, 
deploymentTraitOrder),
        }
 }
 
@@ -84,7 +92,7 @@ func (t *deploymentTrait) SelectControllerStrategy(e 
*Environment) (*ControllerS
 }
 
 func (t *deploymentTrait) ControllerStrategySelectorOrder() int {
-       return 10000
+       return deploymentStrategySelectorOrder
 }
 
 func (t *deploymentTrait) Apply(e *Environment) error {
@@ -110,7 +118,7 @@ func (t *deploymentTrait) getDeploymentFor(e *Environment) 
*appsv1.Deployment {
                }
        }
 
-       deadline := int32(60)
+       deadline := defaultProgressDeadline
        if t.ProgressDeadlineSeconds != nil {
                deadline = *t.ProgressDeadlineSeconds
        }
diff --git a/pkg/trait/environment.go b/pkg/trait/environment.go
index 760f6e34e..677e8e043 100644
--- a/pkg/trait/environment.go
+++ b/pkg/trait/environment.go
@@ -35,6 +35,9 @@ type environmentTrait struct {
 }
 
 const (
+       environmentTraitID    = "environment"
+       environmentTraitOrder = 800
+
        envVarNamespace            = "NAMESPACE"
        envVarPodName              = "POD_NAME"
        envVarOperatorID           = "CAMEL_K_OPERATOR_ID"
@@ -54,7 +57,7 @@ const (
 
 func newEnvironmentTrait() Trait {
        return &environmentTrait{
-               BasePlatformTrait: NewBasePlatformTrait("environment", 800),
+               BasePlatformTrait: NewBasePlatformTrait(environmentTraitID, 
environmentTraitOrder),
                EnvironmentTrait: traitv1.EnvironmentTrait{
                        ContainerMeta: pointer.Bool(true),
                },
diff --git a/pkg/trait/error_handler.go b/pkg/trait/error_handler.go
index 829304073..3aa8c1c84 100644
--- a/pkg/trait/error_handler.go
+++ b/pkg/trait/error_handler.go
@@ -28,6 +28,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util"
 )
 
+const (
+       errorHandlerTraitID    = "error-handler"
+       errorHandlerTraitOrder = 470
+)
+
 type errorHandlerTrait struct {
        BasePlatformTrait
        traitv1.ErrorHandlerTrait `property:",squash"`
@@ -36,7 +41,7 @@ type errorHandlerTrait struct {
 func newErrorHandlerTrait() Trait {
        return &errorHandlerTrait{
                // NOTE: Must run before dependency trait
-               BasePlatformTrait: NewBasePlatformTrait("error-handler", 470),
+               BasePlatformTrait: NewBasePlatformTrait(errorHandlerTraitID, 
errorHandlerTraitOrder),
        }
 }
 
diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index 2670de3fd..cede57eb9 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -89,6 +89,11 @@ var (
        }
 )
 
+const (
+       gcTraitID    = "gc"
+       gcTraitOrder = 1200
+)
+
 type gcTrait struct {
        BaseTrait
        traitv1.GCTrait `property:",squash"`
@@ -96,7 +101,7 @@ type gcTrait struct {
 
 func newGCTrait() Trait {
        return &gcTrait{
-               BaseTrait: NewBaseTrait("gc", 1200),
+               BaseTrait: NewBaseTrait(gcTraitID, gcTraitOrder),
        }
 }
 
diff --git a/pkg/trait/health.go b/pkg/trait/health.go
index b2bd3558a..7c8d11132 100644
--- a/pkg/trait/health.go
+++ b/pkg/trait/health.go
@@ -31,6 +31,9 @@ import (
 )
 
 const (
+       healthTraitID    = "health"
+       healthTraitOrder = 1700
+
        defaultLivenessProbePath  = "/q/health/live"
        defaultReadinessProbePath = "/q/health/ready"
        defaultStartupProbePath   = "/q/health/started"
@@ -43,7 +46,7 @@ type healthTrait struct {
 
 func newHealthTrait() Trait {
        return &healthTrait{
-               BaseTrait: NewBaseTrait("health", 1700),
+               BaseTrait: NewBaseTrait(healthTraitID, healthTraitOrder),
                HealthTrait: traitv1.HealthTrait{
                        LivenessScheme:  string(corev1.URISchemeHTTP),
                        ReadinessScheme: string(corev1.URISchemeHTTP),
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index a9742cfbc..6c0fee962 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -30,6 +30,11 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       ingressTraitID    = "ingress"
+       ingressTraitOrder = 2400
+)
+
 type ingressTrait struct {
        BaseTrait
        traitv1.IngressTrait `property:",squash"`
@@ -37,7 +42,7 @@ type ingressTrait struct {
 
 func newIngressTrait() Trait {
        return &ingressTrait{
-               BaseTrait: NewBaseTrait("ingress", 2400),
+               BaseTrait: NewBaseTrait(ingressTraitID, ingressTraitOrder),
                IngressTrait: traitv1.IngressTrait{
                        Annotations: map[string]string{},
                        Host:        "",
diff --git a/pkg/trait/init.go b/pkg/trait/init.go
index a365f344e..7c9aff9cb 100644
--- a/pkg/trait/init.go
+++ b/pkg/trait/init.go
@@ -29,7 +29,12 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/dsl"
 )
 
-const flowsInternalSourceName = "camel-k-embedded-flow.yaml"
+const (
+       initTraitID    = "init"
+       initTraitOrder = 1
+
+       flowsInternalSourceName = "camel-k-embedded-flow.yaml"
+)
 
 type initTrait struct {
        BaseTrait
@@ -38,7 +43,7 @@ type initTrait struct {
 
 func NewInitTrait() Trait {
        return &initTrait{
-               BaseTrait: NewBaseTrait("init", 1),
+               BaseTrait: NewBaseTrait(initTraitID, initTraitOrder),
        }
 }
 
diff --git a/pkg/trait/istio.go b/pkg/trait/istio.go
index 86d4ea268..2951bf71d 100644
--- a/pkg/trait/istio.go
+++ b/pkg/trait/istio.go
@@ -28,6 +28,11 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       istioTraitID    = "istio"
+       istioTraitOrder = 2300
+)
+
 type istioTrait struct {
        BaseTrait
        traitv1.IstioTrait `property:",squash"`
@@ -40,7 +45,7 @@ const (
 
 func newIstioTrait() Trait {
        return &istioTrait{
-               BaseTrait: NewBaseTrait("istio", 2300),
+               BaseTrait: NewBaseTrait(istioTraitID, istioTraitOrder),
                IstioTrait: traitv1.IstioTrait{
                        Allow: "10.0.0.0/8,172.16.0.0/12,192.168.0.0/16",
                },
diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go
index fa79ffea7..9499eef0d 100644
--- a/pkg/trait/jolokia.go
+++ b/pkg/trait/jolokia.go
@@ -30,6 +30,13 @@ import (
        "github.com/apache/camel-k/v2/pkg/util"
 )
 
+const (
+       jolokiaTraitID    = "jolokia"
+       jolokiaTraitOrder = 1800
+
+       defaultJolokiaPort = 8778
+)
+
 type jolokiaTrait struct {
        BaseTrait
        traitv1.JolokiaTrait `property:",squash"`
@@ -37,9 +44,9 @@ type jolokiaTrait struct {
 
 func newJolokiaTrait() Trait {
        return &jolokiaTrait{
-               BaseTrait: NewBaseTrait("jolokia", 1800),
+               BaseTrait: NewBaseTrait(jolokiaTraitID, jolokiaTraitOrder),
                JolokiaTrait: traitv1.JolokiaTrait{
-                       Port: 8778,
+                       Port: defaultJolokiaPort,
                },
        }
 }
diff --git a/pkg/trait/jvm.go b/pkg/trait/jvm.go
index 06166a894..01d478852 100644
--- a/pkg/trait/jvm.go
+++ b/pkg/trait/jvm.go
@@ -41,7 +41,13 @@ import (
 )
 
 const (
-       jvmTraitID = "jvm"
+       jvmTraitID    = "jvm"
+       jvmTraitOrder = 2000
+
+       defaultMaxMemoryScale               = 6
+       defaultMaxMemoryPercentage          = int64(50)
+       lowMemoryThreshold                  = 300
+       lowMemoryMAxMemoryDefaultPercentage = int64(25)
 )
 
 type jvmTrait struct {
@@ -51,7 +57,7 @@ type jvmTrait struct {
 
 func newJvmTrait() Trait {
        return &jvmTrait{
-               BaseTrait: NewBaseTrait(jvmTraitID, 2000),
+               BaseTrait: NewBaseTrait(jvmTraitID, jvmTraitOrder),
                JVMTrait: traitv1.JVMTrait{
                        DebugAddress: "*:5005",
                        PrintCommand: pointer.Bool(true),
@@ -227,11 +233,12 @@ func (t *jvmTrait) Apply(e *Environment) error {
        // be performed in-container, based on CGroups memory resource control 
files.
        if memory, hasLimit := 
container.Resources.Limits[corev1.ResourceMemory]; !hasHeapSizeOption && 
hasLimit {
                // Simple heuristic that caps the maximum heap size to 50% of 
the memory limit
-               percentage := int64(50)
+               percentage := defaultMaxMemoryPercentage
                // Unless the memory limit is lower than 300M, in which case we 
leave more room for the non-heap memory
-               if resource.NewScaledQuantity(300, 6).Cmp(memory) > 0 {
-                       percentage = 25
+               if resource.NewScaledQuantity(lowMemoryThreshold, 
defaultMaxMemoryScale).Cmp(memory) > 0 {
+                       percentage = lowMemoryMAxMemoryDefaultPercentage
                }
+               //nolint:mnd
                memScaled := memory.ScaledValue(resource.Mega) * percentage / 
100
                args = append(args, fmt.Sprintf("-Xmx%dM", memScaled))
        }
diff --git a/pkg/trait/kamelets.go b/pkg/trait/kamelets.go
index 77df3baf2..f1b444680 100644
--- a/pkg/trait/kamelets.go
+++ b/pkg/trait/kamelets.go
@@ -41,7 +41,9 @@ import (
 )
 
 const (
-       kameletsTraitID             = "kamelets"
+       kameletsTraitID    = "kamelets"
+       kameletsTraitOrder = 450
+
        contentKey                  = "content"
        KameletLocationProperty     = "camel.component.kamelet.location"
        kameletLabel                = "camel.apache.org/kamelet"
@@ -68,7 +70,7 @@ type kameletsTrait struct {
 
 func newKameletsTrait() Trait {
        return &kameletsTrait{
-               BaseTrait: NewBaseTrait("kamelets", 450),
+               BaseTrait: NewBaseTrait(kameletsTraitID, kameletsTraitOrder),
        }
 }
 
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index a6a032a9d..d936630c7 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -44,18 +44,20 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/kubernetes"
 )
 
+const (
+       knativeTraitID       = "knative"
+       knativeTraitOrder    = 400
+       knativeHistoryHeader = "ce-knativehistory"
+)
+
 type knativeTrait struct {
        BaseTrait
        traitv1.KnativeTrait `property:",squash"`
 }
 
-const (
-       knativeHistoryHeader = "ce-knativehistory"
-)
-
 func newKnativeTrait() Trait {
        t := &knativeTrait{
-               BaseTrait: NewBaseTrait("knative", 400),
+               BaseTrait: NewBaseTrait(knativeTraitID, knativeTraitOrder),
        }
 
        return t
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index 0fee5f9da..38da720aa 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -35,7 +35,9 @@ import (
 )
 
 const (
-       knativeServiceTraitID = "knative-service"
+       knativeServiceTraitID               = "knative-service"
+       knativeServiceTraitOrder            = 1400
+       knativeServiceStrategySelectorOrder = 100
 
        // Auto-scaling annotations.
        knativeServingClassAnnotation    = "autoscaling.knative.dev/class"
@@ -58,7 +60,7 @@ var _ ControllerStrategySelector = &knativeServiceTrait{}
 
 func newKnativeServiceTrait() Trait {
        return &knativeServiceTrait{
-               BaseTrait: NewBaseTrait(knativeServiceTraitID, 1400),
+               BaseTrait: NewBaseTrait(knativeServiceTraitID, 
knativeServiceTraitOrder),
                KnativeServiceTrait: traitv1.KnativeServiceTrait{
                        Annotations: map[string]string{},
                },
@@ -173,7 +175,7 @@ func (t *knativeServiceTrait) SelectControllerStrategy(e 
*Environment) (*Control
 }
 
 func (t *knativeServiceTrait) ControllerStrategySelectorOrder() int {
-       return 100
+       return knativeServiceStrategySelectorOrder
 }
 
 func (t *knativeServiceTrait) getServiceFor(e *Environment) (*serving.Service, 
error) {
diff --git a/pkg/trait/logging.go b/pkg/trait/logging.go
index aaea69eee..0da531f19 100644
--- a/pkg/trait/logging.go
+++ b/pkg/trait/logging.go
@@ -25,6 +25,9 @@ import (
 )
 
 const (
+       loggingTraitID    = "logging"
+       loggingTraitOrder = 800
+
        envVarQuarkusConsoleColor     = "QUARKUS_CONSOLE_COLOR"
        envVarQuarkusLogLevel         = "QUARKUS_LOG_LEVEL"
        envVarQuarkusLogConsoleFormat = "QUARKUS_LOG_CONSOLE_FORMAT"
@@ -41,7 +44,7 @@ type loggingTrait struct {
 
 func newLoggingTraitTrait() Trait {
        return &loggingTrait{
-               BaseTrait: NewBaseTrait("logging", 800),
+               BaseTrait: NewBaseTrait(loggingTraitID, loggingTraitOrder),
                LoggingTrait: traitv1.LoggingTrait{
                        Level: defaultLogLevel,
                },
diff --git a/pkg/trait/mount.go b/pkg/trait/mount.go
index 6a1eef6bd..d999fbea0 100644
--- a/pkg/trait/mount.go
+++ b/pkg/trait/mount.go
@@ -35,6 +35,11 @@ import (
        utilResource "github.com/apache/camel-k/v2/pkg/util/resource"
 )
 
+const (
+       mountTraitID    = "mount"
+       mountTraitOrder = 1610
+)
+
 type mountTrait struct {
        BasePlatformTrait
        traitv1.MountTrait `property:",squash"`
@@ -43,7 +48,7 @@ type mountTrait struct {
 func newMountTrait() Trait {
        return &mountTrait{
                // Must follow immediately the container trait
-               BasePlatformTrait: NewBasePlatformTrait("mount", 1610),
+               BasePlatformTrait: NewBasePlatformTrait(mountTraitID, 
mountTraitOrder),
        }
 }
 
diff --git a/pkg/trait/openapi.go b/pkg/trait/openapi.go
index 1157b80a6..94772cb0c 100644
--- a/pkg/trait/openapi.go
+++ b/pkg/trait/openapi.go
@@ -26,6 +26,8 @@ import (
        "strconv"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        corev1 "k8s.io/api/core/v1"
        k8serrors "k8s.io/apimachinery/pkg/api/errors"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -44,6 +46,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/maven"
 )
 
+const (
+       openapiTraitID    = "openapi"
+       openapiTraitOrder = 300
+)
+
 type openAPITrait struct {
        BasePlatformTrait
        traitv1.OpenAPITrait `property:",squash"`
@@ -51,7 +58,7 @@ type openAPITrait struct {
 
 func newOpenAPITrait() Trait {
        return &openAPITrait{
-               BasePlatformTrait: NewBasePlatformTrait("openapi", 300),
+               BasePlatformTrait: NewBasePlatformTrait(openapiTraitID, 
openapiTraitOrder),
        }
 }
 
@@ -204,7 +211,7 @@ func (t *openAPITrait) createNewOpenAPIConfigMap(e 
*Environment, resource v1.Dat
        in := filepath.Join(tmpDir, resource.Name)
        out := filepath.Join(tmpDir, "openapi-dsl.xml")
 
-       err = os.WriteFile(in, content, 0o400)
+       err = os.WriteFile(in, content, io.FilePerm400)
        if err != nil {
                return err
        }
diff --git a/pkg/trait/owner.go b/pkg/trait/owner.go
index 3b5c8f428..591390e2f 100644
--- a/pkg/trait/owner.go
+++ b/pkg/trait/owner.go
@@ -28,6 +28,11 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       ownerTraitID    = "owner"
+       ownerTraitOrder = 2500
+)
+
 type ownerTrait struct {
        BaseTrait
        traitv1.OwnerTrait `property:",squash"`
@@ -35,7 +40,7 @@ type ownerTrait struct {
 
 func newOwnerTrait() Trait {
        return &ownerTrait{
-               BaseTrait: NewBaseTrait("owner", 2500),
+               BaseTrait: NewBaseTrait(ownerTraitID, ownerTraitOrder),
        }
 }
 
diff --git a/pkg/trait/pdb.go b/pkg/trait/pdb.go
index 94532a698..9ef25223f 100644
--- a/pkg/trait/pdb.go
+++ b/pkg/trait/pdb.go
@@ -29,6 +29,11 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const (
+       pdbTraitID    = "pdb"
+       pdbTraitOrder = 900
+)
+
 type pdbTrait struct {
        BaseTrait
        traitv1.PDBTrait `property:",squash"`
@@ -36,7 +41,7 @@ type pdbTrait struct {
 
 func newPdbTrait() Trait {
        return &pdbTrait{
-               BaseTrait: NewBaseTrait("pdb", 900),
+               BaseTrait: NewBaseTrait(pdbTraitID, pdbTraitOrder),
        }
 }
 
diff --git a/pkg/trait/platform.go b/pkg/trait/platform.go
index 5b69e69ee..397bc13fc 100644
--- a/pkg/trait/platform.go
+++ b/pkg/trait/platform.go
@@ -32,6 +32,11 @@ import (
        image "github.com/apache/camel-k/v2/pkg/util/registry"
 )
 
+const (
+       platformTraitID    = "platform"
+       platformTraitOrder = 100
+)
+
 type platformTrait struct {
        BasePlatformTrait
        traitv1.PlatformTrait `property:",squash"`
@@ -39,7 +44,7 @@ type platformTrait struct {
 
 func newPlatformTrait() Trait {
        return &platformTrait{
-               BasePlatformTrait: NewBasePlatformTrait("platform", 100),
+               BasePlatformTrait: NewBasePlatformTrait(platformTraitID, 
platformTraitOrder),
        }
 }
 
diff --git a/pkg/trait/pod.go b/pkg/trait/pod.go
index 12fc35df6..80fc15063 100644
--- a/pkg/trait/pod.go
+++ b/pkg/trait/pod.go
@@ -33,6 +33,8 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
 )
 
+const podTraitOrder = 1800
+
 type podTrait struct {
        BaseTrait
        traitv1.PodTrait `property:",squash"`
@@ -40,7 +42,7 @@ type podTrait struct {
 
 func newPodTrait() Trait {
        return &podTrait{
-               BaseTrait: NewBaseTrait("pod", 1800),
+               BaseTrait: NewBaseTrait("pod", podTraitOrder),
        }
 }
 
diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go
index 8612dc859..c4b45427d 100644
--- a/pkg/trait/prometheus.go
+++ b/pkg/trait/prometheus.go
@@ -31,6 +31,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util"
 )
 
+const (
+       prometheusTraitID    = "prometheus"
+       prometheusTraitOrder = 1900
+)
+
 type prometheusTrait struct {
        BaseTrait
        traitv1.PrometheusTrait `property:",squash"`
@@ -38,7 +43,7 @@ type prometheusTrait struct {
 
 func newPrometheusTrait() Trait {
        return &prometheusTrait{
-               BaseTrait: NewBaseTrait("prometheus", 1900),
+               BaseTrait: NewBaseTrait(prometheusTraitID, 
prometheusTraitOrder),
                PrometheusTrait: traitv1.PrometheusTrait{
                        PodMonitor: pointer.Bool(true),
                },
diff --git a/pkg/trait/pull_secret.go b/pkg/trait/pull_secret.go
index c2fb33a67..e04e81019 100644
--- a/pkg/trait/pull_secret.go
+++ b/pkg/trait/pull_secret.go
@@ -33,6 +33,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/openshift"
 )
 
+const (
+       pullSecretTraitID    = "pull-secret"
+       pullSecretTraitOrder = 1700
+)
+
 type pullSecretTrait struct {
        BaseTrait
        traitv1.PullSecretTrait `property:",squash"`
@@ -40,7 +45,7 @@ type pullSecretTrait struct {
 
 func newPullSecretTrait() Trait {
        return &pullSecretTrait{
-               BaseTrait: NewBaseTrait("pull-secret", 1700),
+               BaseTrait: NewBaseTrait(pullSecretTraitID, 
pullSecretTraitOrder),
        }
 }
 
diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index 28b44a382..0d8694e78 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -36,17 +36,17 @@ import (
 )
 
 const (
-       quarkusTraitID                    = "quarkus"
-       QuarkusNativeDefaultBaseImageName = 
"quay.io/quarkus/quarkus-micro-image:2.0"
-)
+       quarkusTraitID    = "quarkus"
+       quarkusTraitOrder = 1700
 
-type quarkusPackageType string
-
-const (
        fastJarPackageType       quarkusPackageType = "fast-jar"
        nativeSourcesPackageType quarkusPackageType = "native-sources"
+
+       QuarkusNativeDefaultBaseImageName = 
"quay.io/quarkus/quarkus-micro-image:2.0"
 )
 
+type quarkusPackageType string
+
 var kitPriority = map[quarkusPackageType]string{
        fastJarPackageType:       "1000",
        nativeSourcesPackageType: "2000",
@@ -100,7 +100,7 @@ func getLegacyLanguageSettings(language v1.Language) 
languageSettings {
 
 func newQuarkusTrait() Trait {
        return &quarkusTrait{
-               BasePlatformTrait: NewBasePlatformTrait(quarkusTraitID, 1700),
+               BasePlatformTrait: NewBasePlatformTrait(quarkusTraitID, 
quarkusTraitOrder),
        }
 }
 
diff --git a/pkg/trait/registry.go b/pkg/trait/registry.go
index 29c9c3497..cfb59dfdb 100644
--- a/pkg/trait/registry.go
+++ b/pkg/trait/registry.go
@@ -38,6 +38,11 @@ import (
        ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 )
 
+const (
+       registryTraitID    = "registry"
+       registryTraitOrder = 1650
+)
+
 type registryTrait struct {
        BaseTrait
        traitv1.RegistryTrait `property:",squash"`
@@ -45,7 +50,7 @@ type registryTrait struct {
 
 func newRegistryTrait() Trait {
        return &registryTrait{
-               BaseTrait: NewBaseTrait("registry", 1650),
+               BaseTrait: NewBaseTrait(registryTraitID, registryTraitOrder),
        }
 }
 
diff --git a/pkg/trait/route.go b/pkg/trait/route.go
index 80794c050..a95e9827d 100644
--- a/pkg/trait/route.go
+++ b/pkg/trait/route.go
@@ -34,6 +34,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/kubernetes"
 )
 
+const (
+       routeTraitID    = "route"
+       routeTraitOrder = 2200
+)
+
 type routeTrait struct {
        BaseTrait
        traitv1.RouteTrait `property:",squash"`
@@ -42,7 +47,7 @@ type routeTrait struct {
 
 func newRouteTrait() Trait {
        return &routeTrait{
-               BaseTrait: NewBaseTrait("route", 2200),
+               BaseTrait: NewBaseTrait(routeTraitID, routeTraitOrder),
                RouteTrait: traitv1.RouteTrait{
                        Annotations: map[string]string{},
                },
diff --git a/pkg/trait/security_context.go b/pkg/trait/security_context.go
index 0452d53d9..6e60fb070 100644
--- a/pkg/trait/security_context.go
+++ b/pkg/trait/security_context.go
@@ -29,7 +29,8 @@ import (
 )
 
 const (
-       securityContextTraitID = "security-context"
+       securityContextTraitID   = "security-context"
+       securityContextTraitOder = 1600
 
        defaultPodRunAsNonRoot       = false
        defaultPodSeccompProfileType = corev1.SeccompProfileTypeRuntimeDefault
@@ -42,7 +43,7 @@ type securityContextTrait struct {
 
 func newSecurityContextTrait() Trait {
        return &securityContextTrait{
-               BasePlatformTrait: NewBasePlatformTrait(securityContextTraitID, 
1600),
+               BasePlatformTrait: NewBasePlatformTrait(securityContextTraitID, 
securityContextTraitOder),
                SecurityContextTrait: traitv1.SecurityContextTrait{
                        RunAsNonRoot:       
pointer.Bool(defaultPodRunAsNonRoot),
                        SeccompProfileType: defaultPodSeccompProfileType,
diff --git a/pkg/trait/service.go b/pkg/trait/service.go
index 515133658..50fc30b6d 100644
--- a/pkg/trait/service.go
+++ b/pkg/trait/service.go
@@ -30,16 +30,19 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/kubernetes"
 )
 
+const (
+       serviceTraitID    = "service"
+       serviceTraitOrder = 1500
+)
+
 type serviceTrait struct {
        BaseTrait
        traitv1.ServiceTrait `property:",squash"`
 }
 
-const serviceTraitID = "service"
-
 func newServiceTrait() Trait {
        return &serviceTrait{
-               BaseTrait: NewBaseTrait(serviceTraitID, 1500),
+               BaseTrait: NewBaseTrait(serviceTraitID, serviceTraitOrder),
        }
 }
 
diff --git a/pkg/trait/service_binding.go b/pkg/trait/service_binding.go
index 2ed176670..86e08c541 100644
--- a/pkg/trait/service_binding.go
+++ b/pkg/trait/service_binding.go
@@ -38,6 +38,9 @@ import (
 )
 
 const (
+       serviceBindingTraitID    = "service-binding"
+       serviceBindingTraitOrder = 250
+
        serviceBindingMountPointAnnotation = 
"camel.apache.org/serviceBinding.mount-point"
        serviceBindingLabel                = "camel.apache.org/serviceBinding"
 )
@@ -59,7 +62,7 @@ type serviceBindingTrait struct {
 
 func newServiceBindingTrait() Trait {
        return &serviceBindingTrait{
-               BaseTrait: NewBaseTrait("service-binding", 250),
+               BaseTrait: NewBaseTrait(serviceBindingTraitID, 
serviceBindingTraitOrder),
        }
 }
 
diff --git a/pkg/trait/toleration.go b/pkg/trait/toleration.go
index 8d58e75ef..1a55ee1b0 100644
--- a/pkg/trait/toleration.go
+++ b/pkg/trait/toleration.go
@@ -27,6 +27,11 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/kubernetes"
 )
 
+const (
+       tolerationTraitID    = "toleration"
+       tolerationTraitOrder = 1200
+)
+
 type tolerationTrait struct {
        BaseTrait
        traitv1.TolerationTrait `property:",squash"`
@@ -34,7 +39,7 @@ type tolerationTrait struct {
 
 func newTolerationTrait() Trait {
        return &tolerationTrait{
-               BaseTrait: NewBaseTrait("toleration", 1200),
+               BaseTrait: NewBaseTrait(tolerationTraitID, 
tolerationTraitOrder),
        }
 }
 
diff --git a/pkg/util/camel/camel_dependencies.go 
b/pkg/util/camel/camel_dependencies.go
index c0c0d6a86..b979335b8 100644
--- a/pkg/util/camel/camel_dependencies.go
+++ b/pkg/util/camel/camel_dependencies.go
@@ -213,6 +213,8 @@ func addRegistryMavenDependency(project *maven.Project, 
dependency string) error
        }
        plugin := getOrCreateBuildPlugin(project, 
"com.googlecode.maven-download-plugin", "download-maven-plugin", "1.6.8")
        outputDirectory := "../context"
+
+       //nolint:mnd
        isClasspath := len(mapping) == 3 && mapping[2] == "classpath"
        if isClasspath {
                outputDirectory = "src/main/resources"
diff --git a/pkg/util/io/io.go b/pkg/util/io/io.go
new file mode 100644
index 000000000..7a489adca
--- /dev/null
+++ b/pkg/util/io/io.go
@@ -0,0 +1,28 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package io
+
+import "os"
+
+const (
+       FilePerm600 os.FileMode = 0o600 // For secret files.
+       FilePerm644 os.FileMode = 0o644 // For normal files.
+       FilePerm755 os.FileMode = 0o755 // For directory or execute files.
+       FilePerm700 os.FileMode = 0o700 // For directory
+       FilePerm400 os.FileMode = 0o400 // For read only files
+)
diff --git a/pkg/util/jvm/keystore.go b/pkg/util/jvm/keystore.go
index b9241dc94..89d132080 100644
--- a/pkg/util/jvm/keystore.go
+++ b/pkg/util/jvm/keystore.go
@@ -30,6 +30,10 @@ import (
        "github.com/apache/camel-k/v2/pkg/util/log"
 )
 
+const (
+       keystoreSize = 10
+)
+
 var (
        logger = log.WithName("keytool")
 
@@ -75,5 +79,5 @@ func GenerateKeystore(ctx context.Context, keystoreDir, 
keystoreName, keystorePa
 // The keytool CLI mandates a password at least 6 characters long
 // to access any key stores.
 func NewKeystorePassword() string {
-       return util.RandomString(10)
+       return util.RandomString(keystoreSize)
 }
diff --git a/pkg/util/knative/uri.go b/pkg/util/knative/uri.go
index 7e59c7a47..73f4fb2b2 100644
--- a/pkg/util/knative/uri.go
+++ b/pkg/util/knative/uri.go
@@ -70,6 +70,7 @@ func ExtractObjectReference(uri string) (v1.ObjectReference, 
error) {
                        Kind:       "Broker",
                }, nil
        }
+
        name := matchOrEmpty(uriRegexp, 2, uri)
        if name == "" {
                return v1.ObjectReference{}, fmt.Errorf("cannot find name in 
uri %s", uri)
diff --git a/pkg/util/kubernetes/log/annotation_scraper.go 
b/pkg/util/kubernetes/log/annotation_scraper.go
index daec1bfc2..ff2d203fb 100644
--- a/pkg/util/kubernetes/log/annotation_scraper.go
+++ b/pkg/util/kubernetes/log/annotation_scraper.go
@@ -35,6 +35,10 @@ import (
        "k8s.io/client-go/kubernetes"
 )
 
+const (
+       scraperPeriodicTimeout = 2 * time.Second
+)
+
 // SelectorScraper scrapes all pods with a given selector.
 type SelectorScraper struct {
        client               kubernetes.Interface
@@ -91,7 +95,7 @@ func (s *SelectorScraper) periodicSynchronize(ctx 
context.Context, out *bufio.Wr
                if err := clientCloser(); err != nil {
                        s.L.Error(err, "Unable to close the client")
                }
-       case <-time.After(2 * time.Second):
+       case <-time.After(scraperPeriodicTimeout):
                go s.periodicSynchronize(ctx, out, clientCloser)
        }
 }
diff --git a/pkg/util/maven/maven_command.go b/pkg/util/maven/maven_command.go
index 1bc29cf71..dd579aa74 100644
--- a/pkg/util/maven/maven_command.go
+++ b/pkg/util/maven/maven_command.go
@@ -252,6 +252,8 @@ func (c *Command) prepareMavenWrapper(ctx context.Context) 
error {
 // The artifact id is in the form of:
 //
 //     <groupId>:<artifactId>[:<packagingType>]:(<version>)[:<classifier>]
+//
+//nolint:mnd
 func ParseGAV(gav string) (Dependency, error) {
        dep := Dependency{}
        res := strings.Split(gav, ":")
diff --git a/pkg/util/registry/registry.go b/pkg/util/registry/registry.go
index 623110d70..295e429ae 100644
--- a/pkg/util/registry/registry.go
+++ b/pkg/util/registry/registry.go
@@ -27,6 +27,8 @@ import (
        "path/filepath"
        "strings"
 
+       "github.com/apache/camel-k/v2/pkg/util/io"
+
        "github.com/apache/camel-k/v2/pkg/client"
        "go.uber.org/multierr"
        metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -126,7 +128,7 @@ func MountSecretRegistryConfig(ctx context.Context, c 
client.Client, namespace,
        }
 
        for file, content := range secret.Data {
-               if err := os.WriteFile(filepath.Join(dir, remap(file)), 
content, 0o600); err != nil {
+               if err := os.WriteFile(filepath.Join(dir, remap(file)), 
content, io.FilePerm600); err != nil {
                        if removeErr := os.RemoveAll(dir); removeErr != nil {
                                err = multierr.Append(err, removeErr)
                        }
diff --git a/pkg/util/util.go b/pkg/util/util.go
index c70c71e70..4ad0304c8 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -35,6 +35,8 @@ import (
        "strings"
        "time"
 
+       io2 "github.com/apache/camel-k/v2/pkg/util/io"
+
        "github.com/apache/camel-k/v2/pkg/util/sets"
        "go.uber.org/multierr"
 
@@ -283,7 +285,7 @@ func CopyFile(src, dst string) (int64, error) {
        // in the container may not be the same as the one owning the files
        //
        // #nosec G301
-       if err = os.MkdirAll(path.Dir(dst), 0o755); err != nil {
+       if err = os.MkdirAll(path.Dir(dst), io2.FilePerm755); err != nil {
                return 0, err
        }
 
@@ -426,7 +428,7 @@ func CreateDirectory(directory string) error {
 
        if !directoryExists {
                // #nosec G301
-               if err := os.MkdirAll(directory, 0o755); err != nil {
+               if err := os.MkdirAll(directory, io2.FilePerm755); err != nil {
                        return err
                }
        }
@@ -501,7 +503,7 @@ func MapToYAML(src map[string]interface{}) ([]byte, error) {
 }
 
 func WriteToFile(filePath string, fileContents string) error {
-       err := os.WriteFile(filePath, []byte(fileContents), 0o400)
+       err := os.WriteFile(filePath, []byte(fileContents), io2.FilePerm400)
        if err != nil {
                return fmt.Errorf("error writing file: %v", filePath)
        }
@@ -611,7 +613,7 @@ func WithFileReader(name string, consumer func(reader 
io.Reader) error) error {
 
 // WithFileContent a safe wrapper to process a file content.
 func WithFileContent(name string, consumer func(file *os.File, data []byte) 
error) error {
-       return WithFile(name, os.O_RDWR|os.O_CREATE, 0o644, func(file *os.File) 
error {
+       return WithFile(name, os.O_RDWR|os.O_CREATE, io2.FilePerm644, func(file 
*os.File) error {
                content, err := ReadFile(name)
                if err != nil {
                        return err
@@ -626,7 +628,7 @@ func WriteFileWithContent(filePath string, content []byte) 
error {
        fileDir := path.Dir(filePath)
 
        // Create dir if not present
-       err := os.MkdirAll(fileDir, 0o700)
+       err := os.MkdirAll(fileDir, io2.FilePerm700)
        if err != nil {
                return fmt.Errorf("could not create dir for file "+filePath+": 
%w", err)
        }
diff --git a/script/Makefile b/script/Makefile
index e2acdb16f..f9020dc7f 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -60,8 +60,8 @@ METADATA_IMAGE_NAME := $(CUSTOM_IMAGE)-metadata
 BUNDLE_IMAGE_NAME ?= $(CUSTOM_IMAGE)-bundle
 RELEASE_GIT_REMOTE := origin
 GIT_COMMIT := $(shell if [ -d .git ]; then git rev-list -1 HEAD; else echo 
"$(CUSTOM_VERSION)"; fi)
-LINT_GOGC := 20
-LINT_DEADLINE := 10m
+LINT_GOGC ?= 20
+LINT_DEADLINE ?= 10m
 DEBUG_MODE ?= false
 OPENSHIFT_REGISTRY := image-registry.openshift-image-registry.svc:5000
 

Reply via email to