[camel-k] 01/08: feat: Add path option to ingress trait

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit e3de5f972a6e1c4aa33fb1941dd3308c0ada7134
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:07:07 2023 +0100

feat: Add path option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go | 2 ++
 pkg/trait/ingress.go   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 1a76319d4..3d93f4aa1 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -27,6 +27,8 @@ type IngressTrait struct {
Trait `property:",squash" json:",inline"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
+   // To configure the path exposed by the ingress (default `/`).
+   Path string `property:"path" json:"path,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 99da27bba..ea9eb0a44 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -40,6 +40,7 @@ func newIngressTrait() Trait {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
Host: "",
+   Path: "/",
},
}
 }
@@ -104,7 +105,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
HTTP: 
{
Paths: 
[]networkingv1.HTTPIngressPath{
{
-   Path:   
  "/",
+   Path:   
  t.Path,

PathType: ,

Backend: networkingv1.IngressBackend{

Service: {



[camel-k] 08/08: feat(cli): Support setting maps in traits API

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 6573ebed13087981d2bd3f01716187631c3d7afa
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:51:00 2023 +0100

feat(cli): Support setting maps in traits API
---
 pkg/cmd/trait_support.go   | 24 
 pkg/trait/trait_catalog.go |  6 +-
 pkg/util/util.go   | 19 +++
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/pkg/cmd/trait_support.go b/pkg/cmd/trait_support.go
index 6e8abfa22..a85cc2080 100644
--- a/pkg/cmd/trait_support.go
+++ b/pkg/cmd/trait_support.go
@@ -36,7 +36,7 @@ type optionMap map[string]map[string]interface{}
 // The list of known addons is used for handling backward compatibility.
 var knownAddons = []string{"keda", "master", "strimzi", "3scale", "tracing"}
 
-var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\.[A-Za-z0-9-_]+)*)=(.*)$`)
+var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\..+)*)=(.*)$`)
 
 func validateTraits(catalog *trait.Catalog, traits []string) error {
tp := catalog.ComputeTraitsProperties()
@@ -46,7 +46,9 @@ func validateTraits(catalog *trait.Catalog, traits []string) 
error {
if strings.Contains(prefix, "[") {
prefix = prefix[0:strings.Index(prefix, "[")]
}
-   if !util.StringSliceExists(tp, prefix) {
+   if valid, err := validateTrait(tp, prefix); err != nil {
+   return err
+   } else if !valid {
return fmt.Errorf("%s is not a valid trait property", t)
}
}
@@ -54,18 +56,32 @@ func validateTraits(catalog *trait.Catalog, traits 
[]string) error {
return nil
 }
 
+func validateTrait(properties []string, item string) (bool, error) {
+   for i := 0; i < len(properties); i++ {
+   if strings.HasSuffix(properties[i], ".*") {
+   if match, err := regexp.MatchString(properties[i], 
item); err != nil {
+   return false, err
+   } else if match {
+   return true, nil
+   }
+   } else if properties[i] == item {
+   return true, nil
+   }
+   }
+
+   return false, nil
+}
+
 func configureTraits(options []string, traits interface{}, catalog 
trait.Finder) error {
config, err := optionsToMap(options)
if err != nil {
return err
}
 
-   //
// Known addons need to be put aside here, as otherwise the deprecated 
addon fields on
// Traits might be accidentally populated. The deprecated addon fields 
are preserved
// for backward compatibility and should be populated only when the 
operator reads
// existing CRs from the API server.
-   //
addons := make(optionMap)
for _, id := range knownAddons {
if config[id] != nil {
diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index 5acbaf94c..6992abd26 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -182,7 +182,11 @@ func (c *Catalog) processFields(fields []*structs.Field, 
processor func(string))
 
if property != "" {
items := strings.Split(property, ",")
-   processor(items[0])
+   if f.Kind() == reflect.Map {
+   processor(items[0] + ".*")
+   } else {
+   processor(items[0])
+   }
}
}
 }
diff --git a/pkg/util/util.go b/pkg/util/util.go
index 750aada65..28de402f3 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -93,7 +93,7 @@ var QuarkusDependenciesBaseDirectory = "/quarkus-app"
 // These are sensitive values or values that may have different values 
depending on
 // where the integration is run (locally vs. the cloud). These environment 
variables
 // are evaluated at the time of the integration invocation.
-var ListOfLazyEvaluatedEnvVars = []string{}
+var ListOfLazyEvaluatedEnvVars []string
 
 // CLIEnvVars -- List of CLI provided environment variables. They take 
precedence over
 // any environment variables with the same name.
@@ -645,12 +645,14 @@ func WithTempDir(pattern string, consumer func(string) 
error) error {
return multierr.Append(consumerErr, removeErr)
 }
 
-// Parses a property spec and returns its parts.
+var propertyRegex = regexp.MustCompile("'.+'|\".+\"|[^.]+")
+
+// ConfigTreePropertySplit Parses a property spec a

[camel-k] 02/08: feat: Add annotations option to ingress trait

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit cd3833e40bb111d16865fdda63c8fae3ed9331ac
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:17:24 2023 +0100

feat: Add annotations option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  4 
 pkg/trait/ingress.go   | 10 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 3d93f4aa1..6a0ee71c6 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -25,6 +25,10 @@ package trait
 // +camel-k:trait=ingress.
 type IngressTrait struct {
Trait `property:",squash" json:",inline"`
+   // The annotations added to the ingress.
+   // This can be used to set controller specific annotations, e.g., when 
using the NGINX Ingress controller:
+   // See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+   Annotations map[string]string `property:"annotations" 
json:"annotations,omitempty"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index ea9eb0a44..8f0243cfa 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -39,8 +39,9 @@ func newIngressTrait() Trait {
return {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
-   Host: "",
-   Path: "/",
+   Annotations: map[string]string{},
+   Host:"",
+   Path:"/",
},
}
 }
@@ -94,8 +95,9 @@ func (t *ingressTrait) Apply(e *Environment) error {
APIVersion: networkingv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
-   Name:  service.Name,
-   Namespace: service.Namespace,
+   Name:service.Name,
+   Namespace:   service.Namespace,
+   Annotations: t.Annotations,
},
Spec: networkingv1.IngressSpec{
Rules: []networkingv1.IngressRule{



[camel-k] 06/08: chore: Regen docs with ingress trait new options

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit afb032bfb655f92f526bdc34b83a62478f1f56ce
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:56 2023 +0100

chore: Regen docs with ingress trait new options
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 24 +++
 docs/modules/traits/pages/ingress.adoc| 15 ++
 resources/traits.yaml | 11 +++
 3 files changed, 50 insertions(+)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 1b9414e5a..bf4937a00 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -4504,6 +4504,15 @@ It's enabled by default whenever a Service is added to 
the integration (through
 
 
 
+|`annotations` +
+map[string]string
+|
+
+
+The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 |`host` +
 string
 |
@@ -4511,6 +4520,21 @@ string
 
 To configure the host exposed by the ingress.
 
+|`path` +
+string
+|
+
+
+To configure the path exposed by the ingress (default `/`).
+
+|`pathType` +
+*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#pathtype-v1-networking[Kubernetes
 networking/v1.PathType]*
+|
+
+
+To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 |`auto` +
 bool
 |
diff --git a/docs/modules/traits/pages/ingress.adoc 
b/docs/modules/traits/pages/ingress.adoc
index ae0f8c112..ed3a5abb5 100755
--- a/docs/modules/traits/pages/ingress.adoc
+++ b/docs/modules/traits/pages/ingress.adoc
@@ -28,10 +28,25 @@ The following configuration options are available:
 | bool
 | Can be used to enable or disable a trait. All traits share this common 
property.
 
+| ingress.annotations
+| map[string]string
+| The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 | ingress.host
 | string
 | To configure the host exposed by the ingress.
 
+| ingress.path
+| string
+| To configure the path exposed by the ingress (default `/`).
+
+| ingress.path-type
+| k8s.io/api/networking/v1.PathType
+| To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 | ingress.auto
 | bool
 | To automatically add an ingress whenever the integration uses an HTTP 
endpoint consumer.
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 697d8c523..f2a4d85f6 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -643,9 +643,20 @@ traits:
 type: bool
 description: Can be used to enable or disable a trait. All traits share 
this common
   property.
+  - name: annotations
+type: map[string]string
+description: 'The annotations added to the ingress. This can be used to 
set controller
+  specific annotations, e.g., when using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
   - name: host
 type: string
 description: To configure the host exposed by the ingress.
+  - name: path
+type: string
+description: To configure the path exposed by the ingress (default `/`).
+  - name: path-type
+type: k8s.io/api/networking/v1.PathType
+description: To configure the path type exposed by the ingress. One of 
`Exact`,
+  `Prefix`, `ImplementationSpecific` (default to `Prefix`).
   - name: auto
 type: bool
 description: To automatically add an ingress whenever the integration uses 
an



[camel-k] 07/08: chore: Rebuild resources

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit ff186cb086ef341fd781b5bc39a4ec68ab92a4a7
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:49:21 2023 +0100

chore: Rebuild resources
---
 pkg/resources/resources.go | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 1b63d9e38..fd817421d 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -138,23 +138,23 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrationplatforms.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_integrationplatforms.yaml",
modTime:  time.Time{},
-   uncompressedSize: 168233,
+   uncompressedSize: 170461,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\xdb\x36\xb6\x30\x8e\xff\x9e\xbf\x02\xe3\xce\x9d\x38\x19\x4b\x4e\xba\xb7\xbb\xbd\x7e\xa6\xf3\x3c\xae\x93\xb6\x6e\xde\x7c\x6d\x27\x7b\x77\xda\x4e\x05\x91\x47\x12\x6a\x10\xe0\x05\x40\xd9\xea\x77\xbf\xff\xfb\x67\x70\x00\x90\x94\x44\x82\x94\xe4\xc4\x69\x2b\x76\x66\x37\xb6\x89\xc3\x03\xe0\xe0\xbc\xe1\xbc\x7c\x41\x06\xf7\xf7\x3c\xfa\x82\xbc\x66\x09\x08\x0d\x29\x31\x92\x98\x19\x90\xd3\x9c\x26\x33\x20\x57\x72\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\xe3\x36\xb2\x28\xfe\xff\x7c\x0a\x94\x53\xa7\xc6\x33\x65\xc9\x33\xbb\x27\xbb\x39\x3e\x95\xba\xd7\xf1\x4c\x12\x67\x1e\xf6\xb1\x3d\xb3\xbb\x95\xa4\x22\x88\x6c\x49\x88\x41\x80\x07\x00\x65\x2b\xbf\xfd\x7d\xf7\x5b\x68\x00\x24\x25\x91\x20\x25\x79\x1e\x49\xc4\x54\xed\x8e\x6d\xa2\xd9\x00\x1a\xfd\x42\x3f\xbe\x20\x83\x87\x7b\x1e\x7d\x41\x5e\xb3\x04\x84\x86\x94\x18\x49\xcc\x0c\xc8\x69\x4e\x93\x19\x90\x6b\x39\x31\x
 [...]
},
"/crd/bases/camel.apache.org_integrations.yaml": 
۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
modTime:  time.Time{},
-   uncompressedSize: 491001,
+   uncompressedSize: 492115,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
},
"/crd/bases/camel.apache.org_kameletbindings.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_kameletbindings.yaml",
modTime:  time.Time{},
-   uncompressedSize: 567387,
+   uncompressedSize: 568581,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
},
"

[camel-k] 04/08: chore: Regen CRDs with ingress trait new options

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 80eca6192d09668320e0da0fa3e57138cfec524e
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:44:53 2023 +0100

chore: Regen CRDs with ingress trait new options
---
 .../camel.apache.org_integrationplatforms.yaml | 40 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 20 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 20 +++
 helm/camel-k/crds/crd-integration-platform.yaml| 40 ++
 helm/camel-k/crds/crd-integration.yaml | 20 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 20 +++
 6 files changed, 160 insertions(+)

diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 728b715e2..cc4bdc10f 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -800,6 +800,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -816,6 +823,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
@@ -2363,6 +2383,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -2379,6 +2406,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index 51c6ba51f..51269d0fa 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6577,6

[camel-k] 05/08: chore: Run codegen with ingress trait new options

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 17ca9be57e2eb01e0027ad8e825517a818a30b6c
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:08 2023 +0100

chore: Run codegen with ingress trait new options
---
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go| 16 +++-
 pkg/client/camel/clientset/versioned/fake/register.go   | 14 +++---
 pkg/client/camel/clientset/versioned/scheme/register.go | 14 +++---
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
index f8831364e..144e4aa41 100644
--- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
@@ -5,7 +5,9 @@
 
 package trait
 
-import ()
+import (
+   "k8s.io/api/networking/v1"
+)
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *AffinityTrait) DeepCopyInto(out *AffinityTrait) {
@@ -348,6 +350,18 @@ func (in *HealthTrait) DeepCopy() *HealthTrait {
 func (in *IngressTrait) DeepCopyInto(out *IngressTrait) {
*out = *in
in.Trait.DeepCopyInto()
+   if in.Annotations != nil {
+   in, out := , 
+   *out = make(map[string]string, len(*in))
+   for key, val := range *in {
+   (*out)[key] = val
+   }
+   }
+   if in.PathType != nil {
+   in, out := , 
+   *out = new(v1.PathType)
+   **out = **in
+   }
if in.Auto != nil {
in, out := , 
*out = new(bool)
diff --git a/pkg/client/camel/clientset/versioned/fake/register.go 
b/pkg/client/camel/clientset/versioned/fake/register.go
index 449936a90..327b4c8f0 100644
--- a/pkg/client/camel/clientset/versioned/fake/register.go
+++ b/pkg/client/camel/clientset/versioned/fake/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.
diff --git a/pkg/client/camel/clientset/versioned/scheme/register.go 
b/pkg/client/camel/clientset/versioned/scheme/register.go
index 6c3443318..40ca6f0dc 100644
--- a/pkg/client/camel/clientset/versioned/scheme/register.go
+++ b/pkg/client/camel/clientset/versioned/scheme/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.



[camel-k] branch release-1.12.x updated (620778fe1 -> 6573ebed1)

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a change to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


from 620778fe1 fix(#3956): Add maven settings-security to maven command
 new e3de5f972 feat: Add path option to ingress trait
 new cd3833e40 feat: Add annotations option to ingress trait
 new 982a5f867 feat: Add path type option to ingress trait
 new 80eca6192 chore: Regen CRDs with ingress trait new options
 new 17ca9be57 chore: Run codegen with ingress trait new options
 new afb032bfb chore: Regen docs with ingress trait new options
 new ff186cb08 chore: Rebuild resources
 new 6573ebed1 feat(cli): Support setting maps in traits API

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel.apache.org_integrationplatforms.yaml | 40 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 20 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 20 +++
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  | 24 +
 docs/modules/traits/pages/ingress.adoc | 15 
 helm/camel-k/crds/crd-integration-platform.yaml| 40 ++
 helm/camel-k/crds/crd-integration.yaml | 20 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 20 +++
 pkg/apis/camel/v1/trait/ingress.go | 12 +++
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   | 16 -
 .../camel/clientset/versioned/fake/register.go | 14 
 .../camel/clientset/versioned/scheme/register.go   | 14 
 pkg/cmd/trait_support.go   | 24 ++---
 pkg/resources/resources.go | 16 -
 pkg/trait/ingress.go   | 21 ++--
 pkg/trait/trait_catalog.go |  6 +++-
 pkg/trait/util.go  | 11 ++
 pkg/util/util.go   | 19 +++---
 resources/traits.yaml  | 11 ++
 19 files changed, 321 insertions(+), 42 deletions(-)



[camel-k] 03/08: feat: Add path type option to ingress trait

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.12.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 982a5f8679b28777ec3707279af186901c4603b7
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:39:39 2023 +0100

feat: Add path type option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  6 ++
 pkg/trait/ingress.go   | 10 --
 pkg/trait/util.go  | 11 +++
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 6a0ee71c6..128b36f02 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -17,6 +17,8 @@ limitations under the License.
 
 package trait
 
+import networkingv1 "k8s.io/api/networking/v1"
+
 // The Ingress trait can be used to expose the service associated with the 
integration
 // to the outside world with a Kubernetes Ingress.
 //
@@ -33,6 +35,10 @@ type IngressTrait struct {
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
Path string `property:"path" json:"path,omitempty"`
+   // To configure the path type exposed by the ingress.
+   // One of `Exact`, `Prefix`, `ImplementationSpecific` (default to 
`Prefix`).
+   // +kubebuilder:validation:Enum=Exact;Prefix;ImplementationSpecific
+   PathType *networkingv1.PathType `property:"path-type" 
json:"pathType,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 8f0243cfa..5635d9de1 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -24,7 +24,6 @@ import (
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-   "k8s.io/utils/pointer"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
@@ -42,6 +41,7 @@ func newIngressTrait() Trait {
Annotations: map[string]string{},
Host:"",
Path:"/",
+   PathType:ptrFrom(networkingv1.PathTypePrefix),
},
}
 }
@@ -56,7 +56,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if !pointer.BoolDeref(t.Enabled, true) {
+   if !ptrDerefOr(t.Enabled, true) {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
corev1.ConditionFalse,
@@ -66,7 +66,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if pointer.BoolDeref(t.Auto, true) {
+   if ptrDerefOr(t.Auto, true) {
if e.Resources.GetUserServiceForIntegration(e.Integration) == 
nil {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
@@ -87,8 +87,6 @@ func (t *ingressTrait) Apply(e *Environment) error {
return errors.New("cannot Apply ingress trait: no target 
service")
}
 
-   pathType := networkingv1.PathTypePrefix
-
ingress := networkingv1.Ingress{
TypeMeta: metav1.TypeMeta{
Kind:   "Ingress",
@@ -108,7 +106,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
Paths: 
[]networkingv1.HTTPIngressPath{
{
Path:   
  t.Path,
-   
PathType: ,
+   
PathType: t.PathType,

Backend: networkingv1.IngressBackend{

Service: {

Name: service.Name,
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 1e7daeb8b..d34a6a080 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -42,6 +42,17 @@ import (
"github.com/apache/camel-k/pkg/util/property"
 )
 
+func ptrFrom[T any](value T) *T {
+   return 
+}
+
+func ptrDerefOr[T any](value

[camel-k] branch pr-442 updated (d57221bbb -> f0663bfa8)

2023-03-06 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a change to branch pr-442
in repository https://gitbox.apache.org/repos/asf/camel-k.git


omit d57221bbb feat(cli): Support setting maps in traits API
omit 5cc214eb6 chore: Rebuild resources
omit d11845cc4 chore: Regen docs with ingress trait new options
omit 299b45574 chore: Run codegen with ingress trait new options
omit 206403e1f chore: Regen CRDs with ingress trait new options
omit 06e295210 feat: Add path type option to ingress trait
omit a626def2c feat: Add annotations option to ingress trait
omit de73a57d0 feat: Add path option to ingress trait
 add cbbfead86 fix(ci): e2e native action name
 add 80f567711 fix(ci): path to action
 add 5b4273261 fix(ci): use an external kamelet repo
 add e2f2d7c81 chore: changelog automatic update
 add 138e6ff29 chore: changelog automatic update
 add 20991ed50 Issue-1330: Deprecating parameters.
 add ac9a9fab1 Run 'make generate' with controller-gen@v0.6.1
 add a868e55f4 Revert formatting changes to avoid churn.
 add 620778fe1 fix(#3956): Add maven settings-security to maven command
 add cc8502b06 feat: Add path option to ingress trait
 add bf18258b2 feat: Add annotations option to ingress trait
 add a55e568d1 feat: Add path type option to ingress trait
 add 30cfa2b6b chore: Regen CRDs with ingress trait new options
 add ac2a28c39 chore: Run codegen with ingress trait new options
 add bfaaa145f chore: Regen docs with ingress trait new options
 add bcacff53f chore: Rebuild resources
 add f0663bfa8 feat(cli): Support setting maps in traits API

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (d57221bbb)
\
 N -- N -- N   refs/heads/pr-442 (f0663bfa8)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

No new revisions were added by this update.

Summary of changes:
 .../actions/{e2e-install-native => e2e-native}/action.yml|  4 ++--
 .../actions/{e2e-install-native => e2e-native}/exec-tests.sh |  0
 .github/workflows/native.yml | 12 ++--
 CHANGELOG.md |  3 +++
 config/crd/bases/camel.apache.org_kameletbindings.yaml   |  6 ++
 config/crd/bases/camel.apache.org_kamelets.yaml  |  4 
 docs/modules/ROOT/partials/apis/kamelets-crds.adoc   |  7 +++
 e2e/global/common/kamelet_test.go|  4 ++--
 helm/camel-k/crds/crd-kamelet-binding.yaml   |  6 ++
 helm/camel-k/crds/crd-kamelet.yaml   |  4 
 pkg/apis/camel/v1alpha1/jsonschema_types.go  |  1 +
 .../applyconfiguration/camel/v1alpha1/jsonschemaprop.go  |  9 +
 pkg/util/maven/maven_command.go  |  7 +++
 13 files changed, 57 insertions(+), 10 deletions(-)
 rename .github/actions/{e2e-install-native => e2e-native}/action.yml (98%)
 rename .github/actions/{e2e-install-native => e2e-native}/exec-tests.sh (100%)



[camel-k] 05/08: chore: Run codegen with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 299b455740d9fac224f78624954c298575265628
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:08 2023 +0100

chore: Run codegen with ingress trait new options
---
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go| 16 +++-
 pkg/client/camel/clientset/versioned/fake/register.go   | 14 +++---
 pkg/client/camel/clientset/versioned/scheme/register.go | 14 +++---
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
index f8831364e..144e4aa41 100644
--- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
@@ -5,7 +5,9 @@
 
 package trait
 
-import ()
+import (
+   "k8s.io/api/networking/v1"
+)
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *AffinityTrait) DeepCopyInto(out *AffinityTrait) {
@@ -348,6 +350,18 @@ func (in *HealthTrait) DeepCopy() *HealthTrait {
 func (in *IngressTrait) DeepCopyInto(out *IngressTrait) {
*out = *in
in.Trait.DeepCopyInto()
+   if in.Annotations != nil {
+   in, out := , 
+   *out = make(map[string]string, len(*in))
+   for key, val := range *in {
+   (*out)[key] = val
+   }
+   }
+   if in.PathType != nil {
+   in, out := , 
+   *out = new(v1.PathType)
+   **out = **in
+   }
if in.Auto != nil {
in, out := , 
*out = new(bool)
diff --git a/pkg/client/camel/clientset/versioned/fake/register.go 
b/pkg/client/camel/clientset/versioned/fake/register.go
index 449936a90..327b4c8f0 100644
--- a/pkg/client/camel/clientset/versioned/fake/register.go
+++ b/pkg/client/camel/clientset/versioned/fake/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.
diff --git a/pkg/client/camel/clientset/versioned/scheme/register.go 
b/pkg/client/camel/clientset/versioned/scheme/register.go
index 6c3443318..40ca6f0dc 100644
--- a/pkg/client/camel/clientset/versioned/scheme/register.go
+++ b/pkg/client/camel/clientset/versioned/scheme/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.



[camel-k] 07/08: chore: Rebuild resources

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 5cc214eb626ff3ae611e0b0ee1a0745c6e14b06d
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:49:21 2023 +0100

chore: Rebuild resources
---
 pkg/resources/resources.go | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index 1b63d9e38..fd817421d 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -138,23 +138,23 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrationplatforms.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_integrationplatforms.yaml",
modTime:  time.Time{},
-   uncompressedSize: 168233,
+   uncompressedSize: 170461,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\xdb\x36\xb6\x30\x8e\xff\x9e\xbf\x02\xe3\xce\x9d\x38\x19\x4b\x4e\xba\xb7\xbb\xbd\x7e\xa6\xf3\x3c\xae\x93\xb6\x6e\xde\x7c\x6d\x27\x7b\x77\xda\x4e\x05\x91\x47\x12\x6a\x10\xe0\x05\x40\xd9\xea\x77\xbf\xff\xfb\x67\x70\x00\x90\x94\x44\x82\x94\xe4\xc4\x69\x2b\x76\x66\x37\xb6\x89\xc3\x03\xe0\xe0\xbc\xe1\xbc\x7c\x41\x06\xf7\xf7\x3c\xfa\x82\xbc\x66\x09\x08\x0d\x29\x31\x92\x98\x19\x90\xd3\x9c\x26\x33\x20\x57\x72\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\xe3\x36\xb2\x28\xfe\xff\x7c\x0a\x94\x53\xa7\xc6\x33\x65\xc9\x33\xbb\x27\xbb\x39\x3e\x95\xba\xd7\xf1\x4c\x12\x67\x1e\xf6\xb1\x3d\xb3\xbb\x95\xa4\x22\x88\x6c\x49\x88\x41\x80\x07\x00\x65\x2b\xbf\xfd\x7d\xf7\x5b\x68\x00\x24\x25\x91\x20\x25\x79\x1e\x49\xc4\x54\xed\x8e\x6d\xa2\xd9\x00\x1a\xfd\x42\x3f\xbe\x20\x83\x87\x7b\x1e\x7d\x41\x5e\xb3\x04\x84\x86\x94\x18\x49\xcc\x0c\xc8\x69\x4e\x93\x19\x90\x6b\x39\x31\x
 [...]
},
"/crd/bases/camel.apache.org_integrations.yaml": 
۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
modTime:  time.Time{},
-   uncompressedSize: 491001,
+   uncompressedSize: 492115,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
},
"/crd/bases/camel.apache.org_kameletbindings.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_kameletbindings.yaml",
modTime:  time.Time{},
-   uncompressedSize: 567387,
+   uncompressedSize: 568581,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
},
"

[camel-k] 02/08: feat: Add annotations option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit a626def2cc301e5a9a1d319a03e454f417eb0a0f
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:17:24 2023 +0100

feat: Add annotations option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  4 
 pkg/trait/ingress.go   | 10 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 3d93f4aa1..6a0ee71c6 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -25,6 +25,10 @@ package trait
 // +camel-k:trait=ingress.
 type IngressTrait struct {
Trait `property:",squash" json:",inline"`
+   // The annotations added to the ingress.
+   // This can be used to set controller specific annotations, e.g., when 
using the NGINX Ingress controller:
+   // See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+   Annotations map[string]string `property:"annotations" 
json:"annotations,omitempty"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index ea9eb0a44..8f0243cfa 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -39,8 +39,9 @@ func newIngressTrait() Trait {
return {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
-   Host: "",
-   Path: "/",
+   Annotations: map[string]string{},
+   Host:"",
+   Path:"/",
},
}
 }
@@ -94,8 +95,9 @@ func (t *ingressTrait) Apply(e *Environment) error {
APIVersion: networkingv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
-   Name:  service.Name,
-   Namespace: service.Namespace,
+   Name:service.Name,
+   Namespace:   service.Namespace,
+   Annotations: t.Annotations,
},
Spec: networkingv1.IngressSpec{
Rules: []networkingv1.IngressRule{



[camel-k] 08/08: feat(cli): Support setting maps in traits API

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d5722109662e096a384d8db70afac8854565
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:51:00 2023 +0100

feat(cli): Support setting maps in traits API
---
 pkg/cmd/trait_support.go   | 24 
 pkg/trait/trait_catalog.go |  6 +-
 pkg/util/util.go   | 19 +++
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/pkg/cmd/trait_support.go b/pkg/cmd/trait_support.go
index 6e8abfa22..a85cc2080 100644
--- a/pkg/cmd/trait_support.go
+++ b/pkg/cmd/trait_support.go
@@ -36,7 +36,7 @@ type optionMap map[string]map[string]interface{}
 // The list of known addons is used for handling backward compatibility.
 var knownAddons = []string{"keda", "master", "strimzi", "3scale", "tracing"}
 
-var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\.[A-Za-z0-9-_]+)*)=(.*)$`)
+var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\..+)*)=(.*)$`)
 
 func validateTraits(catalog *trait.Catalog, traits []string) error {
tp := catalog.ComputeTraitsProperties()
@@ -46,7 +46,9 @@ func validateTraits(catalog *trait.Catalog, traits []string) 
error {
if strings.Contains(prefix, "[") {
prefix = prefix[0:strings.Index(prefix, "[")]
}
-   if !util.StringSliceExists(tp, prefix) {
+   if valid, err := validateTrait(tp, prefix); err != nil {
+   return err
+   } else if !valid {
return fmt.Errorf("%s is not a valid trait property", t)
}
}
@@ -54,18 +56,32 @@ func validateTraits(catalog *trait.Catalog, traits 
[]string) error {
return nil
 }
 
+func validateTrait(properties []string, item string) (bool, error) {
+   for i := 0; i < len(properties); i++ {
+   if strings.HasSuffix(properties[i], ".*") {
+   if match, err := regexp.MatchString(properties[i], 
item); err != nil {
+   return false, err
+   } else if match {
+   return true, nil
+   }
+   } else if properties[i] == item {
+   return true, nil
+   }
+   }
+
+   return false, nil
+}
+
 func configureTraits(options []string, traits interface{}, catalog 
trait.Finder) error {
config, err := optionsToMap(options)
if err != nil {
return err
}
 
-   //
// Known addons need to be put aside here, as otherwise the deprecated 
addon fields on
// Traits might be accidentally populated. The deprecated addon fields 
are preserved
// for backward compatibility and should be populated only when the 
operator reads
// existing CRs from the API server.
-   //
addons := make(optionMap)
for _, id := range knownAddons {
if config[id] != nil {
diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index 5acbaf94c..6992abd26 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -182,7 +182,11 @@ func (c *Catalog) processFields(fields []*structs.Field, 
processor func(string))
 
if property != "" {
items := strings.Split(property, ",")
-   processor(items[0])
+   if f.Kind() == reflect.Map {
+   processor(items[0] + ".*")
+   } else {
+   processor(items[0])
+   }
}
}
 }
diff --git a/pkg/util/util.go b/pkg/util/util.go
index 750aada65..28de402f3 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -93,7 +93,7 @@ var QuarkusDependenciesBaseDirectory = "/quarkus-app"
 // These are sensitive values or values that may have different values 
depending on
 // where the integration is run (locally vs. the cloud). These environment 
variables
 // are evaluated at the time of the integration invocation.
-var ListOfLazyEvaluatedEnvVars = []string{}
+var ListOfLazyEvaluatedEnvVars []string
 
 // CLIEnvVars -- List of CLI provided environment variables. They take 
precedence over
 // any environment variables with the same name.
@@ -645,12 +645,14 @@ func WithTempDir(pattern string, consumer func(string) 
error) error {
return multierr.Append(consumerErr, removeErr)
 }
 
-// Parses a property spec and returns its parts.
+var propertyRegex = regexp.MustCompile("'.+'|\".+\"|[^.]+")
+
+// ConfigTreePropertySplit Parses a property spec and return

[camel-k] 04/08: chore: Regen CRDs with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 206403e1f28c55990adb9c292d6b2ce682a34e3f
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:44:53 2023 +0100

chore: Regen CRDs with ingress trait new options
---
 .../camel.apache.org_integrationplatforms.yaml | 40 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 20 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 20 +++
 helm/camel-k/crds/crd-integration-platform.yaml| 40 ++
 helm/camel-k/crds/crd-integration.yaml | 20 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 20 +++
 6 files changed, 160 insertions(+)

diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 728b715e2..cc4bdc10f 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -800,6 +800,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -816,6 +823,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
@@ -2363,6 +2383,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -2379,6 +2406,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index 51c6ba51f..51269d0fa 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6577,6 +6577,13

[camel-k] 03/08: feat: Add path type option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 06e295210a095195c8d60b9ea0990064649360b9
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:39:39 2023 +0100

feat: Add path type option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  6 ++
 pkg/trait/ingress.go   | 10 --
 pkg/trait/util.go  | 11 +++
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 6a0ee71c6..128b36f02 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -17,6 +17,8 @@ limitations under the License.
 
 package trait
 
+import networkingv1 "k8s.io/api/networking/v1"
+
 // The Ingress trait can be used to expose the service associated with the 
integration
 // to the outside world with a Kubernetes Ingress.
 //
@@ -33,6 +35,10 @@ type IngressTrait struct {
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
Path string `property:"path" json:"path,omitempty"`
+   // To configure the path type exposed by the ingress.
+   // One of `Exact`, `Prefix`, `ImplementationSpecific` (default to 
`Prefix`).
+   // +kubebuilder:validation:Enum=Exact;Prefix;ImplementationSpecific
+   PathType *networkingv1.PathType `property:"path-type" 
json:"pathType,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 8f0243cfa..5635d9de1 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -24,7 +24,6 @@ import (
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-   "k8s.io/utils/pointer"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
@@ -42,6 +41,7 @@ func newIngressTrait() Trait {
Annotations: map[string]string{},
Host:"",
Path:"/",
+   PathType:ptrFrom(networkingv1.PathTypePrefix),
},
}
 }
@@ -56,7 +56,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if !pointer.BoolDeref(t.Enabled, true) {
+   if !ptrDerefOr(t.Enabled, true) {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
corev1.ConditionFalse,
@@ -66,7 +66,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if pointer.BoolDeref(t.Auto, true) {
+   if ptrDerefOr(t.Auto, true) {
if e.Resources.GetUserServiceForIntegration(e.Integration) == 
nil {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
@@ -87,8 +87,6 @@ func (t *ingressTrait) Apply(e *Environment) error {
return errors.New("cannot Apply ingress trait: no target 
service")
}
 
-   pathType := networkingv1.PathTypePrefix
-
ingress := networkingv1.Ingress{
TypeMeta: metav1.TypeMeta{
Kind:   "Ingress",
@@ -108,7 +106,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
Paths: 
[]networkingv1.HTTPIngressPath{
{
Path:   
  t.Path,
-   
PathType: ,
+   
PathType: t.PathType,

Backend: networkingv1.IngressBackend{

Service: {

Name: service.Name,
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 1e7daeb8b..d34a6a080 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -42,6 +42,17 @@ import (
"github.com/apache/camel-k/pkg/util/property"
 )
 
+func ptrFrom[T any](value T) *T {
+   return 
+}
+
+func ptrDerefOr[T any](value *T, def T

[camel-k] 06/08: chore: Regen docs with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d11845cc48751a0d0c2039c1f17b25bf393726d6
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:56 2023 +0100

chore: Regen docs with ingress trait new options
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 24 +++
 docs/modules/traits/pages/ingress.adoc| 15 ++
 resources/traits.yaml | 11 +++
 3 files changed, 50 insertions(+)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 1b9414e5a..bf4937a00 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -4504,6 +4504,15 @@ It's enabled by default whenever a Service is added to 
the integration (through
 
 
 
+|`annotations` +
+map[string]string
+|
+
+
+The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 |`host` +
 string
 |
@@ -4511,6 +4520,21 @@ string
 
 To configure the host exposed by the ingress.
 
+|`path` +
+string
+|
+
+
+To configure the path exposed by the ingress (default `/`).
+
+|`pathType` +
+*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#pathtype-v1-networking[Kubernetes
 networking/v1.PathType]*
+|
+
+
+To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 |`auto` +
 bool
 |
diff --git a/docs/modules/traits/pages/ingress.adoc 
b/docs/modules/traits/pages/ingress.adoc
index ae0f8c112..ed3a5abb5 100755
--- a/docs/modules/traits/pages/ingress.adoc
+++ b/docs/modules/traits/pages/ingress.adoc
@@ -28,10 +28,25 @@ The following configuration options are available:
 | bool
 | Can be used to enable or disable a trait. All traits share this common 
property.
 
+| ingress.annotations
+| map[string]string
+| The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 | ingress.host
 | string
 | To configure the host exposed by the ingress.
 
+| ingress.path
+| string
+| To configure the path exposed by the ingress (default `/`).
+
+| ingress.path-type
+| k8s.io/api/networking/v1.PathType
+| To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 | ingress.auto
 | bool
 | To automatically add an ingress whenever the integration uses an HTTP 
endpoint consumer.
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 697d8c523..f2a4d85f6 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -643,9 +643,20 @@ traits:
 type: bool
 description: Can be used to enable or disable a trait. All traits share 
this common
   property.
+  - name: annotations
+type: map[string]string
+description: 'The annotations added to the ingress. This can be used to 
set controller
+  specific annotations, e.g., when using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
   - name: host
 type: string
 description: To configure the host exposed by the ingress.
+  - name: path
+type: string
+description: To configure the path exposed by the ingress (default `/`).
+  - name: path-type
+type: k8s.io/api/networking/v1.PathType
+description: To configure the path type exposed by the ingress. One of 
`Exact`,
+  `Prefix`, `ImplementationSpecific` (default to `Prefix`).
   - name: auto
 type: bool
 description: To automatically add an ingress whenever the integration uses 
an



[camel-k] 01/08: feat: Add path option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit de73a57d00d2a332e663d673127bbb2d012d7985
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:07:07 2023 +0100

feat: Add path option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go | 2 ++
 pkg/trait/ingress.go   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 1a76319d4..3d93f4aa1 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -27,6 +27,8 @@ type IngressTrait struct {
Trait `property:",squash" json:",inline"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
+   // To configure the path exposed by the ingress (default `/`).
+   Path string `property:"path" json:"path,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 99da27bba..ea9eb0a44 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -40,6 +40,7 @@ func newIngressTrait() Trait {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
Host: "",
+   Path: "/",
},
}
 }
@@ -104,7 +105,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
HTTP: 
{
Paths: 
[]networkingv1.HTTPIngressPath{
{
-   Path:   
  "/",
+   Path:   
  t.Path,

PathType: ,

Backend: networkingv1.IngressBackend{

Service: {



[camel-k] branch pr-442 created (now d57221bbb)

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a change to branch pr-442
in repository https://gitbox.apache.org/repos/asf/camel-k.git


  at d57221bbb feat(cli): Support setting maps in traits API

This branch includes the following new commits:

 new de73a57d0 feat: Add path option to ingress trait
 new a626def2c feat: Add annotations option to ingress trait
 new 06e295210 feat: Add path type option to ingress trait
 new 206403e1f chore: Regen CRDs with ingress trait new options
 new 299b45574 chore: Run codegen with ingress trait new options
 new d11845cc4 chore: Regen docs with ingress trait new options
 new 5cc214eb6 chore: Rebuild resources
 new d57221bbb feat(cli): Support setting maps in traits API

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




[camel-k] 08/08: feat(cli): Support setting maps in traits API

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d1e9687f78b15fc78ef25c0978e3200376bc268e
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:51:00 2023 +0100

feat(cli): Support setting maps in traits API
---
 pkg/cmd/trait_support.go   | 24 
 pkg/trait/trait_catalog.go |  6 +-
 pkg/util/util.go   | 19 +++
 3 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/pkg/cmd/trait_support.go b/pkg/cmd/trait_support.go
index 6e8abfa22..a85cc2080 100644
--- a/pkg/cmd/trait_support.go
+++ b/pkg/cmd/trait_support.go
@@ -36,7 +36,7 @@ type optionMap map[string]map[string]interface{}
 // The list of known addons is used for handling backward compatibility.
 var knownAddons = []string{"keda", "master", "strimzi", "3scale", "tracing"}
 
-var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\.[A-Za-z0-9-_]+)*)=(.*)$`)
+var traitConfigRegexp = 
regexp.MustCompile(`^([a-z0-9-]+)((?:\.[a-z0-9-]+)(?:\[[0-9]+\]|\..+)*)=(.*)$`)
 
 func validateTraits(catalog *trait.Catalog, traits []string) error {
tp := catalog.ComputeTraitsProperties()
@@ -46,7 +46,9 @@ func validateTraits(catalog *trait.Catalog, traits []string) 
error {
if strings.Contains(prefix, "[") {
prefix = prefix[0:strings.Index(prefix, "[")]
}
-   if !util.StringSliceExists(tp, prefix) {
+   if valid, err := validateTrait(tp, prefix); err != nil {
+   return err
+   } else if !valid {
return fmt.Errorf("%s is not a valid trait property", t)
}
}
@@ -54,18 +56,32 @@ func validateTraits(catalog *trait.Catalog, traits 
[]string) error {
return nil
 }
 
+func validateTrait(properties []string, item string) (bool, error) {
+   for i := 0; i < len(properties); i++ {
+   if strings.HasSuffix(properties[i], ".*") {
+   if match, err := regexp.MatchString(properties[i], 
item); err != nil {
+   return false, err
+   } else if match {
+   return true, nil
+   }
+   } else if properties[i] == item {
+   return true, nil
+   }
+   }
+
+   return false, nil
+}
+
 func configureTraits(options []string, traits interface{}, catalog 
trait.Finder) error {
config, err := optionsToMap(options)
if err != nil {
return err
}
 
-   //
// Known addons need to be put aside here, as otherwise the deprecated 
addon fields on
// Traits might be accidentally populated. The deprecated addon fields 
are preserved
// for backward compatibility and should be populated only when the 
operator reads
// existing CRs from the API server.
-   //
addons := make(optionMap)
for _, id := range knownAddons {
if config[id] != nil {
diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index 5acbaf94c..6992abd26 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -182,7 +182,11 @@ func (c *Catalog) processFields(fields []*structs.Field, 
processor func(string))
 
if property != "" {
items := strings.Split(property, ",")
-   processor(items[0])
+   if f.Kind() == reflect.Map {
+   processor(items[0] + ".*")
+   } else {
+   processor(items[0])
+   }
}
}
 }
diff --git a/pkg/util/util.go b/pkg/util/util.go
index 750aada65..28de402f3 100644
--- a/pkg/util/util.go
+++ b/pkg/util/util.go
@@ -93,7 +93,7 @@ var QuarkusDependenciesBaseDirectory = "/quarkus-app"
 // These are sensitive values or values that may have different values 
depending on
 // where the integration is run (locally vs. the cloud). These environment 
variables
 // are evaluated at the time of the integration invocation.
-var ListOfLazyEvaluatedEnvVars = []string{}
+var ListOfLazyEvaluatedEnvVars []string
 
 // CLIEnvVars -- List of CLI provided environment variables. They take 
precedence over
 // any environment variables with the same name.
@@ -645,12 +645,14 @@ func WithTempDir(pattern string, consumer func(string) 
error) error {
return multierr.Append(consumerErr, removeErr)
 }
 
-// Parses a property spec and returns its parts.
+var propertyRegex = regexp.MustCompile("'.+'|\".+\"|[^.]+")
+
+// ConfigTreePropertySplit Parses a property spec and return

[camel-k] 05/08: chore: Run codegen with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d69e4abb87846b882781a17f85f4f1c2ac2a35bd
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:08 2023 +0100

chore: Run codegen with ingress trait new options
---
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go| 16 +++-
 pkg/client/camel/clientset/versioned/fake/register.go   | 14 +++---
 pkg/client/camel/clientset/versioned/scheme/register.go | 14 +++---
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go 
b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
index f8831364e..144e4aa41 100644
--- a/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
+++ b/pkg/apis/camel/v1/trait/zz_generated.deepcopy.go
@@ -5,7 +5,9 @@
 
 package trait
 
-import ()
+import (
+   "k8s.io/api/networking/v1"
+)
 
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, 
writing into out. in must be non-nil.
 func (in *AffinityTrait) DeepCopyInto(out *AffinityTrait) {
@@ -348,6 +350,18 @@ func (in *HealthTrait) DeepCopy() *HealthTrait {
 func (in *IngressTrait) DeepCopyInto(out *IngressTrait) {
*out = *in
in.Trait.DeepCopyInto()
+   if in.Annotations != nil {
+   in, out := , 
+   *out = make(map[string]string, len(*in))
+   for key, val := range *in {
+   (*out)[key] = val
+   }
+   }
+   if in.PathType != nil {
+   in, out := , 
+   *out = new(v1.PathType)
+   **out = **in
+   }
if in.Auto != nil {
in, out := , 
*out = new(bool)
diff --git a/pkg/client/camel/clientset/versioned/fake/register.go 
b/pkg/client/camel/clientset/versioned/fake/register.go
index 449936a90..327b4c8f0 100644
--- a/pkg/client/camel/clientset/versioned/fake/register.go
+++ b/pkg/client/camel/clientset/versioned/fake/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.
diff --git a/pkg/client/camel/clientset/versioned/scheme/register.go 
b/pkg/client/camel/clientset/versioned/scheme/register.go
index 6c3443318..40ca6f0dc 100644
--- a/pkg/client/camel/clientset/versioned/scheme/register.go
+++ b/pkg/client/camel/clientset/versioned/scheme/register.go
@@ -40,14 +40,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.



[camel-k] 03/08: feat: Add path type option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 6c158fd4d53fea900e890726089b6476e5ac1847
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:39:39 2023 +0100

feat: Add path type option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  6 ++
 pkg/trait/ingress.go   | 10 --
 pkg/trait/util.go  | 11 +++
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 6a0ee71c6..128b36f02 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -17,6 +17,8 @@ limitations under the License.
 
 package trait
 
+import networkingv1 "k8s.io/api/networking/v1"
+
 // The Ingress trait can be used to expose the service associated with the 
integration
 // to the outside world with a Kubernetes Ingress.
 //
@@ -33,6 +35,10 @@ type IngressTrait struct {
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
Path string `property:"path" json:"path,omitempty"`
+   // To configure the path type exposed by the ingress.
+   // One of `Exact`, `Prefix`, `ImplementationSpecific` (default to 
`Prefix`).
+   // +kubebuilder:validation:Enum=Exact;Prefix;ImplementationSpecific
+   PathType *networkingv1.PathType `property:"path-type" 
json:"pathType,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 8f0243cfa..5635d9de1 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -24,7 +24,6 @@ import (
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
-   "k8s.io/utils/pointer"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
@@ -42,6 +41,7 @@ func newIngressTrait() Trait {
Annotations: map[string]string{},
Host:"",
Path:"/",
+   PathType:ptrFrom(networkingv1.PathTypePrefix),
},
}
 }
@@ -56,7 +56,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if !pointer.BoolDeref(t.Enabled, true) {
+   if !ptrDerefOr(t.Enabled, true) {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
corev1.ConditionFalse,
@@ -66,7 +66,7 @@ func (t *ingressTrait) Configure(e *Environment) (bool, 
error) {
return false, nil
}
 
-   if pointer.BoolDeref(t.Auto, true) {
+   if ptrDerefOr(t.Auto, true) {
if e.Resources.GetUserServiceForIntegration(e.Integration) == 
nil {
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
@@ -87,8 +87,6 @@ func (t *ingressTrait) Apply(e *Environment) error {
return errors.New("cannot Apply ingress trait: no target 
service")
}
 
-   pathType := networkingv1.PathTypePrefix
-
ingress := networkingv1.Ingress{
TypeMeta: metav1.TypeMeta{
Kind:   "Ingress",
@@ -108,7 +106,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
Paths: 
[]networkingv1.HTTPIngressPath{
{
Path:   
  t.Path,
-   
PathType: ,
+   
PathType: t.PathType,

Backend: networkingv1.IngressBackend{

Service: {

Name: service.Name,
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 1e7daeb8b..d34a6a080 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -42,6 +42,17 @@ import (
"github.com/apache/camel-k/pkg/util/property"
 )
 
+func ptrFrom[T any](value T) *T {
+   return 
+}
+
+func ptrDerefOr[T any](value *T, def T

[camel-k] 07/08: chore: Rebuild resources

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit dcdbfbb3cb4e5c223c604fb3c9165ad80917d107
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:49:21 2023 +0100

chore: Rebuild resources
---
 pkg/resources/resources.go | 16 
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index a171c0de4..862780b14 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -138,23 +138,23 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrationplatforms.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_integrationplatforms.yaml",
modTime:  time.Time{},
-   uncompressedSize: 168233,
+   uncompressedSize: 170461,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\xfd\x73\xdb\x36\xb6\x30\x8e\xff\x9e\xbf\x02\xe3\xce\x9d\x38\x19\x4b\x4e\xba\xb7\xbb\xbd\x7e\xa6\xf3\x3c\xae\x93\xb6\x6e\xde\x7c\x6d\x27\x7b\x77\xda\x4e\x05\x91\x47\x12\x6a\x10\xe0\x05\x40\xd9\xea\x77\xbf\xff\xfb\x67\x70\x00\x90\x94\x44\x82\x94\xe4\xc4\x69\x2b\x76\x66\x37\xb6\x89\xc3\x03\xe0\xe0\xbc\xe1\xbc\x7c\x41\x06\xf7\xf7\x3c\xfa\x82\xbc\x66\x09\x08\x0d\x29\x31\x92\x98\x19\x90\xd3\x9c\x26\x33\x20\x57\x72\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xbd\x7b\x73\xe3\x36\xb2\x28\xfe\xff\x7c\x0a\x94\x53\xa7\xc6\x33\x65\xc9\x33\xbb\x27\xbb\x39\x3e\x95\xba\xd7\xf1\x4c\x12\x67\x1e\xf6\xb1\x3d\xb3\xbb\x95\xa4\x22\x88\x6c\x49\x88\x41\x80\x07\x00\x65\x2b\xbf\xfd\x7d\xf7\x5b\x68\x00\x24\x25\x91\x20\x25\x79\x1e\x49\xc4\x54\xed\x8e\x6d\xa2\xd9\x00\x1a\xfd\x42\x3f\xbe\x20\x83\x87\x7b\x1e\x7d\x41\x5e\xb3\x04\x84\x86\x94\x18\x49\xcc\x0c\xc8\x69\x4e\x93\x19\x90\x6b\x39\x31\x
 [...]
},
"/crd/bases/camel.apache.org_integrations.yaml": 
۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
modTime:  time.Time{},
-   uncompressedSize: 491001,
+   uncompressedSize: 492115,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
},
"/crd/bases/camel.apache.org_kameletbindings.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_kameletbindings.yaml",
modTime:  time.Time{},
-   uncompressedSize: 567387,
+   uncompressedSize: 568581,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
},
"/crd/bases/camel.apache.org_kamelets.yaml&qu

[camel-k] 04/08: chore: Regen CRDs with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 27a082581ebcc154c7a4d93594646c6eba27f38d
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:44:53 2023 +0100

chore: Regen CRDs with ingress trait new options
---
 .../camel.apache.org_integrationplatforms.yaml | 40 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 20 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 20 +++
 helm/camel-k/crds/crd-integration-platform.yaml| 40 ++
 helm/camel-k/crds/crd-integration.yaml | 20 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 20 +++
 6 files changed, 160 insertions(+)

diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 728b715e2..cc4bdc10f 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -800,6 +800,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -816,6 +823,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
@@ -2363,6 +2383,13 @@ spec:
   ingress:
 description: The configuration of Ingress trait
 properties:
+  annotations:
+additionalProperties:
+  type: string
+description: 'The annotations added to the ingress. 
This can
+  be used to set controller specific annotations, 
e.g., when
+  using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
+type: object
   auto:
 description: To automatically add an ingress whenever 
the
   integration uses an HTTP endpoint consumer.
@@ -2379,6 +2406,19 @@ spec:
   host:
 description: To configure the host exposed by the 
ingress.
 type: string
+  path:
+description: To configure the path exposed by the 
ingress
+  (default `/`).
+type: string
+  pathType:
+description: To configure the path type exposed by the 
ingress.
+  One of `Exact`, `Prefix`, `ImplementationSpecific` 
(default
+  to `Prefix`).
+enum:
+- Exact
+- Prefix
+- ImplementationSpecific
+type: string
 type: object
   istio:
 description: The configuration of Istio trait
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index 51c6ba51f..51269d0fa 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6577,6 +6577,13

[camel-k] 06/08: chore: Regen docs with ingress trait new options

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit af0a87235d95069f4b48977525e1e132dc02b8f9
Author: Antonin Stefanutti 
AuthorDate: Wed Mar 1 12:46:56 2023 +0100

chore: Regen docs with ingress trait new options
---
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 24 +++
 docs/modules/traits/pages/ingress.adoc| 15 ++
 resources/traits.yaml | 11 +++
 3 files changed, 50 insertions(+)

diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc 
b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index 1b9414e5a..bf4937a00 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -4504,6 +4504,15 @@ It's enabled by default whenever a Service is added to 
the integration (through
 
 
 
+|`annotations` +
+map[string]string
+|
+
+
+The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 |`host` +
 string
 |
@@ -4511,6 +4520,21 @@ string
 
 To configure the host exposed by the ingress.
 
+|`path` +
+string
+|
+
+
+To configure the path exposed by the ingress (default `/`).
+
+|`pathType` +
+*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#pathtype-v1-networking[Kubernetes
 networking/v1.PathType]*
+|
+
+
+To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 |`auto` +
 bool
 |
diff --git a/docs/modules/traits/pages/ingress.adoc 
b/docs/modules/traits/pages/ingress.adoc
index ae0f8c112..ed3a5abb5 100755
--- a/docs/modules/traits/pages/ingress.adoc
+++ b/docs/modules/traits/pages/ingress.adoc
@@ -28,10 +28,25 @@ The following configuration options are available:
 | bool
 | Can be used to enable or disable a trait. All traits share this common 
property.
 
+| ingress.annotations
+| map[string]string
+| The annotations added to the ingress.
+This can be used to set controller specific annotations, e.g., when using the 
NGINX Ingress controller:
+See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+
 | ingress.host
 | string
 | To configure the host exposed by the ingress.
 
+| ingress.path
+| string
+| To configure the path exposed by the ingress (default `/`).
+
+| ingress.path-type
+| k8s.io/api/networking/v1.PathType
+| To configure the path type exposed by the ingress.
+One of `Exact`, `Prefix`, `ImplementationSpecific` (default to `Prefix`).
+
 | ingress.auto
 | bool
 | To automatically add an ingress whenever the integration uses an HTTP 
endpoint consumer.
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 697d8c523..f2a4d85f6 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -643,9 +643,20 @@ traits:
 type: bool
 description: Can be used to enable or disable a trait. All traits share 
this common
   property.
+  - name: annotations
+type: map[string]string
+description: 'The annotations added to the ingress. This can be used to 
set controller
+  specific annotations, e.g., when using the NGINX Ingress controller: See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md'
   - name: host
 type: string
 description: To configure the host exposed by the ingress.
+  - name: path
+type: string
+description: To configure the path exposed by the ingress (default `/`).
+  - name: path-type
+type: k8s.io/api/networking/v1.PathType
+description: To configure the path type exposed by the ingress. One of 
`Exact`,
+  `Prefix`, `ImplementationSpecific` (default to `Prefix`).
   - name: auto
 type: bool
 description: To automatically add an ingress whenever the integration uses 
an



[camel-k] branch main updated (b122d7ec1 -> d1e9687f7)

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from b122d7ec1 chore: changelog automatic update
 new 0ff65da4e feat: Add path option to ingress trait
 new 6edfeaf42 feat: Add annotations option to ingress trait
 new 6c158fd4d feat: Add path type option to ingress trait
 new 27a082581 chore: Regen CRDs with ingress trait new options
 new d69e4abb8 chore: Run codegen with ingress trait new options
 new af0a87235 chore: Regen docs with ingress trait new options
 new dcdbfbb3c chore: Rebuild resources
 new d1e9687f7 feat(cli): Support setting maps in traits API

The 8 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel.apache.org_integrationplatforms.yaml | 40 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 20 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 20 +++
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  | 24 +
 docs/modules/traits/pages/ingress.adoc | 15 
 helm/camel-k/crds/crd-integration-platform.yaml| 40 ++
 helm/camel-k/crds/crd-integration.yaml | 20 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 20 +++
 pkg/apis/camel/v1/trait/ingress.go | 12 +++
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   | 16 -
 .../camel/clientset/versioned/fake/register.go | 14 
 .../camel/clientset/versioned/scheme/register.go   | 14 
 pkg/cmd/trait_support.go   | 24 ++---
 pkg/resources/resources.go | 16 -
 pkg/trait/ingress.go   | 21 ++--
 pkg/trait/trait_catalog.go |  6 +++-
 pkg/trait/util.go  | 11 ++
 pkg/util/util.go   | 19 +++---
 resources/traits.yaml  | 11 ++
 19 files changed, 321 insertions(+), 42 deletions(-)



[camel-k] 02/08: feat: Add annotations option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 6edfeaf42759679a884ee9d633ecefc3261aa887
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:17:24 2023 +0100

feat: Add annotations option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go |  4 
 pkg/trait/ingress.go   | 10 ++
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 3d93f4aa1..6a0ee71c6 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -25,6 +25,10 @@ package trait
 // +camel-k:trait=ingress.
 type IngressTrait struct {
Trait `property:",squash" json:",inline"`
+   // The annotations added to the ingress.
+   // This can be used to set controller specific annotations, e.g., when 
using the NGINX Ingress controller:
+   // See 
https://github.com/kubernetes/ingress-nginx/blob/main/docs/user-guide/nginx-configuration/annotations.md
+   Annotations map[string]string `property:"annotations" 
json:"annotations,omitempty"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
// To configure the path exposed by the ingress (default `/`).
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index ea9eb0a44..8f0243cfa 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -39,8 +39,9 @@ func newIngressTrait() Trait {
return {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
-   Host: "",
-   Path: "/",
+   Annotations: map[string]string{},
+   Host:"",
+   Path:"/",
},
}
 }
@@ -94,8 +95,9 @@ func (t *ingressTrait) Apply(e *Environment) error {
APIVersion: networkingv1.SchemeGroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
-   Name:  service.Name,
-   Namespace: service.Namespace,
+   Name:service.Name,
+   Namespace:   service.Namespace,
+   Annotations: t.Annotations,
},
Spec: networkingv1.IngressSpec{
Rules: []networkingv1.IngressRule{



[camel-k] 01/08: feat: Add path option to ingress trait

2023-03-01 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 0ff65da4e0e92a92ccb26662200b1e4600062b3c
Author: Antonin Stefanutti 
AuthorDate: Tue Feb 28 15:07:07 2023 +0100

feat: Add path option to ingress trait
---
 pkg/apis/camel/v1/trait/ingress.go | 2 ++
 pkg/trait/ingress.go   | 3 ++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/apis/camel/v1/trait/ingress.go 
b/pkg/apis/camel/v1/trait/ingress.go
index 1a76319d4..3d93f4aa1 100644
--- a/pkg/apis/camel/v1/trait/ingress.go
+++ b/pkg/apis/camel/v1/trait/ingress.go
@@ -27,6 +27,8 @@ type IngressTrait struct {
Trait `property:",squash" json:",inline"`
// To configure the host exposed by the ingress.
Host string `property:"host" json:"host,omitempty"`
+   // To configure the path exposed by the ingress (default `/`).
+   Path string `property:"path" json:"path,omitempty"`
// To automatically add an ingress whenever the integration uses an 
HTTP endpoint consumer.
Auto *bool `property:"auto" json:"auto,omitempty"`
 }
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index 99da27bba..ea9eb0a44 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -40,6 +40,7 @@ func newIngressTrait() Trait {
BaseTrait: NewBaseTrait("ingress", 2400),
IngressTrait: traitv1.IngressTrait{
Host: "",
+   Path: "/",
},
}
 }
@@ -104,7 +105,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
HTTP: 
{
Paths: 
[]networkingv1.HTTPIngressPath{
{
-   Path:   
  "/",
+   Path:   
  t.Path,

PathType: ,

Backend: networkingv1.IngressBackend{

Service: {



[camel-k] branch main updated: Move pod's phase indexer to integration controller initialization

2023-02-17 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 4b77766ba Move pod's phase indexer to integration controller 
initialization
4b77766ba is described below

commit 4b77766ba1db6a9c136b37580ff84a6c2fb35f10
Author: Luca Burgazzoli 
AuthorDate: Thu Feb 16 22:51:57 2023 +0100

Move pod's phase indexer to integration controller initialization
---
 pkg/cmd/operator/operator.go   | 11 +--
 pkg/controller/build/build_controller.go   |  2 +-
 pkg/controller/controller.go   |  8 +++--
 .../integration/integration_controller.go  | 34 +++---
 .../integrationkit/integrationkit_controller.go|  6 ++--
 .../integrationplatform_controller.go  |  2 +-
 pkg/controller/kamelet/kamelet_controller.go   |  2 +-
 .../kameletbinding/kamelet_binding_controller.go   |  2 +-
 8 files changed, 36 insertions(+), 31 deletions(-)

diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index 71817cf8c..69e167baf 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -224,21 +224,12 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
})
exitOnError(err, "")
 
-   exitOnError(
-   mgr.GetFieldIndexer().IndexField(ctx, {}, 
"status.phase",
-   func(obj ctrl.Object) []string {
-   pod, _ := obj.(*corev1.Pod)
-   return []string{string(pod.Status.Phase)}
-   }),
-   "unable to set up field indexer for status.phase: %v",
-   )
-
log.Info("Configuring manager")
exitOnError(mgr.AddHealthzCheck("health-probe", healthz.Ping), "Unable 
add liveness check")
exitOnError(apis.AddToScheme(mgr.GetScheme()), "")
ctrlClient, err := client.FromManager(mgr)
exitOnError(err, "")
-   exitOnError(controller.AddToManager(mgr, ctrlClient), "")
+   exitOnError(controller.AddToManager(ctx, mgr, ctrlClient), "")
 
log.Info("Installing operator resources")
installCtx, installCancel := context.WithTimeout(ctx, 1*time.Minute)
diff --git a/pkg/controller/build/build_controller.go 
b/pkg/controller/build/build_controller.go
index dc3db68d1..3bfab58ef 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -41,7 +41,7 @@ import (
 
 // 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(mgr manager.Manager, c client.Client) error {
+func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
return add(mgr, newReconciler(mgr, c))
 }
 
diff --git a/pkg/controller/controller.go b/pkg/controller/controller.go
index ace2d9cb6..721c93aa3 100644
--- a/pkg/controller/controller.go
+++ b/pkg/controller/controller.go
@@ -18,18 +18,20 @@ limitations under the License.
 package controller
 
 import (
+   "context"
+
ctrl "sigs.k8s.io/controller-runtime"
 
"github.com/apache/camel-k/pkg/client"
 )
 
 // addToManager is a list of functions to add all Controllers to the Manager.
-var addToManager []func(ctrl.Manager, client.Client) error
+var addToManager []func(context.Context, ctrl.Manager, client.Client) error
 
 // AddToManager adds all Controllers to the Manager.
-func AddToManager(manager ctrl.Manager, client client.Client) error {
+func AddToManager(ctx context.Context, manager ctrl.Manager, client 
client.Client) error {
for _, f := range addToManager {
-   if err := f(manager, client); err != nil {
+   if err := f(ctx, manager, client); err != nil {
return err
}
}
diff --git a/pkg/controller/integration/integration_controller.go 
b/pkg/controller/integration/integration_controller.go
index de73ecd11..48887fa8c 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -23,6 +23,8 @@ import (
"reflect"
"time"
 
+   "github.com/pkg/errors"
+
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
@@ -54,8 +56,18 @@ import (
"github.com/apache/camel-k/pkg/util/monitoring"
 )
 
-func Add(mgr manager.Manager, c client.Client) error {
-   return add(mgr, c, newReconciler(mgr, c))
+func Add(ctx context.Context, mgr manager.Manager, c client.Client) error {
+   err

[camel-k] 01/04: api: Add apply configuration generation

2023-01-10 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit bc9572e509c44de536dbea484d3e8a1c9fc5df91
Author: Antonin Stefanutti 
AuthorDate: Mon Jan 9 14:42:23 2023 +0100

api: Add apply configuration generation
---
 script/Makefile  | 1 +
 script/gen_client.sh | 7 +++
 2 files changed, 8 insertions(+)

diff --git a/script/Makefile b/script/Makefile
index b9e17b711..c7f305ea6 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -212,6 +212,7 @@ codegen-tools-install: controller-gen
@# We must force the installation to make sure we are using the correct 
version
@# Note: as there is no --version in the tools, we cannot rely on 
cached local versions
@echo "Installing k8s.io/code-generator tools with version 
$(CODEGEN_VERSION)"
+   go install 
k8s.io/code-generator/cmd/applyconfiguration-gen@$(CODEGEN_VERSION)
go install k8s.io/code-generator/cmd/client-gen@$(CODEGEN_VERSION)
go install k8s.io/code-generator/cmd/lister-gen@$(CODEGEN_VERSION)
go install k8s.io/code-generator/cmd/informer-gen@$(CODEGEN_VERSION)
diff --git a/script/gen_client.sh b/script/gen_client.sh
index 25437af84..6207a0697 100755
--- a/script/gen_client.sh
+++ b/script/gen_client.sh
@@ -25,11 +25,18 @@ cd $location/../pkg/client/camel
 
 echo "Generating Go client code..."
 
+$(go env GOPATH)/bin/applyconfiguration-gen \
+   
--input-dirs=github.com/apache/camel-k/pkg/apis/camel/v1,github.com/apache/camel-k/pkg/apis/camel/v1alpha1
 \
+   --go-header-file=../../../script/headers/default.txt \
+   --output-base=. \
+   
--output-package=github.com/apache/camel-k/pkg/client/camel/applyconfiguration
+
 $(go env GOPATH)/bin/client-gen \
--input=camel/v1,camel/v1alpha1 \
--go-header-file=../../../script/headers/default.txt \
--clientset-name "versioned"  \
--input-base=github.com/apache/camel-k/pkg/apis \
+   
--apply-configuration-package=github.com/apache/camel-k/pkg/client/camel/applyconfiguration
 \
--output-base=. \
--output-package=github.com/apache/camel-k/pkg/client/camel/clientset
 



[camel-k] 02/04: chore: Remove missing target pre-requisites

2023-01-10 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 72a838155afe05f5a13ddb51355db8cde74e4c44
Author: Antonin Stefanutti 
AuthorDate: Mon Jan 9 14:45:32 2023 +0100

chore: Remove missing target pre-requisites
---
 script/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index c7f305ea6..352160800 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -501,7 +501,7 @@ release-kustomize:
 get-staging-repo:
@echo $(or 
${STAGING_RUNTIME_REPO},https://repository.apache.org/content/repositories/snapshots@id=apache-snapshots@snapshots)
 
-.PHONY: do-build build build-kamel build-resources dep codegen images 
images-push images-push-staging test check test-integration clean release 
cross-compile package-examples set-version git-tag release-notes check-licenses 
generate-deepcopy generate-client generate-doc build-resources release-helm 
release-staging release-nightly get-staging-repo get-version build-submodules 
set-module-version bundle-kamelets generate-keda generate-strimzi
+.PHONY: do-build build build-kamel build-resources dep codegen images 
images-push images-push-staging test check test-integration clean release 
cross-compile package-examples set-version git-tag release-notes check-licenses 
build-resources release-helm release-staging release-nightly get-staging-repo 
get-version build-submodules set-module-version bundle-kamelets
 .PHONY: controller-gen kubectl kustomize operator-sdk opm
 
 # find or download controller-gen if necessary
@@ -576,7 +576,7 @@ else
 YQ=$(shell command -v yq 2> /dev/null)
 endif
 
-.PHONY: generate-crd $(BUNDLE_CAMEL_APIS) pre-bundle bundle bundle-build
+.PHONY: $(BUNDLE_CAMEL_APIS) pre-bundle bundle bundle-build
 
 # - Have to copy pkg/apis since it is a module in its own right
 # - The dependency of v1alpha1 api on v1 results in duplication
@@ -626,7 +626,7 @@ pre-bundle:
else sed -i '/  version: ${CSV_VERSION}/a \ \ replaces: 
$(CSV_REPLACES)' $(CSV_PATH); \
fi
 
-bundle: set-version generate-crd kustomize operator-sdk pre-bundle 
$(BUNDLE_CAMEL_APIS)
+bundle: set-version kustomize operator-sdk pre-bundle $(BUNDLE_CAMEL_APIS)
@# Display BUNDLE_METADATA_OPTS for debugging
$(info BUNDLE_METADATA_OPTS=$(BUNDLE_METADATA_OPTS))
@# Sets the operator image to the preferred image:tag



[camel-k] 03/04: fix: Add missing inline JSON tags

2023-01-10 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 49e8fdb2ebbfa936128453e8b3b49e2f433e73f7
Author: Antonin Stefanutti 
AuthorDate: Mon Jan 9 14:46:21 2023 +0100

fix: Add missing inline JSON tags
---
 pkg/apis/camel/v1alpha1/error_handler_types.go | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/error_handler_types.go 
b/pkg/apis/camel/v1alpha1/error_handler_types.go
index 0fac0564a..52a32e60a 100644
--- a/pkg/apis/camel/v1alpha1/error_handler_types.go
+++ b/pkg/apis/camel/v1alpha1/error_handler_types.go
@@ -28,17 +28,17 @@ const (
 
 // ErrorHandlerSpec represents an unstructured object for an error handler
 type ErrorHandlerSpec struct {
-   RawMessage `json:",omitempty"`
+   RawMessage `json:",inline,omitempty"`
 }
 
 // ErrorHandlerParameters represent an unstructured object for error handler 
parameters
 type ErrorHandlerParameters struct {
-   RawMessage `json:",omitempty"`
+   RawMessage `json:",inline,omitempty"`
 }
 
 // BeanProperties represent an unstructured object properties to be set on a 
bean
 type BeanProperties struct {
-   RawMessage `json:",omitempty"`
+   RawMessage `json:",inline,omitempty"`
 }
 
 // ErrorHandlerType a type of error handler (ie, sink)



[camel-k] branch main updated (feb78ad6d -> b5e208942)

2023-01-10 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from feb78ad6d chore: nightly resource refresh
 new bc9572e50 api: Add apply configuration generation
 new 72a838155 chore: Remove missing target pre-requisites
 new 49e8fdb2e fix: Add missing inline JSON tags
 new b5e208942 api: Generate apply configurations

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/apis/camel/v1alpha1/error_handler_types.go |   6 +-
 .../applyconfiguration/camel/v1/addontrait.go} |  20 +-
 .../camel/applyconfiguration/camel/v1/artifact.go  |  67 
 .../camel/applyconfiguration/camel/v1/basetask.go  |  40 ++
 .../camel/applyconfiguration/camel/v1/build.go | 220 +++
 .../applyconfiguration/camel/v1/buildahtask.go | 100 +
 .../applyconfiguration/camel/v1/buildcondition.go  |  91 +
 .../applyconfiguration/camel/v1/buildertask.go |  98 +
 .../camel/applyconfiguration/camel/v1/buildspec.go |  68 
 .../applyconfiguration/camel/v1/buildstatus.go | 145 
 .../applyconfiguration/camel/v1/camelartifact.go   | 130 +++
 .../camel/v1/camelartifactdependency.go|  70 
 .../camel/v1/camelartifactexclusion.go |  49 +++
 .../applyconfiguration/camel/v1/camelcatalog.go| 221 
 .../camel/v1/camelcatalogspec.go   |  70 
 .../applyconfiguration/camel/v1/camelloader.go |  81 +
 .../applyconfiguration/camel/v1/camelscheme.go |  76 
 .../camel/v1/camelschemescope.go   |  45 +++
 .../applyconfiguration/camel/v1/capability.go  |  45 +++
 .../camel/v1/configurationspec.go  |  49 +++
 .../camel/applyconfiguration/camel/v1/dataspec.go  | 105 ++
 .../camel/applyconfiguration/camel/v1/failure.go   |  62 
 .../applyconfiguration/camel/v1/failurerecovery.go |  62 
 .../camel/applyconfiguration/camel/v1/flow.go} |  20 +-
 .../applyconfiguration/camel/v1/integration.go | 220 +++
 .../camel/v1/integrationcondition.go   | 100 +
 .../applyconfiguration/camel/v1/integrationkit.go  | 220 +++
 .../camel/v1/integrationkitcondition.go|  91 +
 .../camel/v1/integrationkitspec.go |  98 +
 .../camel/v1/integrationkitstatus.go   | 153 
 .../camel/v1/integrationkittraits.go   |  86 +
 .../camel/v1/integrationplatform.go| 220 +++
 .../camel/v1/integrationplatformbuildspec.go   | 123 +++
 .../camel/v1/integrationplatformcondition.go   |  91 +
 .../v1/integrationplatformkameletrepositoryspec.go |  40 ++
 .../camel/v1/integrationplatformkameletspec.go |  45 +++
 .../camel/v1/integrationplatformspec.go|  94 +
 .../camel/v1/integrationplatformstatus.go  | 145 
 .../applyconfiguration/camel/v1/integrationspec.go | 154 
 .../camel/v1/integrationstatus.go  | 218 +++
 .../applyconfiguration/camel/v1/kanikotask.go  | 100 +
 .../applyconfiguration/camel/v1/kanikotaskcache.go |  49 +++
 .../applyconfiguration/camel/v1/mavenartifact.go   |  58 +++
 .../applyconfiguration/camel/v1/mavenbuildspec.go  | 135 +++
 .../camel/applyconfiguration/camel/v1/mavenspec.go | 113 ++
 .../camel/applyconfiguration/camel/v1/podspec.go   | 150 
 .../applyconfiguration/camel/v1/podspectemplate.go |  40 ++
 .../applyconfiguration/camel/v1/publishtask.go |  67 
 .../applyconfiguration/camel/v1/registryspec.go|  76 
 .../applyconfiguration/camel/v1/repository.go  |  76 
 .../camel/v1/repositorypolicy.go   |  58 +++
 .../applyconfiguration/camel/v1/runtimespec.go | 106 ++
 .../camel/applyconfiguration/camel/v1/s2itask.go   |  58 +++
 .../camel/applyconfiguration/camel/v1/server.go|  71 
 .../applyconfiguration/camel/v1/sourcespec.go  | 151 
 .../applyconfiguration/camel/v1/spectrumtask.go|  73 
 .../camel/applyconfiguration/camel/v1/task.go  |  76 
 .../camel/v1/traitconfiguration.go}|  20 +-
 .../camel/applyconfiguration/camel/v1/traits.go| 401 +
 .../camel/applyconfiguration/camel/v1/traitspec.go |  40 ++
 .../applyconfiguration/camel/v1/valuesource.go |  53 +++
 .../applyconfiguration/camel/v1alpha1/endpoint.go  |  78 
 .../camel/v1alpha1/endpointproperties.go   |  27 +-
 .../camel/v1alpha1/errorhandlerspec.go |  27 +-
 .../camel/v1alpha1/eventtypespec.go|  49 +++
 .../camel/v1alpha1/externaldocumentation.go|  49 +++
 .../applyconfiguration/ca

[camel-k] branch main updated (9ae24ac98 -> e614c49c9)

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from 9ae24ac98 chore(deps): bump golang.org/x/oauth2 from 0.3.0 to 0.4.0
 new 20109dcd7 chore: Upgrade k8s to version 1.25.2
 new 913b3169c chore: Upgrade Knative to version 1.8.3
 new 2e1dd0598 chore: Fix cloudevents/sdk-go dependency
 new a086d5a05 chore: Upgrade controller-runtime to v0.13.1
 new 34971ce69 chore: Upgrade Golang to version 1.18
 new 0bdf91706 chore: Upgrade code-generator to version 0.25.2
 new 6620a4934 chore: Rebuild generated clients
 new 2a28a2187 chore: Generate CRDs based on k8s v1.25.2
 new ee0955f2a chore: Rebuild resources
 new 7143f11c9 fix: Use go install Kustomize
 new b789d4488 fix: Upgrade Kustomize to version 4.5.4
 new 376d08825 Fix lint errors
 new ffb305859 fix: Use go install controller-gen
 new e614c49c9 fix: Download opm binary instead of go install

The 14 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/actions/kamel-prepare-env/action.yml   |4 +-
 .github/workflows/release.yml  |2 +-
 .github/workflows/validate.yml |2 +-
 .github/workflows/verify-generate.yml  |2 +-
 .../duck/client/internalclientset/clientset.go |4 +
 .../duck/client/internalclientset/fake/register.go |   14 +-
 .../client/internalclientset/scheme/register.go|   14 +-
 cmd/util/doc-gen/generators/traitdocgen.go |8 +-
 .../crd/bases/camel.apache.org_integrations.yaml   | 1089 +++-
 .../bases/camel.apache.org_kameletbindings.yaml| 1077 ++-
 go.mod |   63 +-
 go.sum |  721 ++---
 helm/camel-k/crds/crd-integration.yaml | 1089 +++-
 helm/camel-k/crds/crd-kamelet-binding.yaml | 1077 ++-
 pkg/apis/camel/go.mod  |   21 +-
 pkg/apis/camel/go.sum  |  192 +---
 pkg/client/camel/clientset/versioned/clientset.go  |4 +
 .../camel/clientset/versioned/fake/register.go |   14 +-
 .../camel/clientset/versioned/scheme/register.go   |   14 +-
 pkg/client/camel/go.mod|   47 +-
 pkg/client/camel/go.sum|  245 +
 pkg/cmd/describe.go|7 +-
 pkg/cmd/version.go |5 +-
 pkg/kamelet/repository/go.mod  |   48 +-
 pkg/kamelet/repository/go.sum  |  245 +
 pkg/resources/resources.go |8 +-
 script/Makefile|   39 +-
 script/build_install_opm.sh|   37 -
 28 files changed, 2733 insertions(+), 3359 deletions(-)
 delete mode 100755 script/build_install_opm.sh



[camel-k] 12/14: Fix lint errors

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 376d088255d181e25a4f2e23b5df9316db45cf25
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 14:24:33 2023 +0100

Fix lint errors
---
 cmd/util/doc-gen/generators/traitdocgen.go | 8 +---
 pkg/cmd/describe.go| 7 +--
 pkg/cmd/version.go | 5 -
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/cmd/util/doc-gen/generators/traitdocgen.go 
b/cmd/util/doc-gen/generators/traitdocgen.go
index 337617a30..2ac26acf0 100644
--- a/cmd/util/doc-gen/generators/traitdocgen.go
+++ b/cmd/util/doc-gen/generators/traitdocgen.go
@@ -27,7 +27,8 @@ import (
"sort"
"strings"
 
-   "github.com/apache/camel-k/pkg/util"
+   "golang.org/x/text/cases"
+   "golang.org/x/text/language"
 
"k8s.io/gengo/args"
"k8s.io/gengo/generator"
@@ -35,6 +36,7 @@ import (
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/trait"
+   "github.com/apache/camel-k/pkg/util"
 )
 
 const (
@@ -147,7 +149,7 @@ func traitNameFromFile(file string) string {
name = strings.ReplaceAll(name, "trait", "")
name = strings.ReplaceAll(name, "-", " ")
name = strings.Trim(name, " ")
-   name = strings.Title(name)
+   name = cases.Title(language.English).String(name)
return name
 }
 
@@ -159,7 +161,7 @@ func writeTitle(traitID string, content *[]string) {
return
}
}
-   res = append([]string{"= " + strings.Title(strings.ReplaceAll(traitID, 
"-", " ")) + " Trait"}, res...)
+   res = append([]string{"= " + 
cases.Title(language.English).String(strings.ReplaceAll(traitID, "-", " ")) + " 
Trait"}, res...)
*content = res
 }
 
diff --git a/pkg/cmd/describe.go b/pkg/cmd/describe.go
index 5252f753a..ab77c4234 100644
--- a/pkg/cmd/describe.go
+++ b/pkg/cmd/describe.go
@@ -21,6 +21,9 @@ import (
"strings"
"time"
 
+   "golang.org/x/text/cases"
+   "golang.org/x/text/language"
+
"github.com/spf13/cobra"
 
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -60,10 +63,10 @@ func describeTraits(w *indentedwriter.Writer, traits 
interface{}) error {
w.Writef(0, "Traits:\n")
 
for id, trait := range traitMap {
-   w.Writef(1, "%s:\n", strings.Title(id))
+   w.Writef(1, "%s:\n", 
cases.Title(language.English).String(id))
// TODO: print the whole TraitSpec as Yaml
for k, v := range trait {
-   w.Writef(2, "%s:\t%v\n", strings.Title(k), v)
+   w.Writef(2, "%s:\t%v\n", 
cases.Title(language.English).String(k), v)
}
}
}
diff --git a/pkg/cmd/version.go b/pkg/cmd/version.go
index e789fb9b7..d0ba44dc9 100644
--- a/pkg/cmd/version.go
+++ b/pkg/cmd/version.go
@@ -22,6 +22,9 @@ import (
"fmt"
"strings"
 
+   "golang.org/x/text/cases"
+   "golang.org/x/text/language"
+
k8serrors "k8s.io/apimachinery/pkg/api/errors"
 
"github.com/Masterminds/semver"
@@ -164,7 +167,7 @@ func operatorInfo(ctx context.Context, c client.Client, 
namespace string) (map[s
 func fromCamelCase(infos map[string]string) map[string]string {
textKeys := make(map[string]string)
for k, v := range infos {
-   key := strings.Title(strings.Join(camelcase.Split(k), " "))
+   key := 
cases.Title(language.English).String(strings.Join(camelcase.Split(k), " "))
textKeys[key] = v
}
 



[camel-k] 02/14: chore: Upgrade Knative to version 1.8.3

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 913b3169cd8d1777f2076cb03d2ee8ee38fdf649
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:18:20 2023 +0100

chore: Upgrade Knative to version 1.8.3
---
 go.mod |  6 +++---
 go.sum | 12 ++--
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/go.mod b/go.mod
index ea8aacc42..d765dea70 100644
--- a/go.mod
+++ b/go.mod
@@ -58,9 +58,9 @@ require (
k8s.io/klog/v2 v2.70.2-0.20220707122935-0990e81f1a8f
k8s.io/kubectl v0.25.2
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed
-   knative.dev/eventing v0.33.0
-   knative.dev/pkg v0.0.0-20221011175852-714b7630a836
-   knative.dev/serving v0.33.0
+   knative.dev/eventing v0.35.3
+   knative.dev/pkg v0.0.0-20221123011842-b78020c16606
+   knative.dev/serving v0.35.3
sigs.k8s.io/controller-runtime v0.11.2
 )
 
diff --git a/go.sum b/go.sum
index d63831675..8e66af546 100644
--- a/go.sum
+++ b/go.sum
@@ -2141,14 +2141,14 @@ k8s.io/utils v0.0.0-20210707171843-4b05e18ac7d9/go.mod 
h1:jPW/WVKK9YHAvNhRxK0md/
 k8s.io/utils v0.0.0-20210802155522-efc7438f0176/go.mod 
h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
 k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed 
h1:jAne/RjBTyawwAy0utX5eqigAwz/lQhTmy+Hr/Cpue4=
 k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed/go.mod 
h1:jPW/WVKK9YHAvNhRxK0md/EJ228hCsBRufyofKtW8HA=
-knative.dev/eventing v0.33.0 h1:z+g/qLKI0mWPejY6Ck4lnjdoLTvMehlIAqpLbyXcEZs=
-knative.dev/eventing v0.33.0/go.mod 
h1:rxI/ijzHbAYenRZpGapYlJHwGEfdUcWjJh4N1bP9+zQ=
+knative.dev/eventing v0.35.3 h1:lGFQpXL84fRgkqZGE/T7ggG3MX26qYcFhFFykFr1Scs=
+knative.dev/eventing v0.35.3/go.mod 
h1:9Q+Y4Rodnu3EcX1VXY95mKCisysi2RCCOE7H5gCxbM0=
 knative.dev/networking v0.0.0-20221012062251-58f3e6239b4f 
h1:e/08+ofUjGjSYV2Usvb22IbkX4MjoiywbRtnXUK3FQY=
 knative.dev/networking v0.0.0-20221012062251-58f3e6239b4f/go.mod 
h1:GciicKYf4aWE138pT2ZKkZ/E10rd0Kt4ziX52A/HnVY=
-knative.dev/pkg v0.0.0-20221011175852-714b7630a836 
h1:0N7Zo/O+xeUUebJPm9keBaGclrUoEbljr3J1MsqtaIM=
-knative.dev/pkg v0.0.0-20221011175852-714b7630a836/go.mod 
h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8=
-knative.dev/serving v0.33.0 h1:g/pKd0HhboZ6uBIrDl1X7lH43k+Ow8GpBth90lQNzqM=
-knative.dev/serving v0.33.0/go.mod 
h1:6tBCyhVH14YTDfHQMMeF1gP0oLp3tkjHU2cBeZ6oZP4=
+knative.dev/pkg v0.0.0-20221123011842-b78020c16606 
h1:bHozIhJtQE9/SVQkVX2vqnoJGJt6zo7J0jnkLFX3Crw=
+knative.dev/pkg v0.0.0-20221123011842-b78020c16606/go.mod 
h1:DMTRDJ5WRxf/DrlOPzohzfhSuJggscLZ8EavOq9O/x8=
+knative.dev/serving v0.35.3 h1:baaP1GLv/oEuo74MktAdQ5hw5OqtZek9+6IqG+yMlzs=
+knative.dev/serving v0.35.3/go.mod 
h1:O2TMcl0mC8RWlRXHaMksAY+VoKBwvA4iSiweSouAc4Q=
 mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48=
 mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed/go.mod 
h1:Xkxe497xwlCKkIaQYRfC7CSLworTXY9RMqwhhCm+8Nc=
 mvdan.cc/lint v0.0.0-20170908181259-adc824a0674b/go.mod 
h1:2odslEg/xrtNQqCYg2/jCoyKnw3vv5biOc3JnIcYfL4=



[camel-k] 05/14: chore: Upgrade Golang to version 1.18

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 34971ce69f57b4ee5c97de3399d9628e4bf6966e
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:35:13 2023 +0100

chore: Upgrade Golang to version 1.18
---
 .github/actions/kamel-prepare-env/action.yml | 4 ++--
 .github/workflows/release.yml| 2 +-
 .github/workflows/validate.yml   | 2 +-
 .github/workflows/verify-generate.yml| 2 +-
 go.mod   | 2 +-
 pkg/apis/camel/go.mod| 2 +-
 pkg/client/camel/go.mod  | 2 +-
 pkg/kamelet/repository/go.mod| 2 +-
 8 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/.github/actions/kamel-prepare-env/action.yml 
b/.github/actions/kamel-prepare-env/action.yml
index 66cbaf7ef..c7788cbd6 100644
--- a/.github/actions/kamel-prepare-env/action.yml
+++ b/.github/actions/kamel-prepare-env/action.yml
@@ -68,11 +68,11 @@ runs:
   with:
 version: "11"
 
-- name: Set Go
+- name: Set up Go
   uses: actions/setup-go@v2 # Version 2 adds GOBIN to PATH
   if: ${{ env.KAMEL_PREPARE_ENV != 'true' }}
   with:
-go-version: 1.17.x
+go-version: 1.18.x
 
 - name: (Re-)install kustomize
   shell: bash
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index da79d2a3e..fe4ba55d6 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -39,7 +39,7 @@ jobs:
 - name: Release main nightly
   uses: ./.github/actions/release-nightly
   with:
-goVersion: "1.17.x"
+goVersion: "1.18.x"
 javaVersion: "11"
 secretE2ECluster: ${{ secrets.E2E_CLUSTER_CONFIG }}
 secretE2EKube: ${{ secrets.E2E_KUBE_CONFIG }}
diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml
index c474055c3..26fb12dd6 100644
--- a/.github/workflows/validate.yml
+++ b/.github/workflows/validate.yml
@@ -40,7 +40,7 @@ jobs:
   - name: Install Go
 uses: actions/setup-go@v2
 with:
-  go-version: 1.17.x
+  go-version: 1.18.x
   - name: golangci-lint
 uses: golangci/golangci-lint-action@v3
 env:
diff --git a/.github/workflows/verify-generate.yml 
b/.github/workflows/verify-generate.yml
index 00ea3cb9c..70d6c6de2 100644
--- a/.github/workflows/verify-generate.yml
+++ b/.github/workflows/verify-generate.yml
@@ -62,7 +62,7 @@ jobs:
   - name: Install Go
 uses: actions/setup-go@v2
 with:
-  go-version: 1.17.x
+  go-version: 1.18.x
   - name: Test generate
 shell: bash
 run: make generate
diff --git a/go.mod b/go.mod
index c52585c35..e89683e52 100644
--- a/go.mod
+++ b/go.mod
@@ -1,6 +1,6 @@
 module github.com/apache/camel-k
 
-go 1.17
+go 1.18
 
 require (
github.com/Masterminds/semver v1.5.0
diff --git a/pkg/apis/camel/go.mod b/pkg/apis/camel/go.mod
index a1b406454..543fc397b 100644
--- a/pkg/apis/camel/go.mod
+++ b/pkg/apis/camel/go.mod
@@ -1,6 +1,6 @@
 module github.com/apache/camel-k/pkg/apis/camel
 
-go 1.17
+go 1.18
 
 require (
github.com/imdario/mergo v0.3.13
diff --git a/pkg/client/camel/go.mod b/pkg/client/camel/go.mod
index 892cc0f9d..dd8c14f5c 100644
--- a/pkg/client/camel/go.mod
+++ b/pkg/client/camel/go.mod
@@ -1,6 +1,6 @@
 module github.com/apache/camel-k/pkg/client/camel
 
-go 1.17
+go 1.18
 
 require (
github.com/apache/camel-k/pkg/apis/camel v0.0.0
diff --git a/pkg/kamelet/repository/go.mod b/pkg/kamelet/repository/go.mod
index d5a24f500..022b33b2a 100644
--- a/pkg/kamelet/repository/go.mod
+++ b/pkg/kamelet/repository/go.mod
@@ -1,6 +1,6 @@
 module github.com/apache/camel-k/pkg/kamelet/repository
 
-go 1.17
+go 1.18
 
 require (
github.com/apache/camel-k/pkg/apis/camel v0.0.0



[camel-k] 09/14: chore: Rebuild resources

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit ee0955f2a97376d4f7dc86da234b5edcb3823946
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:46:10 2023 +0100

chore: Rebuild resources
---
 pkg/resources/resources.go | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pkg/resources/resources.go b/pkg/resources/resources.go
index b4af77469..ee20d80a1 100644
--- a/pkg/resources/resources.go
+++ b/pkg/resources/resources.go
@@ -145,16 +145,16 @@ var assets = func() http.FileSystem {
"/crd/bases/camel.apache.org_integrations.yaml": 
۰CompressedFileInfo{
name: "camel.apache.org_integrations.yaml",
modTime:  time.Time{},
-   uncompressedSize: 479896,
+   uncompressedSize: 487787,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\xb6\x28\x8a\xff\xef\x4f\x81\x72\x52\x47\xd2\x8e\x48\xd9\x99\x39\xa9\x3d\xfe\x4d\x9d\x94\x46\x92\x13\xfd\x62\xcb\x2c\x4b\x49\x4e\xca\xc9\x4e\xc0\x6e\x90\xc4\x56\x13\xe8\x01\xd0\x94\x38\x37\xf7\xbb\xdf\xc2\x02\xd0\x0f\xbe\x7a\xa1\x45\x3a\xce\x9e\xc6\x54\x65\x4c\x91\xbd\x1a\x8f\x85\xf5\x7e\x7c\x46\x06\xfb\x1b\xcf\x3e\x23\x6f\x78\xc2\x84\x66\x29\x31\x92\x98\x19\x23\xe7\x39\x4d\x66\x8c\xdc\xca\x89\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x1b\x37\x96\x30\x8c\xff\x9f\x4f\x81\x72\x52\x8f\xa4\x8d\x48\xd9\x99\xd9\xa9\x19\xff\xa6\x9e\x94\x56\x96\x13\xfd\x62\xcb\x2a\x4b\x49\x9e\x94\x93\x4d\xc0\x6e\x90\xc4\xa3\x6e\xa0\x17\x40\x53\xe2\xbc\x79\xbf\xfb\x5b\x38\x00\xfa\xc2\x5b\x1f\xb4\x48\xc7\xd9\x6d\x4c\x55\xc6\x14\xd9\xa7\x71\x39\x38\xf7\xcb\xe7\x64\xb4\xbf\xf1\xd9\xe7\xe4\x0d\x4f\x98\xd0\x2c\x25\x46\x12\x33\x67\xe4\xbc\xa0\xc9\x9c\x91\x5b\x39\x
 [...]
},
"/crd/bases/camel.apache.org_kameletbindings.yaml": 
۰CompressedFileInfo{
name: 
"camel.apache.org_kameletbindings.yaml",
modTime:  time.Time{},
-   uncompressedSize: 555683,
+   uncompressedSize: 564048,
 
-   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x7b\x73\x23\xb7\xb5\x28\x8a\xff\xef\x4f\x81\x1a\xbb\x8e\xa4\x6d\x91\x9a\x71\xb2\x53\x3b\xf3\x4b\x1d\x97\xa2\xd1\xd8\xfa\x79\x46\xc3\x1a\xc9\xce\x71\x8d\xbd\x1d\xb0\x1b\x24\x71\xd4\x04\x7a\x03\x68\x4a\xcc\xf5\xfd\xee\xb7\xb0\x00\x74\xa3\xf9\x12\x56\x53\x52\x34\x49\x23\x55\xce\x90\x62\xaf\xc6\x6b\xbd\x5f\x5f\x92\xc1\xc3\x8d\x2f\xbe\x24\xef\x78\xc6\x84\x66\x39\x31\x92\x98\x19\x23\xa7\x25\xcd\x66\x8c\x5c\xc9\x89\x
 [...]
+   compressedContent: 
[]byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xec\xfd\x79\x73\x1b\x37\xd6\x28\x8c\xff\xef\x4f\x81\x92\x53\x57\xd2\x13\x91\xb2\x33\x4b\xcd\xf8\x37\x75\x53\x1a\x59\x76\xf4\x8b\x2d\xb3\x2c\x25\xb9\x29\x27\x4f\x02\x76\x83\x24\xae\xba\x81\x7e\x00\x34\x25\xe6\xf5\xfb\xdd\xdf\xc2\x01\xd0\x0b\x37\xe1\x34\x25\x8d\x3c\xd3\x98\xaa\x8c\x49\xb1\x4f\x63\x3b\xfb\xf6\x9c\x0c\xee\x6f\x3c\x7b\x4e\xde\xf1\x84\x09\xcd\x52\x62\x24\x31\x33\x46\x4e\x0a\x9a\xcc\x18\xb9\x94\x13\x73\x43\x
 [...]
},
"/crd/bases/camel.apache.org_kamelets.yaml": 
۰CompressedFileInfo{
name: "camel.apache.org_kamelets.yaml",



[camel-k] 06/14: chore: Upgrade code-generator to version 0.25.2

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 0bdf91706d1c6b347d38cd037e9d80faee350956
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:41:13 2023 +0100

chore: Upgrade code-generator to version 0.25.2
---
 script/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/script/Makefile b/script/Makefile
index 42223754b..358d91025 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -27,7 +27,7 @@ RUNTIME_VERSION := 1.17.0-SNAPSHOT
 BUILDAH_VERSION := 1.23.3
 KANIKO_VERSION := 0.17.1
 CONTROLLER_GEN_VERSION := v0.6.1
-CODEGEN_VERSION := v0.23.5
+CODEGEN_VERSION := v0.25.2
 OPERATOR_SDK_VERSION := v1.16.0
 KUSTOMIZE_VERSION := v4.1.2
 OPM_VERSION := v1.24.0



[camel-k] 03/14: chore: Fix cloudevents/sdk-go dependency

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 2e1dd05983138195c6ccebb555867b5b5c5e51b9
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:27:44 2023 +0100

chore: Fix cloudevents/sdk-go dependency
---
 go.mod | 2 +-
 go.sum | 6 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/go.mod b/go.mod
index d765dea70..edceeca01 100644
--- a/go.mod
+++ b/go.mod
@@ -85,7 +85,7 @@ require (
github.com/blendle/zapdriver v1.3.1 // indirect
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
-   github.com/cloudevents/sdk-go/sql/v2 v2.8.0 // indirect
+   github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a 
// indirect
github.com/cloudevents/sdk-go/v2 v2.12.0 // indirect
github.com/containerd/continuity v0.1.0 // indirect
github.com/containerd/stargz-snapshotter/estargz v0.11.1 // indirect
diff --git a/go.sum b/go.sum
index 8e66af546..5dc925bcf 100644
--- a/go.sum
+++ b/go.sum
@@ -159,7 +159,6 @@ github.com/andybalholm/brotli v1.0.3/go.mod 
h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHG
 github.com/antihax/optional v0.0.0-20180407024304-ca021399b1a6/go.mod 
h1:V8iCPQYkqmusNa815XgQio277wI47sdRh1dUOLdyC6Q=
 github.com/antihax/optional v1.0.0/go.mod 
h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
 github.com/antlr/antlr4/runtime/Go/antlr 
v0.0.0-20210826220005-b48c857c3a0e/go.mod 
h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
-github.com/antlr/antlr4/runtime/Go/antlr 
v0.0.0-20211221011931-643d94fcab96/go.mod 
h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
 github.com/antlr/antlr4/runtime/Go/antlr v1.4.10 
h1:yL7+Jz0jTC6yykIK/Wh74gnTJnrGr5AyrNMXuA0gves=
 github.com/antlr/antlr4/runtime/Go/antlr v1.4.10/go.mod 
h1:F7bn7fEU90QkQ3tnmaTx3LTKLEDqnwWODIYppRQ5hnY=
 github.com/aokoli/goutils v1.0.1/go.mod 
h1:SijmP0QR8LtwsmDs8Yii5Z/S4trXFGFC2oO5g9DP+DQ=
@@ -231,9 +230,8 @@ github.com/cilium/ebpf v0.2.0/go.mod 
h1:To2CFviqOWL/M0gIMsvSMlqe7em/l1ALkX1PyjrX
 github.com/cilium/ebpf v0.4.0/go.mod 
h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
 github.com/cilium/ebpf v0.6.2/go.mod 
h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs=
 github.com/client9/misspell v0.3.4/go.mod 
h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
-github.com/cloudevents/sdk-go/sql/v2 v2.8.0 
h1:gWednxJHL0Ycf93XeEFyQxYj81A7b4eNwkzjNxGunAM=
-github.com/cloudevents/sdk-go/sql/v2 v2.8.0/go.mod 
h1:u9acNJbhmi1wnDJro4PEAqbr4N1LTCyEUClErxbPS1A=
-github.com/cloudevents/sdk-go/v2 v2.8.0/go.mod 
h1:GpCBmUj7DIRiDhVvsK5d6WCbgTWs8DxAWTRtAwQmIXs=
+github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a 
h1:jwFoLdIzNYc92s2ZwhU4yOdoPP8zoALcKOzenIALHJM=
+github.com/cloudevents/sdk-go/sql/v2 v2.0.0-20220930150014-52b12276cc4a/go.mod 
h1:SPV4fdKh1YqSNn2TTUVqUcw1El9Er0HI/yzay5wqsFk=
 github.com/cloudevents/sdk-go/v2 v2.12.0 
h1:p1k+ysVOZtNiXfijnwB3WqZNA3y2cGOiKQygWkUHCEI=
 github.com/cloudevents/sdk-go/v2 v2.12.0/go.mod 
h1:xDmKfzNjM8gBvjaF8ijFjM1VYOVUEeUfapHMUX1T5To=
 github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod 
h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=



[camel-k] 04/14: chore: Upgrade controller-runtime to v0.13.1

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit a086d5a05a3fb19b9185abc041b0b1ba83a017f0
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:28:25 2023 +0100

chore: Upgrade controller-runtime to v0.13.1
---
 go.mod | 2 +-
 go.sum | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/go.mod b/go.mod
index edceeca01..c52585c35 100644
--- a/go.mod
+++ b/go.mod
@@ -61,7 +61,7 @@ require (
knative.dev/eventing v0.35.3
knative.dev/pkg v0.0.0-20221123011842-b78020c16606
knative.dev/serving v0.35.3
-   sigs.k8s.io/controller-runtime v0.11.2
+   sigs.k8s.io/controller-runtime v0.13.1
 )
 
 require (
diff --git a/go.sum b/go.sum
index 5dc925bcf..dc9bea9c4 100644
--- a/go.sum
+++ b/go.sum
@@ -2160,8 +2160,8 @@ sigs.k8s.io/apiserver-network-proxy/konnectivity-client 
v0.0.15/go.mod h1:LEScyz
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.19/go.mod 
h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
 sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.0.22/go.mod 
h1:LEScyzhFmoF5pso/YSeBstl57mOzx9xlU9n85RGrDQg=
 sigs.k8s.io/controller-runtime v0.10.0/go.mod 
h1:GCdh6kqV6IY4LK0JLwX0Zm6g233RtVGdb/f0+KSfprg=
-sigs.k8s.io/controller-runtime v0.11.2 
h1:H5GTxQl0Mc9UjRJhORusqfJCIjBO8UtUxGggCwL1rLA=
-sigs.k8s.io/controller-runtime v0.11.2/go.mod 
h1:P6QCzrEjLaZGqHsfd+os7JQ+WFZhvB8MRFsn4dWF7O4=
+sigs.k8s.io/controller-runtime v0.13.1 
h1:tUsRCSJVM1QQOOeViGeX3GMT3dQF1eePPw6sEE3xSlg=
+sigs.k8s.io/controller-runtime v0.13.1/go.mod 
h1:Zbz+el8Yg31jubvAEyglRZGdLAjplZl+PgtYNI6WNTI=
 sigs.k8s.io/controller-tools v0.6.2/go.mod 
h1:oaeGpjXn6+ZSEIQkUe/+3I40PNiDYp9aeawbt3xTgJ8=
 sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 
h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=
 sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2/go.mod 
h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0=



[camel-k] 11/14: fix: Upgrade Kustomize to version 4.5.4

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit b789d44883abff4ef23abe4512c9376c61b3e9fd
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 13:12:46 2023 +0100

fix: Upgrade Kustomize to version 4.5.4
---
 script/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/script/Makefile b/script/Makefile
index 30dad605d..f454eba96 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -29,7 +29,7 @@ KANIKO_VERSION := 0.17.1
 CONTROLLER_GEN_VERSION := v0.6.1
 CODEGEN_VERSION := v0.25.2
 OPERATOR_SDK_VERSION := v1.16.0
-KUSTOMIZE_VERSION := v4.1.2
+KUSTOMIZE_VERSION := v4.5.4
 OPM_VERSION := v1.24.0
 BASE_IMAGE := docker.io/adoptopenjdk/openjdk11:slim
 LOCAL_REPOSITORY := /tmp/artifacts/m2



[camel-k] 07/14: chore: Rebuild generated clients

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 6620a4934fd61d375c2faa7629b8095250f63f2c
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 12:43:52 2023 +0100

chore: Rebuild generated clients
---
 addons/strimzi/duck/client/internalclientset/clientset.go  |  4 
 .../strimzi/duck/client/internalclientset/fake/register.go | 14 +++---
 .../duck/client/internalclientset/scheme/register.go   | 14 +++---
 pkg/client/camel/clientset/versioned/clientset.go  |  4 
 pkg/client/camel/clientset/versioned/fake/register.go  | 14 +++---
 pkg/client/camel/clientset/versioned/scheme/register.go| 14 +++---
 6 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/addons/strimzi/duck/client/internalclientset/clientset.go 
b/addons/strimzi/duck/client/internalclientset/clientset.go
index 2446af8e3..dc36e60e5 100644
--- a/addons/strimzi/duck/client/internalclientset/clientset.go
+++ b/addons/strimzi/duck/client/internalclientset/clientset.go
@@ -62,6 +62,10 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface 
{
 func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
 
+   if configShallowCopy.UserAgent == "" {
+   configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
+   }
+
// share the transport between all clients
httpClient, err := rest.HTTPClientFor()
if err != nil {
diff --git a/addons/strimzi/duck/client/internalclientset/fake/register.go 
b/addons/strimzi/duck/client/internalclientset/fake/register.go
index b03a9f805..04aa54821 100644
--- a/addons/strimzi/duck/client/internalclientset/fake/register.go
+++ b/addons/strimzi/duck/client/internalclientset/fake/register.go
@@ -38,14 +38,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.
diff --git a/addons/strimzi/duck/client/internalclientset/scheme/register.go 
b/addons/strimzi/duck/client/internalclientset/scheme/register.go
index bb376affd..7c58dd36c 100644
--- a/addons/strimzi/duck/client/internalclientset/scheme/register.go
+++ b/addons/strimzi/duck/client/internalclientset/scheme/register.go
@@ -38,14 +38,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{
 // AddToScheme adds all types of this clientset into the given scheme. This 
allows composition
 // of clientsets, like in:
 //
-//   import (
-// "k8s.io/client-go/kubernetes"
-// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
-// aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
-//   )
+// import (
+//   "k8s.io/client-go/kubernetes"
+//   clientsetscheme "k8s.io/client-go/kubernetes/scheme"
+//   aggregatorclientsetscheme 
"k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
+// )
 //
-//   kclientset, _ := kubernetes.NewForConfig(c)
-//   _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
+// kclientset, _ := kubernetes.NewForConfig(c)
+// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
 //
 // After this, RawExtensions in Kubernetes types will serialize 
kube-aggregator types
 // correctly.
diff --git a/pkg/client/camel/clientset/versioned/clientset.go 
b/pkg/client/camel/clientset/versioned/clientset.go
index 1812c4fe3..935ba0d52 100644
--- a/pkg/client/camel/clientset/versioned/clientset.go
+++ b/pkg/client/camel/clientset/versioned/clientset.go
@@ -70,6 +70,10 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface 
{
 func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
 
+   if configShallowCopy.UserAgent == "" {
+   configShallowCopy.UserAgent = rest.DefaultKubernetesUserAgent()
+   }
+
// share the t

[camel-k] 14/14: fix: Download opm binary instead of go install

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit e614c49c9837cce9d2b4c85f517a5343a8f1452c
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 14:43:25 2023 +0100

fix: Download opm binary instead of go install
---
 script/Makefile | 17 +++--
 script/build_install_opm.sh | 37 -
 2 files changed, 15 insertions(+), 39 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index 6cd07a512..b9e17b711 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -546,11 +546,24 @@ else
 OPERATOR_SDK=$(shell command -v operator-sdk 2> /dev/null)
 endif
 
-opm:
+opm: detect-os
 ifeq (, $(shell command -v opm 2> /dev/null))
-   @OPM_VERSION=$(OPM_VERSION) ./script/build_install_opm.sh
+   @{ \
+   set -e ;\
+   curl \
+   -L 
https://github.com/operator-framework/operator-registry/releases/download/$(OPM_VERSION)/$(OS_LOWER)-amd64-opm
 \
+   -o opm; \
+   chmod +x opm;\
+   mkdir -p $(GOBIN) ;\
+   mv opm $(GOBIN)/ ;\
+   }
 OPM=$(GOBIN)/opm
 else
+   @{ \
+   echo -n "opm already installed: "; \
+  opm version | sed -n 's/.*"v\([^"]*\)".*/\1/p'; \
+   echo " If this is less than $(OPM_VERSION) then please consider moving 
it aside and allowing the approved version to be downloaded."; \
+   }
 OPM=$(shell command -v opm 2> /dev/null)
 endif
 
diff --git a/script/build_install_opm.sh b/script/build_install_opm.sh
deleted file mode 100755
index 795a5bb7b..0
--- a/script/build_install_opm.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-set +e
-
-check_env_var() {
-  if [ -z "${2}" ]; then
-echo "Error: ${1} env var not defined"
-exit 1
-  fi
-}
-
-check_env_var "OPM_VERSION" ${OPM_VERSION}
-
-OPM_PKG=github.com/operator-framework/operator-registry
-#
-# Timestamp for the building of the operator
-#
-BUILD_TIME=$(date +%Y-%m-%dT%H:%M:%S%z)
-
-OPM_GEN_TMP_DIR=$(mktemp -d)
-echo "Using temporary directory ${OPM_GEN_TMP_DIR}"
-cd ${OPM_GEN_TMP_DIR}
-
-go mod init tmp ;\
-go get \
-  -ldflags '-w -extldflags "-static"' -tags "json1" \
-  -ldflags "-X '${OPM_PKG}/cmd/opm/version.opmVersion=${OPM_VERSION}'" \
-  ${OPM_PKG}/cmd/opm@${OPM_VERSION} ;\
-
-if [ $? != 0 ]; then
-  echo "Error: Failed to install opm version ${OPM_VERSION}"
-  exit 1
-fi
-
-echo "OPM Version ..."
-opm version
-
-rm -rf ${OPM_GEN_TMP_DIR}



[camel-k] 13/14: fix: Use go install controller-gen

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit ffb305859ac6ce1298da6ae21909d0aa0007e513
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 14:38:28 2023 +0100

fix: Use go install controller-gen
---
 script/Makefile | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index f454eba96..6cd07a512 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -506,14 +506,7 @@ get-staging-repo:
 # find or download controller-gen if necessary
 controller-gen:
 ifeq (, $(shell command -v controller-gen 2> /dev/null))
-   @{ \
-   set -e ;\
-   CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
-   cd $$CONTROLLER_GEN_TMP_DIR ;\
-   go mod init tmp ;\
-   go get 
sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION) ;\
-   rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
-   }
+   go install 
sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_GEN_VERSION)
 CONTROLLER_GEN=$(GOBIN)/controller-gen
 else
 CONTROLLER_GEN=$(shell command -v controller-gen 2> /dev/null)



[camel-k] 10/14: fix: Use go install Kustomize

2023-01-09 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 7143f11c9a81d61a9fe7d1b27ceeebdf2e7fd0ea
Author: Antonin Stefanutti 
AuthorDate: Thu Jan 5 13:12:14 2023 +0100

fix: Use go install Kustomize
---
 script/Makefile | 9 +
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index 358d91025..30dad605d 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -526,14 +526,7 @@ endif
 
 kustomize:
 ifeq (, $(shell command -v kustomize 2> /dev/null))
-   @{ \
-   set -e ;\
-   KUSTOMIZE_GEN_TMP_DIR=$$(mktemp -d) ;\
-   cd $$KUSTOMIZE_GEN_TMP_DIR ;\
-   go mod init tmp ;\
-   go get sigs.k8s.io/kustomize/kustomize/v4@$(KUSTOMIZE_VERSION) ;\
-   rm -rf $$KUSTOMIZE_GEN_TMP_DIR ;\
-   }
+   go install sigs.k8s.io/kustomize/kustomize/v4@$(KUSTOMIZE_VERSION)
 KUSTOMIZE=$(GOBIN)/kustomize
 else
 KUSTOMIZE=$(shell command -v kustomize 2> /dev/null)



[camel-k] branch release-1.10.x updated: fix(GC): Default to APIResourceList group when APIResource group is empty

2022-11-23 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti pushed a commit to branch release-1.10.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.10.x by this push:
 new a0628b0e6 fix(GC): Default to APIResourceList group when APIResource 
group is empty
a0628b0e6 is described below

commit a0628b0e66d29388373c0baea2ce77b9b2f9626b
Author: Antonin Stefanutti 
AuthorDate: Tue Nov 22 11:19:04 2022 +0100

fix(GC): Default to APIResourceList group when APIResource group is empty
---
 pkg/trait/gc.go | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index 755b51b9a..dd4d7dc64 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -221,14 +221,23 @@ func (t *gcTrait) getDeletableTypes(e *Environment) 
(map[schema.GroupVersionKind
GVKs := make(map[schema.GroupVersionKind]struct{})
for _, APIResourceList := range APIResourceLists {
for _, resource := range APIResourceList.APIResources {
+   resourceGroup := resource.Group
+   if resourceGroup == "" {
+   // Empty implies the group of the containing 
resource list should be used
+   gv, err := 
schema.ParseGroupVersion(APIResourceList.GroupVersion)
+   if err != nil {
+   return nil, err
+   }
+   resourceGroup = gv.Group
+   }
rule:
for _, rule := range ssrr.Status.ResourceRules {
if !util.StringSliceContainsAnyOf(rule.Verbs, 
"delete", "*") {
continue
}
-   for _, group := range rule.APIGroups {
-   for _, name := range rule.Resources {
-   if (resource.Group == group || 
group == "*") && (resource.Name == name || name == "*") {
+   for _, ruleGroup := range rule.APIGroups {
+   for _, ruleResource := range 
rule.Resources {
+   if (resourceGroup == ruleGroup 
|| ruleGroup == "*") && (resource.Name == ruleResource || ruleResource == "*") {
GVK := 
schema.FromAPIVersionAndKind(APIResourceList.GroupVersion, resource.Kind)
GVKs[GVK] = struct{}{}
break rule



[camel-k] branch main updated: fix(GC): Default to APIResourceList group when APIResource group is empty

2022-11-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 fe448dff5 fix(GC): Default to APIResourceList group when APIResource 
group is empty
fe448dff5 is described below

commit fe448dff59b53d9a0cfa67104559a7236155761c
Author: Antonin Stefanutti 
AuthorDate: Tue Nov 22 11:19:04 2022 +0100

fix(GC): Default to APIResourceList group when APIResource group is empty
---
 pkg/trait/gc.go | 15 ---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index 2ec07f384..500fd7663 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -204,14 +204,23 @@ func (t *gcTrait) getDeletableTypes(e *Environment) 
(map[schema.GroupVersionKind
GVKs := make(map[schema.GroupVersionKind]struct{})
for _, APIResourceList := range APIResourceLists {
for _, resource := range APIResourceList.APIResources {
+   resourceGroup := resource.Group
+   if resourceGroup == "" {
+   // Empty implies the group of the containing 
resource list should be used
+   gv, err := 
schema.ParseGroupVersion(APIResourceList.GroupVersion)
+   if err != nil {
+   return nil, err
+   }
+   resourceGroup = gv.Group
+   }
rule:
for _, rule := range ssrr.Status.ResourceRules {
if !util.StringSliceContainsAnyOf(rule.Verbs, 
"delete", "*") {
continue
}
-   for _, group := range rule.APIGroups {
-   for _, name := range rule.Resources {
-   if (resource.Group == group || 
group == "*") && (resource.Name == name || name == "*") {
+   for _, ruleGroup := range rule.APIGroups {
+   for _, ruleResource := range 
rule.Resources {
+   if (resourceGroup == ruleGroup 
|| ruleGroup == "*") && (resource.Name == ruleResource || ruleResource == "*") {
GVK := 
schema.FromAPIVersionAndKind(APIResourceList.GroupVersion, resource.Kind)
GVKs[GVK] = struct{}{}
break rule



[camel-k] 01/02: chore(api): Add validation to trait enum parameters in CRDs

2022-10-03 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 2b0a4348a93553732b3315bd5d41a0cdfd3c7c26
Author: Antonin Stefanutti 
AuthorDate: Thu Sep 29 10:59:06 2022 +0200

chore(api): Add validation to trait enum parameters in CRDs
---
 .../bases/camel.apache.org_integrationkits.yaml|  3 +
 .../camel.apache.org_integrationplatforms.yaml | 92 +-
 .../crd/bases/camel.apache.org_integrations.yaml   | 46 ++-
 .../bases/camel.apache.org_kameletbindings.yaml| 46 ++-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  4 +-
 docs/modules/traits/pages/cron.adoc|  2 +-
 docs/modules/traits/pages/knative-service.adoc |  2 +-
 helm/camel-k/crds/crd-integration-kit.yaml |  3 +
 helm/camel-k/crds/crd-integration-platform.yaml| 92 +-
 helm/camel-k/crds/crd-integration.yaml | 46 ++-
 helm/camel-k/crds/crd-kamelet-binding.yaml | 46 ++-
 pkg/apis/camel/v1/trait/container.go   |  1 +
 pkg/apis/camel/v1/trait/cron.go|  3 +-
 pkg/apis/camel/v1/trait/deployer.go|  1 +
 pkg/apis/camel/v1/trait/gc.go  |  1 +
 pkg/apis/camel/v1/trait/knative_service.go |  4 +-
 pkg/apis/camel/v1/trait/logging.go |  1 +
 pkg/apis/camel/v1/trait/quarkus.go |  1 +
 pkg/apis/camel/v1/trait/route.go   |  2 +
 pkg/apis/camel/v1/trait/service.go |  1 +
 pkg/resources/resources.go | 20 ++---
 resources/traits.yaml  |  4 +-
 22 files changed, 387 insertions(+), 34 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_integrationkits.yaml 
b/config/crd/bases/camel.apache.org_integrationkits.yaml
index a6c966e2f..8d51628ab 100644
--- a/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -185,6 +185,9 @@ spec:
   corresponding to the first package type will be 
assigned
   to the integration in case no existing kit that 
matches
   the integration exists.
+enum:
+- fast-jar
+- native
 items:
   description: Quarkus package type.
   type: string
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index e990fd40a..90545b2bc 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -501,6 +501,10 @@ spec:
 type: string
   imagePullPolicy:
 description: 'The pull policy: 
Always|Never|IfNotPresent'
+enum:
+- Always
+- Never
+- IfNotPresent
 type: string
   limitCPU:
 description: The maximum amount of CPU required.
@@ -626,7 +630,7 @@ spec:
   when all routes are either starting from a periodic 
consumer
   (only `cron`, `timer` and `quartz` are supported) or 
a passive
   consumer (e.g. `direct` is a passive consumer). \n 
It's
-  required that all periodic consumers have the same 
period
+  required that all periodic consumers have the same 
period,
   and it can be expressed as cron schedule (e.g. `1m` 
can
   be expressed as `0/1 * * * *`, while `35m` or `50s` 
cannot)."
 type: boolean
@@ -652,6 +656,10 @@ spec:
   runs, skipping next run if previous run hasn''t 
finished
   yet; - "Replace": cancels currently running job and 
replaces
   it with a new one'
+enum:
+- Allow
+- Forbid
+- Replace
 type: string
   configuration:
 description: 'Legacy trait configuration parameters. 
Deprecated:
@@ -708,6 +716,10 @@ spec:
 description: Allows to explicitly select the desired 
deployment
   kind between `deployment`, `cron-job` or 
`knative-service`
   when creating the resources for running the 
integration.
+enum:
+- deployment
+- cron-job
+  

[camel-k] branch main updated (df59096ab -> 4a12ebc1d)

2022-10-03 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from df59096ab chore(e2e): added observed generation check
 new 2b0a4348a chore(api): Add validation to trait enum parameters in CRDs
 new 4a12ebc1d fix(api): Quarkus package type validation should not apply 
to array

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../bases/camel.apache.org_integrationkits.yaml|  3 +
 .../camel.apache.org_integrationplatforms.yaml | 92 +-
 .../crd/bases/camel.apache.org_integrations.yaml   | 46 ++-
 .../bases/camel.apache.org_kameletbindings.yaml| 46 ++-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  4 +-
 docs/modules/traits/pages/cron.adoc|  2 +-
 docs/modules/traits/pages/knative-service.adoc |  2 +-
 helm/camel-k/crds/crd-integration-kit.yaml |  3 +
 helm/camel-k/crds/crd-integration-platform.yaml| 92 +-
 helm/camel-k/crds/crd-integration.yaml | 46 ++-
 helm/camel-k/crds/crd-kamelet-binding.yaml | 46 ++-
 pkg/apis/camel/v1/trait/container.go   |  1 +
 pkg/apis/camel/v1/trait/cron.go|  3 +-
 pkg/apis/camel/v1/trait/deployer.go|  1 +
 pkg/apis/camel/v1/trait/gc.go  |  1 +
 pkg/apis/camel/v1/trait/knative_service.go |  4 +-
 pkg/apis/camel/v1/trait/logging.go |  1 +
 pkg/apis/camel/v1/trait/quarkus.go |  1 +
 pkg/apis/camel/v1/trait/route.go   |  2 +
 pkg/apis/camel/v1/trait/service.go |  1 +
 pkg/resources/resources.go | 20 ++---
 resources/traits.yaml  |  4 +-
 22 files changed, 387 insertions(+), 34 deletions(-)



[camel-k] 02/02: fix(api): Quarkus package type validation should not apply to array

2022-10-03 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 4a12ebc1d0830c3d39c35e362e6d6ce048e1dc92
Author: Antonin Stefanutti 
AuthorDate: Mon Oct 3 16:21:56 2022 +0200

fix(api): Quarkus package type validation should not apply to array
---
 config/crd/bases/camel.apache.org_integrationkits.yaml   |  6 +++---
 .../crd/bases/camel.apache.org_integrationplatforms.yaml | 12 ++--
 config/crd/bases/camel.apache.org_integrations.yaml  |  6 +++---
 config/crd/bases/camel.apache.org_kameletbindings.yaml   |  6 +++---
 helm/camel-k/crds/crd-integration-kit.yaml   |  6 +++---
 helm/camel-k/crds/crd-integration-platform.yaml  | 12 ++--
 helm/camel-k/crds/crd-integration.yaml   |  6 +++---
 helm/camel-k/crds/crd-kamelet-binding.yaml   |  6 +++---
 pkg/apis/camel/v1/trait/quarkus.go   |  2 +-
 pkg/resources/resources.go   | 16 
 10 files changed, 39 insertions(+), 39 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_integrationkits.yaml 
b/config/crd/bases/camel.apache.org_integrationkits.yaml
index 8d51628ab..8f642f219 100644
--- a/config/crd/bases/camel.apache.org_integrationkits.yaml
+++ b/config/crd/bases/camel.apache.org_integrationkits.yaml
@@ -185,11 +185,11 @@ spec:
   corresponding to the first package type will be 
assigned
   to the integration in case no existing kit that 
matches
   the integration exists.
-enum:
-- fast-jar
-- native
 items:
   description: Quarkus package type.
+  enum:
+  - fast-jar
+  - native
   type: string
 type: array
 type: object
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 90545b2bc..32eba64e0 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -1498,11 +1498,11 @@ spec:
   corresponding to the first package type will be 
assigned
   to the integration in case no existing kit that 
matches
   the integration exists.
-enum:
-- fast-jar
-- native
 items:
   description: Quarkus package type.
+  enum:
+  - fast-jar
+  - native
   type: string
 type: array
 type: object
@@ -3178,11 +3178,11 @@ spec:
   corresponding to the first package type will be 
assigned
   to the integration in case no existing kit that 
matches
   the integration exists.
-enum:
-- fast-jar
-- native
 items:
   description: Quarkus package type.
+  enum:
+  - fast-jar
+  - native
   type: string
 type: array
 type: object
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index b08f6f3a6..d6e203f5d 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -7189,11 +7189,11 @@ spec:
   corresponding to the first package type will be 
assigned
   to the integration in case no existing kit that 
matches
   the integration exists.
-enum:
-- fast-jar
-- native
 items:
   description: Quarkus package type.
+  enum:
+  - fast-jar
+  - native
   type: string
 type: array
 type: object
diff --git a/config/crd/bases/camel.apache.org_kameletbindings.yaml 
b/config/crd/bases/camel.apache.org_kameletbindings.yaml
index d24809996..99e7abac0 100644
--- a/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -7481,11 +7481,11 @@ spec:
   The kit

[camel-k] branch main updated: chore: Use global client discovery API to check Knative install

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 3652ee748 chore: Use global client discovery API to check Knative 
install
3652ee748 is described below

commit 3652ee74813567f255e7f353a5045301e3d08ed4
Author: Antonin Stefanutti 
AuthorDate: Thu Sep 29 14:32:52 2022 +0200

chore: Use global client discovery API to check Knative install
---
 e2e/global/knative/knative_platform_test.go  |  4 ++-
 pkg/controller/integration/platform_setup.go | 24 ++--
 pkg/controller/kameletbinding/integration.go |  4 ++-
 pkg/install/cluster.go   |  2 +-
 pkg/install/knative.go   |  2 +-
 pkg/install/operator.go  |  2 +-
 pkg/util/knative/enabled.go  | 43 
 7 files changed, 29 insertions(+), 52 deletions(-)

diff --git a/e2e/global/knative/knative_platform_test.go 
b/e2e/global/knative/knative_platform_test.go
index d35c6867f..5b4bdb88d 100644
--- a/e2e/global/knative/knative_platform_test.go
+++ b/e2e/global/knative/knative_platform_test.go
@@ -40,7 +40,9 @@ import (
 
 func TestKnativePlatform(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
-   if !knative.IsEnabledInNamespace(TestContext, TestClient(), ns) 
{
+   installed, err := knative.IsInstalled(TestClient())
+   Expect(err).NotTo(HaveOccurred())
+   if !installed {
t.Error("Knative not installed in the cluster")
t.FailNow()
}
diff --git a/pkg/controller/integration/platform_setup.go 
b/pkg/controller/integration/platform_setup.go
index 6c1b85bb1..92a90ce80 100644
--- a/pkg/controller/integration/platform_setup.go
+++ b/pkg/controller/integration/platform_setup.go
@@ -59,7 +59,11 @@ func (action *platformSetupAction) Handle(ctx 
context.Context, integration *v1.I
if err != nil && !k8serrors.IsNotFound(err) {
return nil, err
} else if pl != nil {
-   integration.Status.Profile = determineBestProfile(ctx, 
action.client, integration, pl)
+   profile, err := determineBestProfile(action.client, 
integration, pl)
+   if err != nil {
+   return nil, err
+   }
+   integration.Status.Profile = profile
}
 
// Change the integration phase to Initialization after traits have 
been applied
@@ -73,24 +77,26 @@ func (action *platformSetupAction) Handle(ctx 
context.Context, integration *v1.I
 }
 
 // DetermineBestProfile tries to detect the best trait profile for the 
integration.
-func determineBestProfile(ctx context.Context, c client.Client, integration 
*v1.Integration, p *v1.IntegrationPlatform) v1.TraitProfile {
+func determineBestProfile(c client.Client, integration *v1.Integration, p 
*v1.IntegrationPlatform) (v1.TraitProfile, error) {
if integration.Spec.Profile != "" {
-   return integration.Spec.Profile
+   return integration.Spec.Profile, nil
}
if integration.Status.Profile != "" {
// Integration already has a profile
-   return integration.Status.Profile
+   return integration.Status.Profile, nil
}
if p.Status.Profile != "" {
// Use platform profile if set
-   return p.Status.Profile
+   return p.Status.Profile, nil
}
if p.Spec.Profile != "" {
// Use platform spec profile if set
-   return p.Spec.Profile
+   return p.Spec.Profile, nil
}
-   if knative.IsEnabledInNamespace(ctx, c, integration.Namespace) {
-   return v1.TraitProfileKnative
+   if ok, err := knative.IsInstalled(c); err != nil {
+   return "", err
+   } else if ok {
+   return v1.TraitProfileKnative, nil
}
-   return platform.GetProfile(p)
+   return platform.GetProfile(p), nil
 }
diff --git a/pkg/controller/kameletbinding/integration.go 
b/pkg/controller/kameletbinding/integration.go
index 3f988d595..e9e1add70 100644
--- a/pkg/controller/kameletbinding/integration.go
+++ b/pkg/controller/kameletbinding/integration.go
@@ -249,7 +249,9 @@ func determineProfile(ctx context.Context, c client.Client, 
binding *v1alpha1.Ka
return pl.Spec.Profile, nil
}
}
-   if knative.IsEnabledInNamespace(ctx, c, binding.Namespace) {
+   if ok, err := knative.IsInstalled(c); err != nil {
+   return "", err
+   } else if ok {
return v1.TraitProfileKnative, nil
}
if pl != nil {
diff --git a/pkg/install/c

[camel-k] branch main updated: fix: Use SIGTERM and SIGINT aware context for bootstrap operations

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 3068da6d8 fix: Use SIGTERM and SIGINT aware context for bootstrap 
operations
3068da6d8 is described below

commit 3068da6d8c66d572b1d85d043fe217c355b18b77
Author: Antonin Stefanutti 
AuthorDate: Thu Sep 29 09:44:59 2022 +0200

fix: Use SIGTERM and SIGINT aware context for bootstrap operations
---
 pkg/cmd/operator/operator.go | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index c1e57ada2..71817cf8c 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -134,6 +134,8 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
watchNamespace, err := getWatchNamespace()
exitOnError(err, "failed to get watch namespace")
 
+   ctx := signals.SetupSignalHandler()
+
cfg, err := config.GetConfig()
exitOnError(err, "cannot get client config")
// Increase maximum burst that is used by client-side throttling,
@@ -151,7 +153,7 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
broadcaster := record.NewBroadcaster()
defer broadcaster.Shutdown()
 
-   if ok, err := kubernetes.CheckPermission(context.TODO(), 
bootstrapClient, corev1.GroupName, "events", watchNamespace, "", "create"); err 
!= nil || !ok {
+   if ok, err := kubernetes.CheckPermission(ctx, bootstrapClient, 
corev1.GroupName, "events", watchNamespace, "", "create"); err != nil || !ok {
// Do not sink Events to the server as they'll be rejected
broadcaster = event.NewSinkLessBroadcaster(broadcaster)
exitOnError(err, "cannot check permissions for creating Events")
@@ -171,10 +173,10 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
}
 
// Set the operator container image if it runs in-container
-   platform.OperatorImage, err = getOperatorImage(context.TODO(), 
bootstrapClient)
+   platform.OperatorImage, err = getOperatorImage(ctx, bootstrapClient)
exitOnError(err, "cannot get operator container image")
 
-   if ok, err := kubernetes.CheckPermission(context.TODO(), 
bootstrapClient, coordination.GroupName, "leases", operatorNamespace, "", 
"create"); err != nil || !ok {
+   if ok, err := kubernetes.CheckPermission(ctx, bootstrapClient, 
coordination.GroupName, "leases", operatorNamespace, "", "create"); err != nil 
|| !ok {
leaderElection = false
exitOnError(err, "cannot check permissions for creating Leases")
log.Info("The operator is not granted permissions to create 
Leases")
@@ -223,7 +225,7 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
exitOnError(err, "")
 
exitOnError(
-   mgr.GetFieldIndexer().IndexField(context.Background(), 
{}, "status.phase",
+   mgr.GetFieldIndexer().IndexField(ctx, {}, 
"status.phase",
func(obj ctrl.Object) []string {
pod, _ := obj.(*corev1.Pod)
return []string{string(pod.Status.Phase)}
@@ -239,13 +241,13 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
exitOnError(controller.AddToManager(mgr, ctrlClient), "")
 
log.Info("Installing operator resources")
-   installCtx, installCancel := context.WithTimeout(context.Background(), 
1*time.Minute)
+   installCtx, installCancel := context.WithTimeout(ctx, 1*time.Minute)
defer installCancel()
install.OperatorStartupOptionalTools(installCtx, bootstrapClient, 
watchNamespace, operatorNamespace, log)
exitOnError(findOrCreateIntegrationPlatform(installCtx, 
bootstrapClient, operatorNamespace), "failed to create integration platform")
 
log.Info("Starting the manager")
-   exitOnError(mgr.Start(signals.SetupSignalHandler()), "manager exited 
non-zero")
+   exitOnError(mgr.Start(ctx), "manager exited non-zero")
 }
 
 // findOrCreateIntegrationPlatform create default integration platform in 
operator namespace if not already exists.



[camel-k] branch main updated (1257792c8 -> b51a722fa)

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from 1257792c8 chore: Add client argument to controllers
 new 3d26e9953 chore(trait): Deprecate cached discovery option from GC trait
 new b51a722fa chore: Fix lint errors

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel.apache.org_integrationplatforms.yaml | 10 ++--
 .../crd/bases/camel.apache.org_integrations.yaml   |  5 +-
 .../bases/camel.apache.org_kameletbindings.yaml|  5 +-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  3 +-
 docs/modules/traits/pages/gc.adoc  |  3 +-
 helm/camel-k/crds/crd-integration-platform.yaml| 10 ++--
 helm/camel-k/crds/crd-integration.yaml |  5 +-
 helm/camel-k/crds/crd-kamelet-binding.yaml |  5 +-
 pkg/apis/camel/v1/trait/gc.go  |  3 +-
 pkg/resources/resources.go | 16 +++
 pkg/trait/gc.go| 55 ++
 pkg/trait/util.go  | 18 ++-
 resources/traits.yaml  |  4 +-
 13 files changed, 48 insertions(+), 94 deletions(-)



[camel-k] 01/02: chore(trait): Deprecate cached discovery option from GC trait

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 3d26e99539385fd2ed9475ecb62cf1fbe258187f
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 28 15:07:12 2022 +0200

chore(trait): Deprecate cached discovery option from GC trait
---
 .../camel.apache.org_integrationplatforms.yaml | 10 +++--
 .../crd/bases/camel.apache.org_integrations.yaml   |  5 ++-
 .../bases/camel.apache.org_kameletbindings.yaml|  5 ++-
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  |  3 +-
 docs/modules/traits/pages/gc.adoc  |  3 +-
 helm/camel-k/crds/crd-integration-platform.yaml| 10 +++--
 helm/camel-k/crds/crd-integration.yaml |  5 ++-
 helm/camel-k/crds/crd-kamelet-binding.yaml |  5 ++-
 pkg/apis/camel/v1/trait/gc.go  |  3 +-
 pkg/resources/resources.go | 16 +++
 pkg/trait/gc.go| 52 +++---
 resources/traits.yaml  |  4 +-
 12 files changed, 45 insertions(+), 76 deletions(-)

diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index da49d6aad..e990fd40a 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -812,8 +812,9 @@ spec:
 type: object
 x-kubernetes-preserve-unknown-fields: true
   discoveryCache:
-description: Discovery client cache to be used, either 
`disabled`,
-  `disk` or `memory` (default `memory`)
+description: 'Discovery client cache to be used, 
either `disabled`,
+  `disk` or `memory` (default `memory`). Deprecated: 
to be
+  removed from trait configuration.'
 type: string
   enabled:
 description: Can be used to enable or disable a trait. 
All
@@ -2449,8 +2450,9 @@ spec:
 type: object
 x-kubernetes-preserve-unknown-fields: true
   discoveryCache:
-description: Discovery client cache to be used, either 
`disabled`,
-  `disk` or `memory` (default `memory`)
+description: 'Discovery client cache to be used, 
either `disabled`,
+  `disk` or `memory` (default `memory`). Deprecated: 
to be
+  removed from trait configuration.'
 type: string
   enabled:
 description: Can be used to enable or disable a trait. 
All
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index e7c6616a6..00ce1ac6a 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases/camel.apache.org_integrations.yaml
@@ -6503,8 +6503,9 @@ spec:
 type: object
 x-kubernetes-preserve-unknown-fields: true
   discoveryCache:
-description: Discovery client cache to be used, either 
`disabled`,
-  `disk` or `memory` (default `memory`)
+description: 'Discovery client cache to be used, 
either `disabled`,
+  `disk` or `memory` (default `memory`). Deprecated: 
to be
+  removed from trait configuration.'
 type: string
   enabled:
 description: Can be used to enable or disable a trait. 
All
diff --git a/config/crd/bases/camel.apache.org_kameletbindings.yaml 
b/config/crd/bases/camel.apache.org_kameletbindings.yaml
index 333b762a2..dbf907941 100644
--- a/config/crd/bases/camel.apache.org_kameletbindings.yaml
+++ b/config/crd/bases/camel.apache.org_kameletbindings.yaml
@@ -6786,8 +6786,9 @@ spec:
 type: object
 x-kubernetes-preserve-unknown-fields: true
   discoveryCache:
-description: Discovery client cache to be used, 
either
-  `disabled`, `disk` or `memory` (default `memory`)
+description: 'Discovery client cache to be used, 
either
+  `disabled`, `disk` or `memory` (default 
`memory`). Deprecated:
+  to be removed from trait configuration.'
 type: string
   enabled:
 description: Can be used to enable or disable a 
trait.
diff --git a/docs

[camel-k] 02/02: chore: Fix lint errors

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit b51a722fa10ba13b8227bb0b226fbb4de1fc7b0f
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 28 15:31:47 2022 +0200

chore: Fix lint errors
---
 pkg/trait/gc.go   |  3 ---
 pkg/trait/util.go | 18 +++---
 2 files changed, 3 insertions(+), 18 deletions(-)

diff --git a/pkg/trait/gc.go b/pkg/trait/gc.go
index 723a51437..2ec07f384 100644
--- a/pkg/trait/gc.go
+++ b/pkg/trait/gc.go
@@ -19,7 +19,6 @@ package trait
 
 import (
"context"
-   "regexp"
"strconv"
"strings"
"sync"
@@ -46,8 +45,6 @@ import (
 )
 
 var (
-   toFileName = regexp.MustCompile(`[^(\w/\.)]`)
-
locksync.Mutex
rateLimiter = rate.NewLimiter(rate.Every(time.Minute), 1)
collectableGVKs = make(map[schema.GroupVersionKind]struct{})
diff --git a/pkg/trait/util.go b/pkg/trait/util.go
index 69d9c3db2..478604cce 100644
--- a/pkg/trait/util.go
+++ b/pkg/trait/util.go
@@ -26,10 +26,11 @@ import (
"sort"
"strings"
 
-   user "github.com/mitchellh/go-homedir"
"github.com/pkg/errors"
"github.com/scylladb/go-set/strset"
+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
@@ -113,7 +114,7 @@ func collectConfigurations(configurationType string, 
configurable ...v1.Configur
continue
}
 
-   //nolint: staticcheck,nolintlint
+   // nolint: staticcheck,nolintlint
for _, entry := range entries {
if entry.Type == configurationType {
item := make(map[string]string)
@@ -198,19 +199,6 @@ func filterTransferableAnnotations(annotations 
map[string]string) map[string]str
return res
 }
 
-func mustHomeDir() string {
-   dir, err := user.Dir()
-   if err != nil {
-   panic(err)
-   }
-   return dir
-}
-
-func toHostDir(host string) string {
-   h := strings.Replace(strings.Replace(host, "https://;, "", 1), 
"http://;, "", 1)
-   return toFileName.ReplaceAllString(h, "_")
-}
-
 // ExtractSourceDependencies extracts dependencies from source.
 func ExtractSourceDependencies(source v1.SourceSpec, catalog 
*camel.RuntimeCatalog) (*strset.Set, error) {
dependencies := strset.New()



[camel-k] branch main updated: chore: Add client argument to controllers

2022-09-29 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 1257792c8 chore: Add client argument to controllers
1257792c8 is described below

commit 1257792c84af10a9ca61ca1267983f12ac0a7a9b
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 28 14:37:53 2022 +0200

chore: Add client argument to controllers
---
 pkg/client/client.go   |  2 +-
 pkg/cmd/operator/operator.go   | 25 --
 pkg/controller/add_build.go|  4 ++--
 pkg/controller/add_integration.go  |  4 ++--
 pkg/controller/add_integrationkit.go   |  4 ++--
 pkg/controller/add_integrationplatform.go  |  4 ++--
 pkg/controller/add_kamelet.go  |  4 ++--
 pkg/controller/add_kameletbinding.go   |  4 ++--
 pkg/controller/build/build_controller.go   |  6 +-
 pkg/controller/controller.go   | 15 +++--
 .../integration/integration_controller.go  | 10 +++--
 .../integrationkit/integrationkit_controller.go|  9 +---
 .../integrationplatform_controller.go  | 13 +++
 pkg/controller/kamelet/kamelet_controller.go   |  6 +-
 .../kameletbinding/kamelet_binding_controller.go   |  7 +-
 15 files changed, 46 insertions(+), 71 deletions(-)

diff --git a/pkg/client/client.go b/pkg/client/client.go
index 967a5fc8d..b2647c771 100644
--- a/pkg/client/client.go
+++ b/pkg/client/client.go
@@ -190,7 +190,7 @@ func FromManager(manager manager.Manager) (Client, error) {
}, nil
 }
 
-// init initialize the k8s client for usage outside the cluster.
+// initialize the k8s client for usage outside the cluster.
 func initialize(kubeconfig string) {
if kubeconfig == "" {
// skip out-of-cluster initialization if inside the container
diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index e4fd8e4c6..c1e57ada2 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -30,7 +30,10 @@ import (
"time"
 
"github.com/pkg/errors"
+
"go.uber.org/automaxprocs/maxprocs"
+   "go.uber.org/zap"
+   "go.uber.org/zap/zapcore"
 
appsv1 "k8s.io/api/apps/v1"
batchv1 "k8s.io/api/batch/v1"
@@ -45,8 +48,6 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/klog/v2"
 
-   "go.uber.org/zap"
-   "go.uber.org/zap/zapcore"
"sigs.k8s.io/controller-runtime/pkg/cache"
ctrl "sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/config"
@@ -140,7 +141,7 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
// from being throttled.
cfg.QPS = 20
cfg.Burst = 200
-   c, err := client.NewClientWithConfig(false, cfg)
+   bootstrapClient, err := client.NewClientWithConfig(false, cfg)
exitOnError(err, "cannot initialize client")
 
// We do not rely on the event broadcaster managed by controller 
runtime,
@@ -150,7 +151,7 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
broadcaster := record.NewBroadcaster()
defer broadcaster.Shutdown()
 
-   if ok, err := kubernetes.CheckPermission(context.TODO(), c, 
corev1.GroupName, "events", watchNamespace, "", "create"); err != nil || !ok {
+   if ok, err := kubernetes.CheckPermission(context.TODO(), 
bootstrapClient, corev1.GroupName, "events", watchNamespace, "", "create"); err 
!= nil || !ok {
// Do not sink Events to the server as they'll be rejected
broadcaster = event.NewSinkLessBroadcaster(broadcaster)
exitOnError(err, "cannot check permissions for creating Events")
@@ -170,10 +171,10 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
}
 
// Set the operator container image if it runs in-container
-   platform.OperatorImage, err = getOperatorImage(context.TODO(), c)
+   platform.OperatorImage, err = getOperatorImage(context.TODO(), 
bootstrapClient)
exitOnError(err, "cannot get operator container image")
 
-   if ok, err := kubernetes.CheckPermission(context.TODO(), c, 
coordination.GroupName, "leases", operatorNamespace, "", "create"); err != nil 
|| !ok {
+   if ok, err := kubernetes.CheckPermission(context.TODO(), 
bootstrapClient, coordination.GroupName, "leases", operatorNamespace, "", 
"cr

[camel-k] branch main updated: fix(#3671): Fix native mode for KameletBinding

2022-09-28 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 e3c17bd93 fix(#3671): Fix native mode for KameletBinding
e3c17bd93 is described below

commit e3c17bd93214c4e89d6430bfafcc4d05c77a9d67
Author: Christoph Deppisch 
AuthorDate: Tue Sep 27 19:38:42 2022 +0200

fix(#3671): Fix native mode for KameletBinding

Propagate annotation trait configuration from Integration to 
IntegrationKit. This makes sure that the kit matches the integration once the 
native build is done.
---
 pkg/trait/quarkus.go  |  8 
 pkg/trait/quarkus_test.go | 18 ++
 2 files changed, 26 insertions(+)

diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index a35235921..5efa210b1 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -20,6 +20,7 @@ package trait
 import (
"fmt"
"sort"
+   "strings"
 
"github.com/rs/xid"
 
@@ -197,6 +198,13 @@ func (t *quarkusTrait) newIntegrationKit(e *Environment, 
packageType traitv1.Qua
if v, ok := integration.Annotations[v1.PlatformSelectorAnnotation]; ok {
v1.SetAnnotation(, 
v1.PlatformSelectorAnnotation, v)
}
+
+   for k, v := range integration.Annotations {
+   if strings.HasPrefix(k, v1.TraitAnnotationPrefix) {
+   v1.SetAnnotation(, k, v)
+   }
+   }
+
operatorID := defaults.OperatorID()
if operatorID != "" {
kit.SetOperatorID(operatorID)
diff --git a/pkg/trait/quarkus_test.go b/pkg/trait/quarkus_test.go
index 70f6f37d2..ef9b587fd 100644
--- a/pkg/trait/quarkus_test.go
+++ b/pkg/trait/quarkus_test.go
@@ -71,6 +71,24 @@ func TestApplyQuarkusTraitDefaultKitLayout(t *testing.T) {
assert.Equal(t, 
environment.IntegrationKits[0].Labels[v1.IntegrationKitLayoutLabel], 
v1.IntegrationKitLayoutFastJar)
 }
 
+func TestApplyQuarkusTraitAnnotationKitConfiguration(t *testing.T) {
+   quarkusTrait, environment := createNominalQuarkusTest()
+   environment.Integration.Status.Phase = v1.IntegrationPhaseBuildingKit
+
+   v1.SetAnnotation(, 
v1.TraitAnnotationPrefix+"quarkus.foo", "camel-k")
+
+   configured, err := quarkusTrait.Configure(environment)
+   assert.True(t, configured)
+   assert.Nil(t, err)
+
+   err = quarkusTrait.Apply(environment)
+   assert.Nil(t, err)
+   assert.Len(t, environment.IntegrationKits, 1)
+   assert.Equal(t, v1.IntegrationKitLayoutFastJar, 
environment.IntegrationKits[0].Labels[v1.IntegrationKitLayoutLabel])
+   assert.Equal(t, "camel-k", 
environment.IntegrationKits[0].Annotations[v1.TraitAnnotationPrefix+"quarkus.foo"])
+
+}
+
 func createNominalQuarkusTest() (*quarkusTrait, *Environment) {
trait, _ := newQuarkusTrait().(*quarkusTrait)
trait.Enabled = pointer.Bool(true)



[camel-k] branch main updated: chore: Propagate reconcilation context to build routine

2022-09-27 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 4516138c2 chore: Propagate reconcilation context to build routine
4516138c2 is described below

commit 4516138c288ec08f06fc28475efa3cd7f83655f1
Author: Antonin Stefanutti 
AuthorDate: Tue Sep 27 11:12:45 2022 +0200

chore: Propagate reconcilation context to build routine
---
 pkg/controller/build/monitor_routine.go | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/pkg/controller/build/monitor_routine.go 
b/pkg/controller/build/monitor_routine.go
index 055d960bd..42f5a7902 100644
--- a/pkg/controller/build/monitor_routine.go
+++ b/pkg/controller/build/monitor_routine.go
@@ -77,8 +77,7 @@ func (action *monitorRoutineAction) Handle(ctx 
context.Context, build *v1.Build)
// Start the build asynchronously to avoid blocking the 
reconciliation loop
routines.Store(build.Name, true)
 
-   // nolint: contextcheck
-   go action.runBuild(build)
+   go action.runBuild(ctx, build)
 
case v1.BuildPhaseRunning:
if _, ok := routines.Load(build.Name); !ok {
@@ -93,10 +92,9 @@ func (action *monitorRoutineAction) Handle(ctx 
context.Context, build *v1.Build)
return nil, nil
 }
 
-func (action *monitorRoutineAction) runBuild(build *v1.Build) {
+func (action *monitorRoutineAction) runBuild(ctx context.Context, build 
*v1.Build) {
defer routines.Delete(build.Name)
 
-   ctx := context.Background()
ctxWithTimeout, cancel := context.WithDeadline(ctx, 
build.Status.StartedAt.Add(build.Spec.Timeout.Duration))
defer cancel()
 



[camel-k] branch main updated: trait(ingress): Configure backend in ingress rule

2022-09-21 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 8936bd929 trait(ingress): Configure backend in ingress rule
8936bd929 is described below

commit 8936bd9292a1883a24a917b5122e8b0e1d7aba5d
Author: Antonin Stefanutti 
AuthorDate: Fri Sep 16 14:03:06 2022 +0200

trait(ingress): Configure backend in ingress rule
---
 pkg/trait/ingress.go  | 34 +-
 pkg/trait/ingress_test.go |  6 +-
 2 files changed, 26 insertions(+), 14 deletions(-)

diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index f674c1ac7..99da27bba 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -85,6 +85,8 @@ func (t *ingressTrait) Apply(e *Environment) error {
return errors.New("cannot Apply ingress trait: no target 
service")
}
 
+   pathType := networkingv1.PathTypePrefix
+
ingress := networkingv1.Ingress{
TypeMeta: metav1.TypeMeta{
Kind:   "Ingress",
@@ -95,17 +97,27 @@ func (t *ingressTrait) Apply(e *Environment) error {
Namespace: service.Namespace,
},
Spec: networkingv1.IngressSpec{
-   DefaultBackend: {
-   Service: {
-   Name: service.Name,
-   Port: networkingv1.ServiceBackendPort{
-   Name: "http",
-   },
-   },
-   },
Rules: []networkingv1.IngressRule{
{
Host: t.Host,
+   IngressRuleValue: 
networkingv1.IngressRuleValue{
+   HTTP: 
{
+   Paths: 
[]networkingv1.HTTPIngressPath{
+   {
+   Path:   
  "/",
+   
PathType: ,
+   
Backend: networkingv1.IngressBackend{
+   
Service: {
+   
Name: service.Name,
+   
Port: networkingv1.ServiceBackendPort{
+   
Name: "http",
+   
},
+   
},
+   },
+   },
+   },
+   },
+   },
},
},
},
@@ -113,11 +125,7 @@ func (t *ingressTrait) Apply(e *Environment) error {
 
e.Resources.Add()
 
-   message := fmt.Sprintf("%s(%s) -> %s(%s)",
-   ingress.Name,
-   t.Host,
-   ingress.Spec.DefaultBackend.Service.Name,
-   ingress.Spec.DefaultBackend.Service.Port.Name)
+   message := fmt.Sprintf("%s(%s) -> %s(%s)", ingress.Name, t.Host, 
service.Name, "http")
 
e.Integration.Status.SetCondition(
v1.IntegrationConditionExposureAvailable,
diff --git a/pkg/trait/ingress_test.go b/pkg/trait/ingress_test.go
index 1090a0c1f..3d620cf75 100644
--- a/pkg/trait/ingress_test.go
+++ b/pkg/trait/ingress_test.go
@@ -114,9 +114,13 @@ func TestApplyIngressTraitDoesSucceed(t *testing.T) {
if ingress, ok := resource.(*networkingv1.Ingress); ok {
assert.Equal(t, "service-name", ingress.Name)
assert.Equal(t, "namespace", ingress.Namespace)
-   assert.Equal(t, "service-name", 
ingress.Spec.DefaultBackend.Service.Name)
assert.Len(t, ingress.Spec.Rules, 1)
assert.Equal(t, "hostname", ingress.Spec.Rules[0].Host)
+   assert.Len(t, ingress.Spec.Rules[0].HTTP.Paths, 1)
+   assert.Equal(t, "service-name", 
ingress.

[camel-k] 05/05: chore(test): Update unit test environments

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 3c59920d06d40d73d10e41d95d137b114e1b47ed
Author: Antonin Stefanutti 
AuthorDate: Thu Sep 8 10:04:07 2022 +0200

chore(test): Update unit test environments
---
 pkg/trait/camel_test.go| 23 ++-
 pkg/trait/container_probes_test.go | 15 ---
 pkg/trait/container_test.go| 27 ++-
 pkg/trait/cron_test.go | 30 --
 pkg/trait/environment_test.go  |  6 ++
 pkg/trait/istio_test.go|  6 ++
 pkg/trait/knative_service_test.go  | 18 ++
 pkg/trait/knative_test.go  |  4 
 pkg/trait/logging_test.go  |  8 
 pkg/trait/mount_test.go|  4 
 pkg/trait/route_test.go|  4 
 pkg/trait/service_test.go  | 16 
 pkg/trait/trait_test.go|  6 ++
 13 files changed, 156 insertions(+), 11 deletions(-)

diff --git a/pkg/trait/camel_test.go b/pkg/trait/camel_test.go
index 20e555975..80fd1d43b 100644
--- a/pkg/trait/camel_test.go
+++ b/pkg/trait/camel_test.go
@@ -53,7 +53,11 @@ func TestConfigureDisabledCamelTraitFails(t *testing.T) {
 func TestApplyCamelTraitSucceeds(t *testing.T) {
trait, environment := createNominalCamelTest()
 
-   err := trait.Apply(environment)
+   configured, err := trait.Configure(environment)
+   assert.Nil(t, err)
+   assert.True(t, configured)
+
+   err = trait.Apply(environment)
assert.Nil(t, err)
assert.Equal(t, "0.0.1", environment.RuntimeVersion)
assert.Equal(t, "0.0.1", environment.Integration.Status.RuntimeVersion)
@@ -66,7 +70,11 @@ func 
TestApplyCamelTraitWithoutEnvironmentCatalogAndUnmatchableVersionFails(t *t
environment.Integration.Status.RuntimeVersion = "Unmatchable version"
environment.Integration.Status.RuntimeProvider = 
v1.RuntimeProviderQuarkus
 
-   err := trait.Apply(environment)
+   configured, err := trait.Configure(environment)
+   assert.Nil(t, err)
+   assert.True(t, configured)
+
+   err = trait.Apply(environment)
assert.NotNil(t, err)
assert.Equal(t, "unable to find catalog matching version requirement: 
runtime=Unmatchable version, provider=quarkus", err.Error())
 }
@@ -119,9 +127,14 @@ func createNominalCamelTest() (*camelTrait, *Environment) {
 }
 
 func TestApplyCamelTraitWithProperties(t *testing.T) {
-   camelTrait, environment := createNominalCamelTest()
-   camelTrait.Properties = []string{"a=b", "c=d"}
-   err := camelTrait.Apply(environment)
+   trait, environment := createNominalCamelTest()
+   trait.Properties = []string{"a=b", "c=d"}
+
+   configured, err := trait.Configure(environment)
+   assert.Nil(t, err)
+   assert.True(t, configured)
+
+   err = trait.Apply(environment)
assert.Nil(t, err)
 
userPropertiesCm := environment.Resources.GetConfigMap(func(cm 
*corev1.ConfigMap) bool {
diff --git a/pkg/trait/container_probes_test.go 
b/pkg/trait/container_probes_test.go
index 2642f032d..55c1c6287 100644
--- a/pkg/trait/container_probes_test.go
+++ b/pkg/trait/container_probes_test.go
@@ -41,9 +41,18 @@ func newTestProbesEnv(t *testing.T, integration 
*v1.Integration) Environment {
traitCatalog := NewCatalog(nil)
 
return Environment{
-   Catalog:   traitCatalog,
-   CamelCatalog:  catalog,
-   Platform:  {},
+   Catalog:  traitCatalog,
+   CamelCatalog: catalog,
+   Platform: {
+   Status: v1.IntegrationPlatformStatus{
+   Phase: v1.IntegrationPlatformPhaseReady,
+   IntegrationPlatformSpec: 
v1.IntegrationPlatformSpec{
+   Build: v1.IntegrationPlatformBuildSpec{
+   RuntimeVersion: 
catalog.Runtime.Version,
+   },
+   },
+   },
+   },
Integration:   integration,
Resources: kubernetes.NewCollection(),
ApplicationProperties: make(map[string]string),
diff --git a/pkg/trait/container_test.go b/pkg/trait/container_test.go
index 54d2157b5..4109653de 100644
--- a/pkg/trait/container_test.go
+++ b/pkg/trait/container_test.go
@@ -69,8 +69,12 @@ func TestContainerWithDefaults(t *testing.T) {
Build: v1.IntegrationPlatformBuildSpec{
PublishStrategy: 
v1.IntegrationPlatformBuildPublishStrategyS2I,

[camel-k] 01/05: fix: deployment trait should not run when waiting for platform

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 8c599e6934f7d9e999dfd2f510f76be2ca62c9d2
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 15:12:23 2022 +0200

fix: deployment trait should not run when waiting for platform
---
 pkg/trait/deployment.go | 19 ++-
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index 35a3eeada..ae4386372 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -46,16 +46,17 @@ func newDeploymentTrait() Trait {
 }
 
 func (t *deploymentTrait) Configure(e *Environment) (bool, error) {
-   if e.Integration == nil || !pointer.BoolDeref(t.Enabled, true) {
-   if e.Integration != nil {
-   e.Integration.Status.SetCondition(
-   v1.IntegrationConditionDeploymentAvailable,
-   corev1.ConditionFalse,
-   
v1.IntegrationConditionDeploymentAvailableReason,
-   "explicitly disabled",
-   )
-   }
+   if !e.IntegrationInRunningPhases() {
+   return false, nil
+   }
 
+   if !pointer.BoolDeref(t.Enabled, true) {
+   e.Integration.Status.SetCondition(
+   v1.IntegrationConditionDeploymentAvailable,
+   corev1.ConditionFalse,
+   v1.IntegrationConditionDeploymentAvailableReason,
+   "explicitly disabled",
+   )
return false, nil
}
 



[camel-k] branch main updated (d4362ded9 -> 3c59920d0)

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from d4362ded9 Helm: Fixed index.yaml
 new 8c599e693 fix: deployment trait should not run when waiting for 
platform
 new 327f06dda fix: OpenAPI trait should not run when waiting for platform
 new 8f830deba fix: camel trait should fail-fast when runtime version is nil
 new 6b7e83934 fix: check platform readiness before calling traits that 
require it
 new 3c59920d0 chore(test): Update unit test environments

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pkg/trait/builder_test.go  |  3 +++
 pkg/trait/camel.go | 39 ++
 pkg/trait/camel_test.go| 23 +-
 pkg/trait/container_probes_test.go | 15 ---
 pkg/trait/container_test.go| 27 +-
 pkg/trait/cron_test.go | 30 +++--
 pkg/trait/deployment.go| 19 ++-
 pkg/trait/environment_test.go  |  6 ++
 pkg/trait/istio_test.go|  6 ++
 pkg/trait/knative_service_test.go  | 18 ++
 pkg/trait/knative_test.go  |  4 
 pkg/trait/logging_test.go  |  8 
 pkg/trait/mount_test.go|  4 
 pkg/trait/openapi.go   |  2 +-
 pkg/trait/route_test.go|  4 
 pkg/trait/service_test.go  | 16 
 pkg/trait/trait_catalog.go |  6 +++---
 pkg/trait/trait_test.go|  6 ++
 pkg/trait/trait_types.go   | 14 ++
 19 files changed, 210 insertions(+), 40 deletions(-)



[camel-k] 03/05: fix: camel trait should fail-fast when runtime version is nil

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 8f830deba4e77c38be2b94cfea804d82c89a85ab
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 15:14:58 2022 +0200

fix: camel trait should fail-fast when runtime version is nil
---
 pkg/trait/camel.go | 39 +++
 1 file changed, 23 insertions(+), 16 deletions(-)

diff --git a/pkg/trait/camel.go b/pkg/trait/camel.go
index 17f847560..82f0e91c2 100644
--- a/pkg/trait/camel.go
+++ b/pkg/trait/camel.go
@@ -24,6 +24,7 @@ import (
"strings"
 
"github.com/pkg/errors"
+
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
@@ -52,20 +53,26 @@ func (t *camelTrait) Configure(e *Environment) (bool, 
error) {
return false, errors.New("trait camel cannot be disabled")
}
 
+   if t.RuntimeVersion == "" {
+   t.RuntimeVersion = determineRuntimeVersion(e)
+   }
+
return true, nil
 }
 
 func (t *camelTrait) Apply(e *Environment) error {
-   rv := t.determineRuntimeVersion(e)
+   if t.RuntimeVersion == "" {
+   return errors.New("unable to determine runtime version")
+   }
 
if e.CamelCatalog == nil {
-   err := t.loadOrCreateCatalog(e, rv)
+   err := t.loadOrCreateCatalog(e, t.RuntimeVersion)
if err != nil {
return err
}
}
 
-   e.RuntimeVersion = rv
+   e.RuntimeVersion = t.RuntimeVersion
 
if e.Integration != nil {
e.Integration.Status.RuntimeVersion = 
e.CamelCatalog.Runtime.Version
@@ -144,19 +151,6 @@ func (t *camelTrait) loadOrCreateCatalog(e *Environment, 
runtimeVersion string)
return nil
 }
 
-func (t *camelTrait) determineRuntimeVersion(e *Environment) string {
-   if t.RuntimeVersion != "" {
-   return t.RuntimeVersion
-   }
-   if e.Integration != nil && e.Integration.Status.RuntimeVersion != "" {
-   return e.Integration.Status.RuntimeVersion
-   }
-   if e.IntegrationKit != nil && e.IntegrationKit.Status.RuntimeVersion != 
"" {
-   return e.IntegrationKit.Status.RuntimeVersion
-   }
-   return e.Platform.Status.Build.RuntimeVersion
-}
-
 // IsPlatformTrait overrides base class method.
 func (t *camelTrait) IsPlatformTrait() bool {
return true
@@ -287,3 +281,16 @@ func (t *camelTrait) computeConfigMaps(e *Environment) 
[]ctrl.Object {
 
return maps
 }
+
+func determineRuntimeVersion(e *Environment) string {
+   if e.Integration != nil && e.Integration.Status.RuntimeVersion != "" {
+   return e.Integration.Status.RuntimeVersion
+   }
+   if e.IntegrationKit != nil && e.IntegrationKit.Status.RuntimeVersion != 
"" {
+   return e.IntegrationKit.Status.RuntimeVersion
+   }
+   if e.Platform != nil && e.Platform.Status.Build.RuntimeVersion != "" {
+   return e.Platform.Status.Build.RuntimeVersion
+   }
+   return ""
+}



[camel-k] 04/05: fix: check platform readiness before calling traits that require it

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 6b7e83934fbc61d83962b593808251a86c6eb233
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 15:22:38 2022 +0200

fix: check platform readiness before calling traits that require it
---
 pkg/trait/builder_test.go  |  3 +++
 pkg/trait/trait_catalog.go |  6 +++---
 pkg/trait/trait_types.go   | 14 ++
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/builder_test.go b/pkg/trait/builder_test.go
index ad7f8e861..c444d4d54 100644
--- a/pkg/trait/builder_test.go
+++ b/pkg/trait/builder_test.go
@@ -138,6 +138,9 @@ func createBuilderTestEnv(cluster 
v1.IntegrationPlatformCluster, strategy v1.Int
KanikoBuildCache:   ,
},
},
+   Status: v1.IntegrationPlatformStatus{
+   Phase: v1.IntegrationPlatformPhaseReady,
+   },
},
EnvVars:make([]corev1.EnvVar, 0),
ExecutedTraits: make([]Trait, 0),
diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index 807bd4055..5acbaf94c 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -96,7 +96,7 @@ func (c *Catalog) apply(environment *Environment) error {
 
applicable := false
for _, trait := range traits {
-   if environment.Platform == nil && 
trait.RequiresIntegrationPlatform() {
+   if 
!environment.PlatformInPhase(v1.IntegrationPlatformPhaseReady) && 
trait.RequiresIntegrationPlatform() {
c.L.Debugf("Skipping trait because of missing 
integration platform: %s", trait.ID())
 
continue
@@ -131,8 +131,8 @@ func (c *Catalog) apply(environment *Environment) error {
}
c.L.Debugf("Applied traits: %s", strings.Join(traitIds, ","))
 
-   if !applicable && environment.Platform == nil {
-   return errors.New("no trait can be executed because of no 
integration platform found")
+   if !applicable && 
environment.PlatformInPhase(v1.IntegrationPlatformPhaseReady) {
+   return errors.New("no trait can be executed because of no ready 
platform found")
}
 
for _, processor := range environment.PostProcessors {
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index 82aa32ecd..c420e0095 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -251,6 +251,20 @@ func (e *Environment) IntegrationKitInPhase(phases 
...v1.IntegrationKitPhase) bo
return false
 }
 
+func (e *Environment) PlatformInPhase(phases ...v1.IntegrationPlatformPhase) 
bool {
+   if e.Platform == nil {
+   return false
+   }
+
+   for _, phase := range phases {
+   if e.Platform.Status.Phase == phase {
+   return true
+   }
+   }
+
+   return false
+}
+
 func (e *Environment) InPhase(c v1.IntegrationKitPhase, i v1.IntegrationPhase) 
bool {
return e.IntegrationKitInPhase(c) && e.IntegrationInPhase(i)
 }



[camel-k] 02/05: fix: OpenAPI trait should not run when waiting for platform

2022-09-08 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 327f06dda351b4f32d076b0ab27057897c9e0eeb
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 15:13:57 2022 +0200

fix: OpenAPI trait should not run when waiting for platform
---
 pkg/trait/openapi.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/trait/openapi.go b/pkg/trait/openapi.go
index 36425b004..813bf5205 100644
--- a/pkg/trait/openapi.go
+++ b/pkg/trait/openapi.go
@@ -65,7 +65,7 @@ func (t *openAPITrait) IsPlatformTrait() bool {
 }
 
 func (t *openAPITrait) Configure(e *Environment) (bool, error) {
-   if e.Integration == nil || !pointer.BoolDeref(t.Enabled, true) {
+   if !e.IntegrationInPhase(v1.IntegrationPhaseInitialization) || 
!pointer.BoolDeref(t.Enabled, true) {
return false, nil
}
 



[camel-k] branch main updated: feat: Auto-create platform when registry can be inferred from KEP-1755

2022-09-07 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 b8a6398ca feat: Auto-create platform when registry can be inferred 
from KEP-1755
b8a6398ca is described below

commit b8a6398cae07a37dc697192914119ae6acbab065
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 11:02:33 2022 +0200

feat: Auto-create platform when registry can be inferred from KEP-1755
---
 pkg/trait/platform.go | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/pkg/trait/platform.go b/pkg/trait/platform.go
index 635bc1258..d2e7b6783 100644
--- a/pkg/trait/platform.go
+++ b/pkg/trait/platform.go
@@ -20,7 +20,7 @@ package trait
 import (
"fmt"
 
-   k8serrors "k8s.io/apimachinery/pkg/api/errors"
+   apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/utils/pointer"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
@@ -29,6 +29,7 @@ import (
"github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/util/defaults"
"github.com/apache/camel-k/pkg/util/openshift"
+   image "github.com/apache/camel-k/pkg/util/registry"
 )
 
 type platformTrait struct {
@@ -59,6 +60,10 @@ func (t *platformTrait) Configure(e *Environment) (bool, 
error) {
return false, err
} else if ocp {
t.CreateDefault = 
+   } else if addr, err := 
image.GetRegistryAddress(e.Ctx, t.Client); err != nil {
+   return false, err
+   } else if addr != nil {
+   t.CreateDefault = pointer.Bool(true)
}
}
if t.Global == nil {
@@ -96,7 +101,7 @@ func (t *platformTrait) Apply(e *Environment) error {
 
 func (t *platformTrait) getOrCreatePlatform(e *Environment) 
(*v1.IntegrationPlatform, error) {
pl, err := platform.GetOrFindForResource(e.Ctx, t.Client, 
e.Integration, false)
-   if err != nil && k8serrors.IsNotFound(err) {
+   if err != nil && apierrors.IsNotFound(err) {
if pointer.BoolDeref(t.CreateDefault, false) {
platformName := e.Integration.Status.Platform
if platformName == "" {
@@ -126,7 +131,7 @@ func (t *platformTrait) getOrCreatePlatform(e *Environment) 
(*v1.IntegrationPlat
e.Resources.Add(pl)
 
// Make sure that IntegrationPlatform installed in 
operator namespace can be seen by others
-   if err := install.IntegrationPlatformViewerRole(e.Ctx, 
t.Client, namespace); err != nil && !k8serrors.IsAlreadyExists(err) {
+   if err := install.IntegrationPlatformViewerRole(e.Ctx, 
t.Client, namespace); err != nil && !apierrors.IsAlreadyExists(err) {
t.L.Info(fmt.Sprintf("Cannot install global 
IntegrationPlatform viewer role in namespace '%s': skipping.", namespace))
}
 



[camel-k] branch main updated: fix: Panic with odd number of key / value arguments

2022-09-07 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 9820fe650 fix: Panic with odd number of key / value arguments
9820fe650 is described below

commit 9820fe6500d8a7457ab2883e4e260ba3d986ff86
Author: Antonin Stefanutti 
AuthorDate: Wed Sep 7 10:56:03 2022 +0200

fix: Panic with odd number of key / value arguments
---
 pkg/util/camel/camel_util.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pkg/util/camel/camel_util.go b/pkg/util/camel/camel_util.go
index f41dad240..7b6215881 100644
--- a/pkg/util/camel/camel_util.go
+++ b/pkg/util/camel/camel_util.go
@@ -65,10 +65,10 @@ func newSemVerConstraint(versionConstraint string) 
*semver.Constraints {
constraint, err := semver.NewConstraint(versionConstraint)
if err != nil || constraint == nil {
if err != nil {
-   log.Debug("Unable to parse version constraint: %s, 
error:\n", versionConstraint, err.Error())
+   log.Debugf("Unable to parse version constraint: %s, 
error: %s", versionConstraint, err.Error())
}
if constraint == nil {
-   log.Debug("Unable to parse version constraint: %s\n", 
versionConstraint)
+   log.Debugf("Unable to parse version constraint: %s", 
versionConstraint)
}
}
 



[camel-k] branch main updated: fix: Panic with odd number of key / value arguments

2022-08-30 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

astefanutti 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 95e012339 fix: Panic with odd number of key / value arguments
95e012339 is described below

commit 95e012339542cdcc5bdeef466476cb5049241b05
Author: Antonin Stefanutti 
AuthorDate: Tue Aug 30 12:33:52 2022 +0200

fix: Panic with odd number of key / value arguments
---
 pkg/trait/trait_catalog.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/trait/trait_catalog.go b/pkg/trait/trait_catalog.go
index f706fa959..807bd4055 100644
--- a/pkg/trait/trait_catalog.go
+++ b/pkg/trait/trait_catalog.go
@@ -97,7 +97,7 @@ func (c *Catalog) apply(environment *Environment) error {
applicable := false
for _, trait := range traits {
if environment.Platform == nil && 
trait.RequiresIntegrationPlatform() {
-   c.L.Debug("Skipping trait because of missing 
integration platform: %s", trait.ID())
+   c.L.Debugf("Skipping trait because of missing 
integration platform: %s", trait.ID())
 
continue
}



[camel-k] 12/13: fix(install): Use SSA to apply CRDs

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 52b46ce4b0931ea7ecc6d19c922db8e68ee7e8f6
Author: Antonin Stefanutti 
AuthorDate: Fri Aug 19 16:28:51 2022 +0200

fix(install): Use SSA to apply CRDs
---
 install/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/install/Makefile b/install/Makefile
index 1680f9d90..e0c497908 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -194,7 +194,7 @@ endif
 ifeq ($(DRY_RUN), false)
@$(KUSTOMIZE) build $(KOPTIONS) $@ | \
sed 's/$(PLACEHOLDER)/$(NAMESPACE)/' | \
-   kubectl apply -f -
+   kubectl apply --server-side -f -
 else
@$(KUSTOMIZE) build $(KOPTIONS) $@ | \
sed 's/$(PLACEHOLDER)/$(NAMESPACE)/'
@@ -236,7 +236,7 @@ endif
 ifeq ($(DRY_RUN), false)
@$(KUSTOMIZE) build $(KOPTIONS) $@ | \
sed 's/$(PLACEHOLDER)/$(NAMESPACE)/' | \
-   kubectl apply -f -
+   kubectl apply --server-side -f -
 else
@$(KUSTOMIZE) build $(KOPTIONS) $@ | \
sed 's/$(PLACEHOLDER)/$(NAMESPACE)/'



[camel-k] 13/13: fix(e2e): Increase Pod deletion timeout

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d646fc6df6a4623042f5586d1874b4d750daa55a
Author: Antonin Stefanutti 
AuthorDate: Fri Aug 19 17:52:16 2022 +0200

fix(e2e): Increase Pod deletion timeout
---
 e2e/namespace/install/cli/delete_test.go| 14 +++---
 e2e/namespace/install/cli/dev_mode_test.go  |  2 +-
 e2e/namespace/install/cli/uninstall_test.go |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/e2e/namespace/install/cli/delete_test.go 
b/e2e/namespace/install/cli/delete_test.go
index c057fab79..e453a304b 100644
--- a/e2e/namespace/install/cli/delete_test.go
+++ b/e2e/namespace/install/cli/delete_test.go
@@ -42,14 +42,14 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "yaml"), 
TestTimeoutMedium).Should(BeNil())
})
 
t.Run("delete building integration", func(t *testing.T) {
Expect(KamelRunWithID(operatorID, ns, 
"../files/yaml.yaml").Execute()).To(Succeed())
Expect(Kamel("delete", "yaml", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "yaml"), 
TestTimeoutMedium).Should(BeNil())
})
 
t.Run("delete integration from csv", func(t *testing.T) {
@@ -57,7 +57,7 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "yaml"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "yaml"), 
TestTimeoutMedium).Should(BeNil())
})
 
t.Run("delete several integrations", func(t *testing.T) {
@@ -67,10 +67,10 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "java"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "yaml", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "yaml"), 
TestTimeoutMedium).Should(BeNil())
Expect(Kamel("delete", "java", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "java")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "java")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "java"), 
TestTimeoutMedium).Should(BeNil())
})
 
t.Run("delete all integrations", func(t *testing.T) {
@@ -80,9 +80,9 @@ func TestKamelCLIDelete(t *testing.T) {
Eventually(IntegrationPodPhase(ns, "java"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
Eventually(Integration(ns, "yaml")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "yaml")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "yaml"), 
TestTimeoutMedium).Should(BeNil())
Eventually(Integration(ns, "java")).Should(BeNil())
-   Eventually(IntegrationPod(ns, "java")).Should(BeNil())
+   Eventually(IntegrationPod(ns, "java"), 
TestTimeoutMedium).Should(BeNil())
})
})
 }
diff --git a/e2e/namespace/install/cli/dev_mode_test.go 
b/e2e/namespace/install/cli/dev_mode_test.go
index 289af3697..dc3cc5f38 100644
--- a/e2e/namespace/install/cli/de

[camel-k] 10/13: fix(e2e): Remove Knative eventing sugar controller

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 5e0cdb5fa6a59398d4bda2655e182f19567a3691
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 18:24:51 2022 +0200

fix(e2e): Remove Knative eventing sugar controller
---
 .github/actions/kamel-install-knative/install-knative.sh | 4 
 1 file changed, 4 deletions(-)

diff --git a/.github/actions/kamel-install-knative/install-knative.sh 
b/.github/actions/kamel-install-knative/install-knative.sh
index 87a87c3ea..7ea1a1302 100755
--- a/.github/actions/kamel-install-knative/install-knative.sh
+++ b/.github/actions/kamel-install-knative/install-knative.sh
@@ -60,7 +60,6 @@ 
EVENTING_CRDS="https://github.com/knative/eventing/releases/download/${EVENTING_
 
EVENTING_CORE="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-core.yaml;
 
IN_MEMORY_CHANNEL="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/in-memory-channel.yaml;
 
CHANNEL_BROKER="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/mt-channel-broker.yaml;
-SUGAR_CONTROLLER="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-sugar-controller.yaml;
 
 # Serving
 apply "${SERVING_CRDS}"
@@ -122,9 +121,6 @@ else
   exit 1
 fi
 
-# Eventing sugar controller for injection
-apply ${SUGAR_CONTROLLER}
-
 # Wait for installation completed
 echo "Waiting for all pods to be ready in kourier-system"
 kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s



[camel-k] 11/13: fix(e2e): Patch Knative eventing sugar ConfigMap

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit a3b59723e62e1f54be6baca24348939e81b98545
Author: Antonin Stefanutti 
AuthorDate: Fri Aug 19 10:21:43 2022 +0200

fix(e2e): Patch Knative eventing sugar ConfigMap
---
 .github/actions/kamel-install-knative/install-knative.sh | 12 
 1 file changed, 12 insertions(+)

diff --git a/.github/actions/kamel-install-knative/install-knative.sh 
b/.github/actions/kamel-install-knative/install-knative.sh
index 7ea1a1302..8434afc94 100755
--- a/.github/actions/kamel-install-knative/install-knative.sh
+++ b/.github/actions/kamel-install-knative/install-knative.sh
@@ -121,6 +121,18 @@ else
   exit 1
 fi
 
+# Eventing sugar controller configuration
+echo "Patching Knative eventing configuration"
+kubectl patch configmap/config-sugar \
+  -n knative-eventing \
+  --type merge \
+  -p 
'{"data":{"namespace-selector":"{\"matchExpressions\":[{\"key\":\"eventing.knative.dev/injection\",\"operator\":\"In\",\"values\":[\"enabled\"]}]}"}}'
+
+kubectl patch configmap/config-sugar \
+  -n knative-eventing \
+  --type merge \
+  -p 
'{"data":{"trigger-selector":"{\"matchExpressions\":[{\"key\":\"eventing.knative.dev/injection\",\"operator\":\"In\",\"values\":[\"enabled\"]}]}"}}'
+
 # Wait for installation completed
 echo "Waiting for all pods to be ready in kourier-system"
 kubectl wait --for=condition=Ready pod --all -n kourier-system --timeout=60s



[camel-k] 09/13: chore(e2e): Upgrade KinD to version 0.14.0 and v1.23.6 node

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 6ed2a71755440883696c1b2b117b2339ab5c7c90
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 17:53:54 2022 +0200

chore(e2e): Upgrade KinD to version 0.14.0 and v1.23.6 node
---
 .github/actions/kamel-config-cluster-kind/action.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/actions/kamel-config-cluster-kind/action.yml 
b/.github/actions/kamel-config-cluster-kind/action.yml
index 3034ee85a..0f81599a2 100644
--- a/.github/actions/kamel-config-cluster-kind/action.yml
+++ b/.github/actions/kamel-config-cluster-kind/action.yml
@@ -26,8 +26,8 @@ runs:
   uses: container-tools/kind-action@v1
   if: ${{ env.CLUSTER_KIND_CONFIGURED != 'true' }}
   with:
-version: v0.11.0
-node_image: 
kindest/node:v1.21.1@sha256:fae9a58f17f18f06aeac9772ca8b5ac680ebbed985e266f711d936e91d113bad
+version: v0.14.0
+node_image: 
kindest/node:v1.23.6@sha256:b1fa224cc6c7ff32455e0b1fd9cbfd3d3bc87ecaa8fcb06961ed1afb3db0f9ae
 
 - id: info
   name: Info



[camel-k] 08/13: chore(e2e): Install Knative 1.6.0

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 2d6f29b5284a1fbf92ba427b2057a1f7daab7c06
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 17:48:51 2022 +0200

chore(e2e): Install Knative 1.6.0
---
 .github/actions/kamel-install-knative/install-knative.sh | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.github/actions/kamel-install-knative/install-knative.sh 
b/.github/actions/kamel-install-knative/install-knative.sh
index a8a342a7e..87a87c3ea 100755
--- a/.github/actions/kamel-install-knative/install-knative.sh
+++ b/.github/actions/kamel-install-knative/install-knative.sh
@@ -30,9 +30,9 @@ sudo wget 
https://github.com/mikefarah/yq/releases/download/v4.26.1/yq_linux_amd
 
 set +e
 
-export SERVING_VERSION=knative-v1.3.0
-export EVENTING_VERSION=knative-v1.3.3
-export KOURIER_VERSION=knative-v1.3.0
+export SERVING_VERSION=knative-v1.6.0
+export EVENTING_VERSION=knative-v1.6.0
+export KOURIER_VERSION=knative-v1.6.0
 
 apply() {
   local file="${1:-}"
@@ -55,7 +55,7 @@ apply() {
 
 
SERVING_CRDS="https://github.com/knative/serving/releases/download/${SERVING_VERSION}/serving-crds.yaml;
 
SERVING_CORE="https://github.com/knative/serving/releases/download/${SERVING_VERSION}/serving-core.yaml;
-KOURIER="https://github.com/knative/net-kourier/releases/download/${KOURIER_VERSION}/kourier.yaml;
+KOURIER="https://github.com/knative-sandbox/net-kourier/releases/download/${KOURIER_VERSION}/kourier.yaml;
 
EVENTING_CRDS="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-crds.yaml;
 
EVENTING_CORE="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/eventing-core.yaml;
 
IN_MEMORY_CHANNEL="https://github.com/knative/eventing/releases/download/${EVENTING_VERSION}/in-memory-channel.yaml;



[camel-k] branch main updated (d318d2b8a -> d646fc6df)

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from d318d2b8a chore(cli): refactor run cmd to remove nolint maintidx
 new 628d78d98 chore: Upgrade k8s to v0.23.5 and controller-runtime to 
v0.11.2
 new 04c4828cd chore: Fix logr and klog dependencies
 new 5a2fdfc15 fix: Probe handler field has been renamed
 new 328862acd chore: Upgrade sub-modules to k8s v0.23.5
 new d9192376c chore: Upgrade code-generator to v0.23.5
 new ae3b2d7b4 chore: Upgrade Knative to version 1.6.0
 new 6d6a9efbb chore: Update CRDs based on k8s APIs v0.23.5
 new 2d6f29b52 chore(e2e): Install Knative 1.6.0
 new 6ed2a7175 chore(e2e): Upgrade KinD to version 0.14.0 and v1.23.6 node
 new 5e0cdb5fa fix(e2e): Remove Knative eventing sugar controller
 new a3b59723e fix(e2e): Patch Knative eventing sugar ConfigMap
 new 52b46ce4b fix(install): Use SSA to apply CRDs
 new d646fc6df fix(e2e): Increase Pod deletion timeout

The 13 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../actions/kamel-config-cluster-kind/action.yml   |   4 +-
 .../kamel-install-knative/install-knative.sh   |  22 +-
 .../duck/client/internalclientset/clientset.go |  34 +-
 .../typed/duck/v1beta2/duck_client.go  |  20 +-
 .../crd/bases/camel.apache.org_integrations.yaml   | 544 +++-
 .../bases/camel.apache.org_kameletbindings.yaml| 581 +++--
 e2e/global/common/build/maven_ca_secret_test.go|   2 +-
 e2e/namespace/install/cli/delete_test.go   |  14 +-
 e2e/namespace/install/cli/dev_mode_test.go |   2 +-
 e2e/namespace/install/cli/uninstall_test.go|   2 +-
 go.mod |  63 +-
 go.sum | 702 -
 helm/camel-k/crds/crd-integration.yaml | 544 +++-
 helm/camel-k/crds/crd-kamelet-binding.yaml | 581 +++--
 install/Makefile   |   4 +-
 pkg/apis/camel/go.mod  |  19 +-
 pkg/apis/camel/go.sum  |  65 +-
 pkg/client/camel/clientset/versioned/clientset.go  |  37 +-
 .../versioned/typed/camel/v1/camel_client.go   |  20 +-
 .../versioned/typed/camel/v1/fake/fake_build.go|   2 +-
 .../typed/camel/v1/fake/fake_camelcatalog.go   |   2 +-
 .../typed/camel/v1/fake/fake_integration.go|   2 +-
 .../typed/camel/v1/fake/fake_integrationkit.go |   2 +-
 .../camel/v1/fake/fake_integrationplatform.go  |   2 +-
 .../versioned/typed/camel/v1alpha1/camel_client.go |  20 +-
 .../typed/camel/v1alpha1/fake/fake_kamelet.go  |   2 +-
 .../camel/v1alpha1/fake/fake_kameletbinding.go |   2 +-
 pkg/client/camel/go.mod|  35 +-
 pkg/client/camel/go.sum| 243 +--
 pkg/kamelet/repository/go.mod  |  37 +-
 pkg/kamelet/repository/go.sum  | 245 +--
 pkg/resources/resources.go |  12 +-
 pkg/trait/health.go|   8 +-
 script/Makefile|   2 +-
 34 files changed, 2636 insertions(+), 1240 deletions(-)



[camel-k] 05/13: chore: Upgrade code-generator to v0.23.5

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d9192376cee5fac405b1cd3298d96e2a7e1e8049
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 17:38:40 2022 +0200

chore: Upgrade code-generator to v0.23.5
---
 .../duck/client/internalclientset/clientset.go | 34 
 .../typed/duck/v1beta2/duck_client.go  | 20 +++-
 pkg/client/camel/clientset/versioned/clientset.go  | 37 --
 .../versioned/typed/camel/v1/camel_client.go   | 20 +++-
 .../versioned/typed/camel/v1/fake/fake_build.go|  2 +-
 .../typed/camel/v1/fake/fake_camelcatalog.go   |  2 +-
 .../typed/camel/v1/fake/fake_integration.go|  2 +-
 .../typed/camel/v1/fake/fake_integrationkit.go |  2 +-
 .../camel/v1/fake/fake_integrationplatform.go  |  2 +-
 .../versioned/typed/camel/v1alpha1/camel_client.go | 20 +++-
 .../typed/camel/v1alpha1/fake/fake_kamelet.go  |  2 +-
 .../camel/v1alpha1/fake/fake_kameletbinding.go |  2 +-
 script/Makefile|  2 +-
 13 files changed, 120 insertions(+), 27 deletions(-)

diff --git a/addons/strimzi/duck/client/internalclientset/clientset.go 
b/addons/strimzi/duck/client/internalclientset/clientset.go
index 0049d2ea2..2446af8e3 100644
--- a/addons/strimzi/duck/client/internalclientset/clientset.go
+++ b/addons/strimzi/duck/client/internalclientset/clientset.go
@@ -21,6 +21,7 @@ package internalclientset
 
 import (
"fmt"
+   "net/http"
 
kafkav1beta2 
"github.com/apache/camel-k/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2"
discovery "k8s.io/client-go/discovery"
@@ -56,22 +57,41 @@ func (c *Clientset) Discovery() 
discovery.DiscoveryInterface {
 // NewForConfig creates a new Clientset for the given config.
 // If config's RateLimiter is not set and QPS and Burst are acceptable,
 // NewForConfig will generate a rate-limiter in configShallowCopy.
+// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient),
+// where httpClient was generated with rest.HTTPClientFor(c).
 func NewForConfig(c *rest.Config) (*Clientset, error) {
configShallowCopy := *c
+
+   // share the transport between all clients
+   httpClient, err := rest.HTTPClientFor()
+   if err != nil {
+   return nil, err
+   }
+
+   return NewForConfigAndClient(, httpClient)
+}
+
+// NewForConfigAndClient creates a new Clientset for the given config and http 
client.
+// Note the http client provided takes precedence over the configured 
transport values.
+// If config's RateLimiter is not set and QPS and Burst are acceptable,
+// NewForConfigAndClient will generate a rate-limiter in configShallowCopy.
+func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) 
(*Clientset, error) {
+   configShallowCopy := *c
if configShallowCopy.RateLimiter == nil && configShallowCopy.QPS > 0 {
if configShallowCopy.Burst <= 0 {
return nil, fmt.Errorf("burst is required to be greater 
than 0 when RateLimiter is not set and QPS is set to greater than 0")
}
configShallowCopy.RateLimiter = 
flowcontrol.NewTokenBucketRateLimiter(configShallowCopy.QPS, 
configShallowCopy.Burst)
}
+
var cs Clientset
var err error
-   cs.kafkaV1beta2, err = kafkav1beta2.NewForConfig()
+   cs.kafkaV1beta2, err = 
kafkav1beta2.NewForConfigAndClient(, httpClient)
if err != nil {
return nil, err
}
 
-   cs.DiscoveryClient, err = 
discovery.NewDiscoveryClientForConfig()
+   cs.DiscoveryClient, err = 
discovery.NewDiscoveryClientForConfigAndClient(, httpClient)
if err != nil {
return nil, err
}
@@ -81,11 +101,11 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
 // NewForConfigOrDie creates a new Clientset for the given config and
 // panics if there is an error in the config.
 func NewForConfigOrDie(c *rest.Config) *Clientset {
-   var cs Clientset
-   cs.kafkaV1beta2 = kafkav1beta2.NewForConfigOrDie(c)
-
-   cs.DiscoveryClient = discovery.NewDiscoveryClientForConfigOrDie(c)
-   return 
+   cs, err := NewForConfig(c)
+   if err != nil {
+   panic(err)
+   }
+   return cs
 }
 
 // New creates a new Clientset for the given RESTClient.
diff --git 
a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/duck_client.go
 
b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/duck_client.go
index 51c4afd1a..542445b16 100644
--- 
a/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/duck_client.go
+++ 
b/addons/strimzi/duck/client/internalclientset/typed/duck/v1beta2/duck_client.go
@@ -20,6 +20,8 @@ limitati

[camel-k] 04/13: chore: Upgrade sub-modules to k8s v0.23.5

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 328862acdeee38e59a20f18879bb6d984f6a0858
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 16:51:58 2022 +0200

chore: Upgrade sub-modules to k8s v0.23.5
---
 pkg/apis/camel/go.mod |  19 ++--
 pkg/apis/camel/go.sum |  65 ++-
 pkg/client/camel/go.mod   |  35 +++---
 pkg/client/camel/go.sum   | 243 ++---
 pkg/kamelet/repository/go.mod |  37 +++
 pkg/kamelet/repository/go.sum | 245 +++---
 6 files changed, 501 insertions(+), 143 deletions(-)

diff --git a/pkg/apis/camel/go.mod b/pkg/apis/camel/go.mod
index 8b6e3d2a3..65140f0bf 100644
--- a/pkg/apis/camel/go.mod
+++ b/pkg/apis/camel/go.mod
@@ -5,26 +5,27 @@ go 1.17
 require (
github.com/imdario/mergo v0.3.13
github.com/stretchr/testify v1.7.0
-   k8s.io/api v0.22.5
-   k8s.io/apimachinery v0.22.5
-   k8s.io/utils v0.0.0-20220713171938-56c0de1e6f5e
+   k8s.io/api v0.23.5
+   k8s.io/apimachinery v0.23.5
+   k8s.io/utils v0.0.0-2026205334-6203023598ed
 )
 
 require (
github.com/davecgh/go-spew v1.1.1 // indirect
-   github.com/go-logr/logr v0.4.0 // indirect
+   github.com/go-logr/logr v1.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
-   github.com/json-iterator/go v1.1.11 // indirect
+   github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // 
indirect
-   github.com/modern-go/reflect2 v1.0.1 // indirect
+   github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/net v0.0.0-20211209124913-491a49abca63 // indirect
-   golang.org/x/text v0.3.6 // indirect
+   golang.org/x/text v0.3.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0 // indirect
-   k8s.io/klog/v2 v2.9.0 // indirect
-   sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
+   k8s.io/klog/v2 v2.30.0 // indirect
+   sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
+   sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
 )
diff --git a/pkg/apis/camel/go.sum b/pkg/apis/camel/go.sum
index 20a0319db..b61af554e 100644
--- a/pkg/apis/camel/go.sum
+++ b/pkg/apis/camel/go.sum
@@ -15,13 +15,17 @@ github.com/elazarl/goproxy 
v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkg
 github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod 
h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
 github.com/envoyproxy/go-control-plane 
v0.9.1-0.20191026205805-5f8ba28d4473/go.mod 
h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
 github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod 
h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
-github.com/evanphx/json-patch v4.11.0+incompatible/go.mod 
h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
+github.com/evanphx/json-patch v4.12.0+incompatible/go.mod 
h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk=
 github.com/fsnotify/fsnotify v1.4.7/go.mod 
h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
 github.com/fsnotify/fsnotify v1.4.9/go.mod 
h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
+github.com/getkin/kin-openapi v0.76.0/go.mod 
h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
+github.com/ghodss/yaml v1.0.0/go.mod 
h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
 github.com/go-logr/logr v0.1.0/go.mod 
h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
-github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc=
-github.com/go-logr/logr v0.4.0/go.mod 
h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
+github.com/go-logr/logr v0.2.0/go.mod 
h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
+github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE=
+github.com/go-logr/logr v1.2.0/go.mod 
h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
 github.com/go-openapi/jsonpointer v0.19.3/go.mod 
h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
+github.com/go-openapi/jsonpointer v0.19.5/go.mod 
h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
 github.com/go-openapi/jsonreference v0.19.3/go.mod 
h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8=
 github.com/go-openapi/swag v0.19.5/go.mod 
h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
 github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
@@ -48,17 +52,17 @@ github.com/google/go-cmp v0.5.5/go.mod 
h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
 github.com/google/gofuzz v1.0.0/go.mod 
h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
 github.com/google/gofuzz v1.1.0 h1:Hsa8mG0dQ46ij8Sl2AYJDUv1oA9/d6Vk+3LG99Oe02g=
 github.com

[camel-k] 03/13: fix: Probe handler field has been renamed

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 5a2fdfc150b23d5d9dd4e904bb48771ba07ce0e5
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 16:41:18 2022 +0200

fix: Probe handler field has been renamed
---
 e2e/global/common/build/maven_ca_secret_test.go | 2 +-
 pkg/trait/health.go | 8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/e2e/global/common/build/maven_ca_secret_test.go 
b/e2e/global/common/build/maven_ca_secret_test.go
index 386b443dc..755a46fff 100644
--- a/e2e/global/common/build/maven_ca_secret_test.go
+++ b/e2e/global/common/build/maven_ca_secret_test.go
@@ -251,7 +251,7 @@ ProxyPreserveHost On
ReadinessProbe: 
{

InitialDelaySeconds: 30,

FailureThreshold:3,
-   
Handler: corev1.Handler{
+   
ProbeHandler: corev1.ProbeHandler{

HTTPGet: {

Port: intstr.FromString("nexus"),

Path: "/repository/maven-public/",
diff --git a/pkg/trait/health.go b/pkg/trait/health.go
index 882487e17..33c81f3fd 100644
--- a/pkg/trait/health.go
+++ b/pkg/trait/health.go
@@ -123,7 +123,7 @@ func (t *healthTrait) Apply(e *Environment) error {
 
 func (t *healthTrait) newLivenessProbe(port *intstr.IntOrString, path string) 
*corev1.Probe {
p := corev1.Probe{
-   Handler: corev1.Handler{
+   ProbeHandler: corev1.ProbeHandler{
HTTPGet: {
Path:   path,
Scheme: corev1.URIScheme(t.LivenessScheme),
@@ -137,7 +137,7 @@ func (t *healthTrait) newLivenessProbe(port 
*intstr.IntOrString, path string) *c
}
 
if port != nil {
-   p.Handler.HTTPGet.Port = *port
+   p.ProbeHandler.HTTPGet.Port = *port
}
 
return 
@@ -145,7 +145,7 @@ func (t *healthTrait) newLivenessProbe(port 
*intstr.IntOrString, path string) *c
 
 func (t *healthTrait) newReadinessProbe(port *intstr.IntOrString, path string) 
*corev1.Probe {
p := corev1.Probe{
-   Handler: corev1.Handler{
+   ProbeHandler: corev1.ProbeHandler{
HTTPGet: {
Path:   path,
Scheme: corev1.URIScheme(t.ReadinessScheme),
@@ -159,7 +159,7 @@ func (t *healthTrait) newReadinessProbe(port 
*intstr.IntOrString, path string) *
}
 
if port != nil {
-   p.Handler.HTTPGet.Port = *port
+   p.ProbeHandler.HTTPGet.Port = *port
}
 
return 



[camel-k] 01/13: chore: Upgrade k8s to v0.23.5 and controller-runtime to v0.11.2

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 628d78d9810e11c8b3f4a12561cf29d33957d872
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 16:29:30 2022 +0200

chore: Upgrade k8s to v0.23.5 and controller-runtime to v0.11.2
---
 go.mod | 27 ++-
 go.sum | 95 +-
 2 files changed, 55 insertions(+), 67 deletions(-)

diff --git a/go.mod b/go.mod
index 84a1adf06..f26752478 100644
--- a/go.mod
+++ b/go.mod
@@ -46,22 +46,22 @@ require (
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
-   golang.org/x/time v0.0.0-2026232009-f0f3c7e86c11
+   golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
gopkg.in/inf.v0 v0.9.1
gopkg.in/yaml.v2 v2.4.0
-   k8s.io/api v0.22.5
-   k8s.io/apiextensions-apiserver v0.22.5
-   k8s.io/apimachinery v0.22.5
-   k8s.io/cli-runtime v0.22.5
-   k8s.io/client-go v0.22.5
+   k8s.io/api v0.23.5
+   k8s.io/apiextensions-apiserver v0.23.5
+   k8s.io/apimachinery v0.23.5
+   k8s.io/cli-runtime v0.23.5
+   k8s.io/client-go v0.23.5
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185
k8s.io/klog/v2 v2.40.1
-   k8s.io/kubectl v0.22.5
+   k8s.io/kubectl v0.23.5
k8s.io/utils v0.0.0-20220713171938-56c0de1e6f5e
knative.dev/eventing v0.30.3
knative.dev/pkg v0.0.0-20220301181942-2fdd5f232e77
knative.dev/serving v0.30.0
-   sigs.k8s.io/controller-runtime v0.10.3
+   sigs.k8s.io/controller-runtime v0.11.2
 )
 
 require (
@@ -96,7 +96,7 @@ require (
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/go-kit/log v0.2.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
-   github.com/go-logr/zapr v0.4.0 // indirect
+   github.com/go-logr/zapr v1.2.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.2.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // 
indirect
@@ -141,11 +141,11 @@ require (
go.opencensus.io v0.23.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
-   golang.org/x/mod v0.5.1 // indirect
+   golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect
golang.org/x/net v0.0.0-2022052938-2e3eb7b945c2 // indirect
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8 // indirect
golang.org/x/text v0.3.7 // indirect
-   golang.org/x/tools v0.1.8 // indirect
+   golang.org/x/tools v0.1.10-0.20220218145154-897bd77cd717 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/api v0.81.0 // indirect
@@ -155,10 +155,11 @@ require (
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.66.4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
-   k8s.io/component-base v0.22.5 // indirect
+   k8s.io/component-base v0.23.5 // indirect
k8s.io/kube-openapi v0.0.0-2025234752-e816edb12b65 // indirect
knative.dev/networking v0.0.0-20220302134042-e8b2eb995165 // indirect
-   sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
+   sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
+   sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
 )
 
diff --git a/go.sum b/go.sum
index 9d2dc89f3..01fc53e34 100644
--- a/go.sum
+++ b/go.sum
@@ -30,7 +30,6 @@ cloud.google.com/go v0.94.1/go.mod 
h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW
 cloud.google.com/go v0.97.0/go.mod 
h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc=
 cloud.google.com/go v0.98.0/go.mod 
h1:ua6Ush4NALrHk5QXDWnjvZHN93OuF0HfuEPq9I1X0cM=
 cloud.google.com/go v0.99.0/go.mod 
h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA=
-cloud.google.com/go v0.100.2 h1:t9Iw5QH5v4XtlEQaCtUY7x6sCABps8sW0acw7e2WQ6Y=
 cloud.google.com/go v0.100.2/go.mod 
h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A=
 cloud.google.com/go/bigquery v1.0.1/go.mod 
h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
 cloud.google.com/go/bigquery v1.3.0/go.mod 
h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
@@ -212,7 +211,6 @@ github.com/bketelsen/crypt 
v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJm
 github.com/bketelsen/crypt v0.0.4/go.mod 
h1:aI6NrJ0pMGgvZKL1iVgXLnfIFJtfV+bKCoqOes/6LfM=
 github.com/blang/semver v3.1.0+incompatible/go.mod 
h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
 github.com/blang/semver v3.5.0+incompatible/go.mod 
h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
-github.com

[camel-k] 02/13: chore: Fix logr and klog dependencies

2022-08-22 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 04c4828cdf66112a81ccfda67d1324df543c1c23
Author: Antonin Stefanutti 
AuthorDate: Thu Aug 18 16:36:28 2022 +0200

chore: Fix logr and klog dependencies
---
 go.mod |  6 +-
 go.sum | 14 --
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/go.mod b/go.mod
index f26752478..907090f9c 100644
--- a/go.mod
+++ b/go.mod
@@ -163,11 +163,7 @@ require (
sigs.k8s.io/yaml v1.3.0 // indirect
 )
 
-replace (
-   github.com/docker/docker => github.com/moby/moby 
v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
-   github.com/go-logr/logr => github.com/go-logr/logr v0.4.0
-   k8s.io/klog/v2 => k8s.io/klog/v2 v2.9.0
-)
+replace github.com/docker/docker => github.com/moby/moby 
v0.7.3-0.20190826074503-38ab9da00309 // Required by Helm
 
 // Using a fork that removes the HTTPS ping before using HTTP for insecure 
registries (for Spectrum)
 replace github.com/google/go-containerregistry => 
github.com/container-tools/go-containerregistry 
v0.7.1-0.20211124090132-40ccc94a466b
diff --git a/go.sum b/go.sum
index 01fc53e34..16bc739af 100644
--- a/go.sum
+++ b/go.sum
@@ -511,8 +511,12 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod 
h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V
 github.com/go-logfmt/logfmt v0.5.0/go.mod 
h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
 github.com/go-logfmt/logfmt v0.5.1 
h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
 github.com/go-logfmt/logfmt v0.5.1/go.mod 
h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
-github.com/go-logr/logr v0.4.0 h1:K7/B1jt6fIBQVd4Owv2MqGQClcgf0R266+7C/QjRcLc=
+github.com/go-logr/logr v0.1.0/go.mod 
h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas=
+github.com/go-logr/logr v0.2.0/go.mod 
h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
 github.com/go-logr/logr v0.4.0/go.mod 
h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
+github.com/go-logr/logr v1.2.0/go.mod 
h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/go-logr/logr v1.2.2 h1:ahHml/yUpnlb96Rp8HCvtYVPY8ZYpxq3g7UYchIYwbs=
+github.com/go-logr/logr v1.2.2/go.mod 
h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
 github.com/go-logr/zapr v0.1.0/go.mod 
h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=
 github.com/go-logr/zapr v0.4.0/go.mod 
h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=
 github.com/go-logr/zapr v1.2.0 h1:n4JnPI1T3Qq1SFEi/F8rwLrZERp2bso19PJZDB9dayk=
@@ -2112,8 +2116,14 @@ k8s.io/klog v0.0.0-20181102134211-b9b56d5dfc92/go.mod 
h1:Gq+BEi5rUBO/HRz0bTSXDUc
 k8s.io/klog v0.2.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
 k8s.io/klog v0.3.0/go.mod h1:Gq+BEi5rUBO/HRz0bTSXDUcqjScdoY3a9IHpCEIOOfk=
 k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
-k8s.io/klog/v2 v2.9.0 h1:D7HV+n1V57XeZ0m6tdRkfknthUaM06VFbWldOFh8kzM=
+k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=
+k8s.io/klog/v2 v2.2.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
+k8s.io/klog/v2 v2.4.0/go.mod h1:Od+F08eJP+W3HUb4pSrPpgp9DGU4GzlpG/TmITuYh/Y=
+k8s.io/klog/v2 v2.8.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
 k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec=
+k8s.io/klog/v2 v2.30.0/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
+k8s.io/klog/v2 v2.40.1 h1:P4RRucWk/lFOlDdkAr3mc7iWFkgKrZY9qZMAgek06S4=
+k8s.io/klog/v2 v2.40.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
 k8s.io/kube-openapi v0.0.0-20200121204235-bf4fb3bd569c/go.mod 
h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
 k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6/go.mod 
h1:GRQhZsXIAJ1xR0C9bd8UpWHZ5plfAS9fzPjJuQ6JL3E=
 k8s.io/kube-openapi v0.0.0-20200805222855-6aeccd4b50c6/go.mod 
h1:UuqjUnNftUyPE5H64/qeyjQoUZhGpeFDVdxjTeEVN2o=



[camel-k] branch main updated (72ec43bda -> 58fa430a6)

2022-08-04 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from 72ec43bda Some improvements in runtime-resources.adoc (#3513)
 new 7eee5bc10 re-deployment strategies #2256
 new 58fa430a6 regen

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../camel.apache.org_integrationplatforms.yaml | 44 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 22 +
 .../bases/camel.apache.org_kameletbindings.yaml| 22 +
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  | 30 +++
 docs/modules/traits/pages/deployment.adoc  | 21 +
 e2e/global/common/traits/deployment_test.go| 98 ++
 helm/camel-k/crds/crd-integration-platform.yaml| 44 ++
 helm/camel-k/crds/crd-integration.yaml | 22 +
 helm/camel-k/crds/crd-kamelet-binding.yaml | 22 +
 pkg/apis/camel/v1/trait/deployment.go  | 20 +
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   | 10 +++
 pkg/trait/deployment.go| 34 +++-
 pkg/trait/deployment_test.go   | 88 +++
 resources/traits.yaml  | 16 
 14 files changed, 492 insertions(+), 1 deletion(-)
 create mode 100644 e2e/global/common/traits/deployment_test.go



[camel-k] 02/02: regen

2022-08-04 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 58fa430a602b9ed6e3fe1e6a71ef5eedfdd63894
Author: Luca Burgazzoli 
AuthorDate: Wed Aug 3 16:34:38 2022 +0200

regen
---
 .../camel.apache.org_integrationplatforms.yaml | 44 ++
 .../crd/bases/camel.apache.org_integrations.yaml   | 22 +++
 .../bases/camel.apache.org_kameletbindings.yaml| 22 +++
 docs/modules/ROOT/partials/apis/camel-k-crds.adoc  | 30 +++
 docs/modules/traits/pages/deployment.adoc  | 21 +++
 helm/camel-k/crds/crd-integration-platform.yaml| 44 ++
 helm/camel-k/crds/crd-integration.yaml | 22 +++
 helm/camel-k/crds/crd-kamelet-binding.yaml | 22 +++
 pkg/apis/camel/v1/trait/deployment.go  |  1 +
 pkg/apis/camel/v1/trait/zz_generated.deepcopy.go   | 10 +
 resources/traits.yaml  | 16 
 11 files changed, 254 insertions(+)

diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml 
b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index ffd239464..cda07f954 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -734,6 +734,28 @@ spec:
   defaults to 60s.
 format: int32
 type: integer
+  rollingUpdateMaxSurge:
+description: 'The maximum number of pods that can be 
scheduled
+  above the desired number of pods. Value can be an 
absolute
+  number (ex: 5) or a percentage of desired pods (ex: 
10%).
+  This can not be 0 if MaxUnavailable is 0. Absolute 
number
+  is calculated from percentage by rounding up. 
Defaults to
+  25%.'
+type: integer
+  rollingUpdateMaxUnavailable:
+description: 'The maximum number of pods that can be 
unavailable
+  during the update. Value can be an absolute number 
(ex:
+  5) or a percentage of desired pods (ex: 10%). 
Absolute number
+  is calculated from percentage by rounding down. This 
can
+  not be 0 if MaxSurge is 0. Defaults to 25%.'
+type: integer
+  strategy:
+description: The deployment strategy to use to replace 
existing
+  pods with new ones.
+enum:
+- Recreate
+- RollingUpdate
+type: string
 type: object
   environment:
 description: The configuration of Environment trait
@@ -2340,6 +2362,28 @@ spec:
   defaults to 60s.
 format: int32
 type: integer
+  rollingUpdateMaxSurge:
+description: 'The maximum number of pods that can be 
scheduled
+  above the desired number of pods. Value can be an 
absolute
+  number (ex: 5) or a percentage of desired pods (ex: 
10%).
+  This can not be 0 if MaxUnavailable is 0. Absolute 
number
+  is calculated from percentage by rounding up. 
Defaults to
+  25%.'
+type: integer
+  rollingUpdateMaxUnavailable:
+description: 'The maximum number of pods that can be 
unavailable
+  during the update. Value can be an absolute number 
(ex:
+  5) or a percentage of desired pods (ex: 10%). 
Absolute number
+  is calculated from percentage by rounding down. This 
can
+  not be 0 if MaxSurge is 0. Defaults to 25%.'
+type: integer
+  strategy:
+description: The deployment strategy to use to replace 
existing
+  pods with new ones.
+enum:
+- Recreate
+- RollingUpdate
+type: string
 type: object
   environment:
 description: The configuration of Environment trait
diff --git a/config/crd/bases/camel.apache.org_integrations.yaml 
b/config/crd/bases/camel.apache.org_integrations.yaml
index 9ef1f33a9..8108cf337 100644
--- a/config/crd/bases/camel.apache.org_integrations.yaml
+++ b/config/crd/bases

[camel-k] 01/02: re-deployment strategies #2256

2022-08-04 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 7eee5bc10e060d8776727ee4575d24461dc4c879
Author: Luca Burgazzoli 
AuthorDate: Wed Aug 3 15:56:21 2022 +0200

re-deployment strategies #2256
---
 e2e/global/common/traits/deployment_test.go | 98 +
 pkg/apis/camel/v1/trait/deployment.go   | 19 ++
 pkg/trait/deployment.go | 34 +-
 pkg/trait/deployment_test.go| 88 ++
 4 files changed, 238 insertions(+), 1 deletion(-)

diff --git a/e2e/global/common/traits/deployment_test.go 
b/e2e/global/common/traits/deployment_test.go
new file mode 100644
index 0..9d9a23c22
--- /dev/null
+++ b/e2e/global/common/traits/deployment_test.go
@@ -0,0 +1,98 @@
+//go:build integration
+// +build integration
+
+// To enable compilation of this file in Goland, go to "Settings -> Go -> 
Vendoring & Build Tags -> Custom Tags" and add "integration"
+
+/*
+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 traits
+
+import (
+   appsv1 "k8s.io/api/apps/v1"
+   "testing"
+
+   . "github.com/onsi/gomega"
+   . "github.com/onsi/gomega/gstruct"
+
+   corev1 "k8s.io/api/core/v1"
+
+   . "github.com/apache/camel-k/e2e/support"
+   v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+)
+
+func TestRecreateDeploymentStrategyTrait(t *testing.T) {
+   WithNewTestNamespace(t, func(ns string) {
+   operatorID := "camel-k-trait-jolokia"
+   Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+
+   t.Run("Run with Recreate Deployment Strategy", func(t 
*testing.T) {
+   Expect(KamelRunWithID(operatorID, ns, "files/Java.java",
+   "-t", 
"deployment.strategy="+string(appsv1.RecreateDeploymentStrategyType)).
+   Execute()).To(Succeed())
+
+   Eventually(IntegrationPodPhase(ns, "java"), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
+   Eventually(IntegrationConditionStatus(ns, "java", 
v1.IntegrationConditionReady), 
TestTimeoutShort).Should(Equal(corev1.ConditionTrue))
+   Eventually(IntegrationLogs(ns, "java"), 
TestTimeoutShort).Should(ContainSubstring("Magicstring!"))
+
+   Eventually(Deployment(ns, "java"), 
TestTimeoutMedium).Should(PointTo(MatchFields(IgnoreExtras,
+   Fields{
+   "Spec": MatchFields(IgnoreExtras,
+   Fields{
+   "Strategy": 
MatchFields(IgnoreExtras,
+   Fields{
+   "Type": 
Equal(appsv1.RecreateDeploymentStrategyType),
+   }),
+   }),
+   }),
+   ))
+
+   Expect(Kamel("delete", "--all", "-n", 
ns).Execute()).To(Succeed())
+   })
+   })
+}
+
+func TestRollingUpdateDeploymentStrategyTrait(t *testing.T) {
+   WithNewTestNamespace(t, func(ns string) {
+   operatorID := "camel-k-trait-jolokia"
+   Expect(KamelInstallWithID(operatorID, 
ns).Execute()).To(Succeed())
+
+   t.Run("Run with RollingUpdate Deployment Strategy", func(t 
*testing.T) {
+   Expect(KamelRunWithID(operatorID, ns, "files/Java.java",
+   "-t", 
"deployment.strategy="+string(appsv1.RollingUpdateDeploymentStrategyType)).
+   Execute()).To(Succeed())
+
+  

[camel-k] 05/17: Fix #2177: Ensure unique operator id during install

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 656bb06729c41056ed0e7e90c1a554279f468031
Author: Christoph Deppisch 
AuthorDate: Thu Jun 2 16:49:04 2022 +0200

Fix #2177: Ensure unique operator id during install

- Make sure to not install same operator id twice
- Users must use --force option to overwrite existing operator with given id
- Searches for all integration platforms in any namespace and verify that 
platform name does not exist
---
 pkg/cmd/install.go   | 37 -
 pkg/platform/platform.go | 21 +
 2 files changed, 53 insertions(+), 5 deletions(-)

diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 0287d69f5..368eaeb31 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -20,12 +20,14 @@ package cmd
 import (
"context"
"fmt"
+   "io"
"os"
"regexp"
"strconv"
"strings"
"time"
 
+   platformutil "github.com/apache/camel-k/pkg/platform"
"github.com/pkg/errors"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@@ -289,6 +291,11 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
fmt.Fprintln(cobraCmd.OutOrStdout(), "Camel K cluster 
setup completed successfully")
}
} else {
+   operatorID, err := getOperatorID(o.EnvVars)
+   if err != nil {
+   return err
+   }
+
c, err := o.GetCmdClient()
if err != nil {
return err
@@ -296,7 +303,18 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
 
namespace := o.Namespace
 
+   platformName := platformutil.DefaultPlatformName
+   if operatorID != "" {
+   platformName = operatorID
+   }
+
if !o.SkipOperatorSetup && !installViaOLM {
+   if ok, err := isInstallAllowed(o.Context, c, 
platformName, o.Force, cobraCmd.OutOrStdout()); err != nil {
+   return err
+   } else if !ok {
+   return errors.New(fmt.Sprintf("installation not 
allowed because operator with id '%s' already exists, use the --force option to 
skip this check", platformName))
+   }
+
cfg := install.OperatorConfiguration{
CustomImage:   o.OperatorImage,
CustomImagePullPolicy: 
o.OperatorImagePullPolicy,
@@ -343,11 +361,7 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
fmt.Fprintln(cobraCmd.OutOrStdout(), "Camel K operator 
registry setup skipped")
}
 
-   operatorID, err := getOperatorID(o.EnvVars)
-   if err != nil {
-   return err
-   }
-   platform, err := install.NewPlatform(o.Context, c, 
o.ClusterType, o.SkipRegistrySetup, o.registry, operatorID)
+   platform, err := install.NewPlatform(o.Context, c, 
o.ClusterType, o.SkipRegistrySetup, o.registry, platformName)
if err != nil {
return err
}
@@ -505,6 +519,19 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
return nil
 }
 
+func isInstallAllowed(ctx context.Context, c client.Client, operatorID string, 
force bool, out io.Writer) (bool, error) {
+   // find existing platform with given name in any namespace
+   pl, err := platformutil.LookupForPlatformName(ctx, c, operatorID)
+
+   if pl != nil && force {
+   fmt.Fprintln(out, fmt.Sprintf("Overwriting existing operator 
with id '%s'", operatorID))
+   return true, nil
+   }
+
+   // only allow installation when platform with given name is not found
+   return pl == nil, err
+}
+
 func getOperatorID(vars []string) (string, error) {
envs, _, _, err := env.ParseEnv(vars, nil)
if err != nil {
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index affba22b6..8d27391e4 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -31,6 +31,27 @@ const (
DefaultPlatformName = "camel-k"
 )
 
+// LookupForPlatformName finds integration platform with given operator id as 
name in any namespace
+func LookupForPlatformName(ctx context.Context, c k8sclient.Reader, name 
string) (*v1.IntegrationPlatform, error) {
+   pla

[camel-k] 16/17: fix(#2177): Fix preflight test script and e2e upgrade tests

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit fb172cc4a3d3e52f482c9a13f4cdc4bd9777
Author: Christoph Deppisch 
AuthorDate: Mon Jul 4 23:31:22 2022 +0200

fix(#2177): Fix preflight test script and e2e upgrade tests
---
 .github/actions/kamel-preflight-test/preflight-test.sh | 11 +--
 .github/workflows/upgrade.yml  |  2 +-
 e2e/namespace/upgrade/cli_upgrade_test.go  |  2 +-
 e2e/namespace/upgrade/olm_upgrade_test.go  |  2 +-
 4 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/.github/actions/kamel-preflight-test/preflight-test.sh 
b/.github/actions/kamel-preflight-test/preflight-test.sh
index ead05e1d7..de9a6c911 100755
--- a/.github/actions/kamel-preflight-test/preflight-test.sh
+++ b/.github/actions/kamel-preflight-test/preflight-test.sh
@@ -200,7 +200,7 @@ export KAMEL_INSTALL_OPERATOR_IMAGE_PULL_POLICY="Always"
 #
 # Install the operator to local namespace
 #
-kamel install -n ${NAMESPACE} --olm=${has_olm} --global=false 
--operator-id=camel-k-preflight
+kamel install -n ${NAMESPACE} --olm=${has_olm} --operator-id=camel-k-preflight
 if [ $? != 0 ]; then
   echo "Error: kamel install returned an error."
   delns "${NAMESPACE}"
@@ -284,15 +284,6 @@ if [ $? != 0 ]; then
   exit 1
 fi
 
-#
-# Remove the operator from local namespace
-#
-kamel uninstall -n ${NAMESPACE}
-if [ $? != 0 ]; then
-  echo "Error: kamel uninstall returned an error."
-  exit 1
-fi
-
 sleep 3
 
 echo "Preflight Test: Success"
diff --git a/.github/workflows/upgrade.yml b/.github/workflows/upgrade.yml
index ce1dffaa9..09eec212a 100644
--- a/.github/workflows/upgrade.yml
+++ b/.github/workflows/upgrade.yml
@@ -50,7 +50,7 @@ on:
   skip-problematic:
 description: 'Whether tests marked as problematic should be skipped - 
false by default (sets CAMEL_K_TEST_SKIP_PROBLEMATIC)'
 required: false
-default: false
+default: "false"
   test-filters:
 description: |
   Filter the tests in this test suite by assigning the test pattern to 
TEST_UPGRADE_RUN,
diff --git a/e2e/namespace/upgrade/cli_upgrade_test.go 
b/e2e/namespace/upgrade/cli_upgrade_test.go
index 4c849cee4..7e9b35d23 100644
--- a/e2e/namespace/upgrade/cli_upgrade_test.go
+++ b/e2e/namespace/upgrade/cli_upgrade_test.go
@@ -64,7 +64,7 @@ func TestOperatorUpgrade(t *testing.T) {
 
// Run the Integration
name := "yaml"
-   Expect(KamelRun(ns, "files/yaml.yaml").Execute()).To(Succeed())
+   Expect(Kamel("run", "-n", ns, 
"files/yaml.yaml").Execute()).To(Succeed())
Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutLong).Should(Equal(corev1.ConditionTrue))
 
diff --git a/e2e/namespace/upgrade/olm_upgrade_test.go 
b/e2e/namespace/upgrade/olm_upgrade_test.go
index cdcc5ef55..b6037a4f5 100644
--- a/e2e/namespace/upgrade/olm_upgrade_test.go
+++ b/e2e/namespace/upgrade/olm_upgrade_test.go
@@ -107,7 +107,7 @@ func TestOLMAutomaticUpgrade(t *testing.T) {

Eventually(PlatformVersion(ns)).Should(ContainSubstring(prevIPVersionPrefix))
 
name := "yaml"
-   Expect(KamelRun(ns, "files/yaml.yaml").Execute()).To(Succeed())
+   Expect(Kamel("run", "-n", ns, 
"files/yaml.yaml").Execute()).To(Succeed())
// Check the Integration runs correctly
Eventually(IntegrationPodPhase(ns, name), 
TestTimeoutLong).Should(Equal(corev1.PodRunning))
Eventually(IntegrationConditionStatus(ns, name, 
v1.IntegrationConditionReady), 
TestTimeoutLong).Should(Equal(corev1.ConditionTrue))



[camel-k] 01/17: Fix #2177: Cosmetic changes

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit d6da80d52d9231c191138dccaad170cfa99f45d7
Author: Christoph Deppisch 
AuthorDate: Fri Jun 3 08:46:37 2022 +0200

Fix #2177: Cosmetic changes

- Fix typos
- Use IsSecondary() utility method
---
 e2e/global/common/secondary_platform_test.go | 2 +-
 e2e/support/test_support.go  | 2 +-
 pkg/platform/platform.go | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/e2e/global/common/secondary_platform_test.go 
b/e2e/global/common/secondary_platform_test.go
index 665262737..beb714314 100644
--- a/e2e/global/common/secondary_platform_test.go
+++ b/e2e/global/common/secondary_platform_test.go
@@ -37,7 +37,7 @@ import (
 func TestSecondaryPlatform(t *testing.T) {
WithNewTestNamespace(t, func(ns string) {
Expect(KamelInstall(ns).Execute()).To(Succeed())
-   Expect(ConfigureSecondayPlatfromWith(ns, func(p 
*v1.IntegrationPlatform) {
+   Expect(ConfigureSecondaryPlatformWith(ns, func(p 
*v1.IntegrationPlatform) {
p.Name = "secondary"
p.Spec.Traits.Container = {
Trait: traitv1.Trait{
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 08f9d7455..967580303 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -1304,7 +1304,7 @@ func AssignPlatformToOperator(ns, operator string) error {
return TestClient().Update(TestContext, pl)
 }
 
-func ConfigureSecondayPlatfromWith(ns string, customizer func(pl 
*v1.IntegrationPlatform)) error {
+func ConfigureSecondaryPlatformWith(ns string, customizer func(pl 
*v1.IntegrationPlatform)) error {
pl := Platform(ns)()
if pl == nil {
return errors.New("cannot find primary platform")
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 8c3af7ac0..affba22b6 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -143,7 +143,7 @@ func ListPrimaryPlatforms(ctx context.Context, c 
k8sclient.Reader, namespace str
 
filtered := v1.NewIntegrationPlatformList()
for _, pl := range lst.Items {
-   if val, present := 
pl.Annotations[v1.SecondaryPlatformAnnotation]; !present || val != "true" {
+   if !IsSecondary() {
filtered.Items = append(filtered.Items, pl)
}
}



[camel-k] 17/17: fix(#2177): Remove obsolete kamel-install GitHub action

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 0e51e5bdfc788fefd32c2908d1af7efb73f4b912
Author: Christoph Deppisch 
AuthorDate: Tue Jul 5 15:59:12 2022 +0200

fix(#2177): Remove obsolete kamel-install GitHub action

In favor of using kamel-install-global-operator action
---
 .github/actions/kamel-install/action.yml |  64 ---
 .github/actions/kamel-install/install.sh | 133 ---
 2 files changed, 197 deletions(-)

diff --git a/.github/actions/kamel-install/action.yml 
b/.github/actions/kamel-install/action.yml
deleted file mode 100644
index 235a78801..0
--- a/.github/actions/kamel-install/action.yml
+++ /dev/null
@@ -1,64 +0,0 @@
-# ---
-# 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.
-# ---
-
-name: kamel-install
-description: 'Execute kamel to install the Camel K operator'
-
-inputs:
-  kube-admin-user-ctx:
-description: "The administration user context of the cluster"
-required: true
-  build-catalog-source:
-description: "The name of the bundle catalog (only installed in the 
cluster if OLM is used)"
-required: false
-  image-namespace:
-description: 'Namespace in which the image is stored'
-required: true
-  image-registry-host:
-description: 'Location of image registry host'
-required: true
-  image-name:
-description: 'Reference of the camel-k image'
-required: true
-  image-registry-insecure:
-description: "Whether the registry is insecure"
-required: true
-  image-version:
-description: "Reference of the camel-k image version"
-required: true
-
-runs:
-  using: "composite"
-  steps:
-- id: execute-kamel
-  name: Install Camel K
-  shell: bash
-  run: |
-./.github/actions/kamel-install/install.sh \
-  -a "${{ inputs.kube-admin-user-ctx }}" \
-  -c "${{ inputs.build-catalog-source }}" \
-  -i "${{ inputs.image-namespace }}" \
-  -l "${{ inputs.image-registry-host }}" \
-  -n "${{ inputs.image-name }}" \
-  -s "${{ inputs.image-registry-insecure }}" \
-  -v "${{ inputs.image-version }}"
-
-- id: post-execution
-  shell: bash
-  run: |
-rm -f /tmp/config
-export -n KUBECONFIG
diff --git a/.github/actions/kamel-install/install.sh 
b/.github/actions/kamel-install/install.sh
deleted file mode 100755
index 3cc1ba5da..0
--- a/.github/actions/kamel-install/install.sh
+++ /dev/null
@@ -1,133 +0,0 @@
-#!/bin/bash
-
-# ---
-# 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.
-# ---
-
-
-#
-# Install Camel K using the admin context
-#
-
-
-set -e
-
-while getopts ":a:c:i:l:n:s:v:" opt; do
-  case "${opt}" in
-a)
-  KUBE_ADMIN_CTX=${OPTARG}
-  ;;
-c)
-  BUILD_CATALOG_SOURCE=${OPTARG}
-  ;;
-i)
-  IMAGE_NAMESPACE=${OPTARG}
-  ;;
-l)
-  REGISTRY_PULL_HOST=${OPTARG}
-  ;;
- 

[camel-k] 09/17: Fix #2177: Create proper integration platform as part of the operator

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit a3be4d23bb0d356d6d9795fb0815428dc7bbf09f
Author: Christoph Deppisch 
AuthorDate: Fri Jun 3 10:17:53 2022 +0200

Fix #2177: Create proper integration platform as part of the operator

- Make sure that each operator instance adds its integration platform if 
not already exists
- Automatically adds an integration platform in operator start-up
- Also adds integration platform viewer role so authenticated users can see 
the platform instance
- Required for kamel CLI to verify existing operator ids on the cluster 
when doing an operator install or running integrations
---
 pkg/cmd/operator/operator.go | 32 
 1 file changed, 32 insertions(+)

diff --git a/pkg/cmd/operator/operator.go b/pkg/cmd/operator/operator.go
index e87e41ebe..2ae7436e2 100644
--- a/pkg/cmd/operator/operator.go
+++ b/pkg/cmd/operator/operator.go
@@ -29,6 +29,7 @@ import (
"strings"
"time"
 
+   "github.com/pkg/errors"
"go.uber.org/automaxprocs/maxprocs"
 
appsv1 "k8s.io/api/apps/v1"
@@ -36,6 +37,7 @@ import (
coordination "k8s.io/api/coordination/v1"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
+   metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/fields"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/selection"
@@ -237,11 +239,41 @@ func Run(healthPort, monitoringPort int32, leaderElection 
bool, leaderElectionID
installCtx, installCancel := context.WithTimeout(context.Background(), 
1*time.Minute)
defer installCancel()
install.OperatorStartupOptionalTools(installCtx, c, watchNamespace, 
operatorNamespace, log)
+   exitOnError(findOrCreateIntegrationPlatform(installCtx, c, 
operatorNamespace), "failed to create integration platform")
 
log.Info("Starting the manager")
exitOnError(mgr.Start(signals.SetupSignalHandler()), "manager exited 
non-zero")
 }
 
+// findOrCreateIntegrationPlatform create default integration platform in 
operator namespace if not already exists
+func findOrCreateIntegrationPlatform(ctx context.Context, c client.Client, 
operatorNamespace string) error {
+   platformName := defaults.OperatorID()
+   if platformName == "" {
+   platformName = platform.DefaultPlatformName
+   }
+
+   if pl, err := kubernetes.GetIntegrationPlatform(ctx, c, platformName, 
operatorNamespace); pl == nil || k8serrors.IsNotFound(err) {
+   defaultPlatform := v1.NewIntegrationPlatform(operatorNamespace, 
platformName)
+   if defaultPlatform.Labels == nil {
+   defaultPlatform.Labels = make(map[string]string)
+   }
+   defaultPlatform.Labels["camel.apache.org/platform.generated"] = 
"true"
+
+   if _, err := 
c.CamelV1().IntegrationPlatforms(operatorNamespace).Create(ctx, 
, metav1.CreateOptions{}); err != nil {
+   return err
+   }
+
+   // Make sure that IntegrationPlatform installed in operator 
namespace can be seen by others
+   if err := install.IntegrationPlatformViewerRole(ctx, c, 
operatorNamespace); err != nil && !k8serrors.IsAlreadyExists(err) {
+   return errors.Wrap(err, "Error while installing global 
IntegrationPlatform viewer role")
+   }
+   } else {
+   return err
+   }
+
+   return nil
+}
+
 // getWatchNamespace returns the Namespace the operator should be watching for 
changes.
 func getWatchNamespace() (string, error) {
ns, found := os.LookupEnv(platform.OperatorWatchNamespaceEnvVariable)



[camel-k] 14/17: fix(#2177): Reduce duplicate code

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 1c242673247b2cd173003202fcb74fec5c889848
Author: Christoph Deppisch 
AuthorDate: Fri Jun 24 20:28:37 2022 +0200

fix(#2177): Reduce duplicate code
---
 addons/threescale/3scale.go| 12 +--
 e2e/support/test_support.go| 20 ++-
 pkg/apis/camel/v1/common_types_support.go  | 11 ++-
 pkg/apis/camel/v1/integration_types_support.go |  6 +-
 pkg/apis/camel/v1/integrationkit_types_support.go  |  6 +-
 .../camel/v1/integrationplatform_types_support.go  |  6 +-
 .../v1alpha1/kamelet_binding_types_support.go  |  6 +-
 pkg/cmd/bind.go| 13 +++-
 pkg/cmd/run.go | 12 +++
 pkg/cmd/util.go| 23 +++---
 pkg/install/operator.go|  3 ---
 pkg/trait/container.go |  5 +
 pkg/trait/platform.go  |  3 ---
 pkg/trait/quarkus.go   |  5 +
 pkg/util/kubernetes/replace.go | 15 +-
 15 files changed, 58 insertions(+), 88 deletions(-)

diff --git a/addons/threescale/3scale.go b/addons/threescale/3scale.go
index 85e8c08a0..e7f246deb 100644
--- a/addons/threescale/3scale.go
+++ b/addons/threescale/3scale.go
@@ -22,6 +22,7 @@ import (
 
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 
+   v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
traitv1 "github.com/apache/camel-k/pkg/apis/camel/v1/trait"
"github.com/apache/camel-k/pkg/trait"
 )
@@ -126,19 +127,16 @@ func (t *threeScaleTrait) addLabelsAndAnnotations(obj 
*metav1.ObjectMeta) {
}
obj.Labels[ThreeScaleDiscoveryLabel] = ThreeScaleDiscoveryLabelEnabled
 
-   if obj.Annotations == nil {
-   obj.Annotations = make(map[string]string)
-   }
if t.Scheme != "" {
-   obj.Annotations[ThreeScaleSchemeAnnotation] = t.Scheme
+   v1.SetAnnotation(obj, ThreeScaleSchemeAnnotation, t.Scheme)
}
if t.Path != "" {
-   obj.Annotations[ThreeScalePathAnnotation] = t.Path
+   v1.SetAnnotation(obj, ThreeScalePathAnnotation, t.Path)
}
if t.Port != 0 {
-   obj.Annotations[ThreeScalePortAnnotation] = strconv.Itoa(t.Port)
+   v1.SetAnnotation(obj, ThreeScalePortAnnotation, 
strconv.Itoa(t.Port))
}
if t.DescriptionPath != nil && *t.DescriptionPath != "" {
-   obj.Annotations[ThreeScaleDescriptionPathAnnotation] = 
*t.DescriptionPath
+   v1.SetAnnotation(obj, ThreeScaleDescriptionPathAnnotation, 
*t.DescriptionPath)
}
 }
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index ec968fcb7..2f8cbc150 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -598,9 +598,7 @@ func AssignIntegrationToOperator(ns, name, operator string) 
error {
if it == nil {
return fmt.Errorf("cannot assign integration %q to operator: 
integration not found", name)
}
-   if it.Annotations == nil {
-   it.Annotations = make(map[string]string)
-   }
+
it.SetOperatorID(operator)
return TestClient().Update(TestContext, it)
 }
@@ -991,10 +989,8 @@ func AssignKameletBindingToOperator(ns, name, operator 
string) error {
if klb == nil {
return fmt.Errorf("cannot assign kamelet binding %q to 
operator: kamelet binding not found", name)
}
-   if klb.Annotations == nil {
-   klb.Annotations = make(map[string]string)
-   }
-   klb.Annotations[v1.OperatorIDAnnotation] = operator
+
+   klb.SetOperatorID(operator)
return TestClient().Update(TestContext, klb)
 }
 
@@ -1363,9 +1359,7 @@ func AssignPlatformToOperator(ns, operator string) error {
if pl == nil {
return errors.New("cannot assign platform to operator: no 
platform found")
}
-   if pl.Annotations == nil {
-   pl.Annotations = make(map[string]string)
-   }
+
pl.SetOperatorID(operator)
return TestClient().Update(TestContext, pl)
 }
@@ -1375,10 +1369,8 @@ func ConfigureSecondaryPlatformWith(ns string, 
customizer func(pl *v1.Integratio
if pl == nil {
return errors.New("cannot find primary platform")
}
-   if pl.Annotations == nil {
-   pl.Annotations = make(map[string]string)
-   }
-   pl.Annotations[v1.SecondaryPlatformAnnotation] = "true"
+
+   v1.SetAnnotation(

[camel-k] 15/17: fix(#2177): Add `-x` shorthand to `--operator-id` kamel CLI option

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit a1f6fc77b45e8aa039d278c5804246b22e6e96a2
Author: Christoph Deppisch 
AuthorDate: Fri Jul 1 09:27:35 2022 +0200

fix(#2177): Add `-x` shorthand to `--operator-id` kamel CLI option
---
 docs/modules/ROOT/pages/architecture/operator.adoc | 4 ++--
 pkg/cmd/bind.go| 2 +-
 pkg/cmd/install.go | 2 +-
 pkg/cmd/run.go | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/docs/modules/ROOT/pages/architecture/operator.adoc 
b/docs/modules/ROOT/pages/architecture/operator.adoc
index 252487f21..2a3570705 100644
--- a/docs/modules/ROOT/pages/architecture/operator.adoc
+++ b/docs/modules/ROOT/pages/architecture/operator.adoc
@@ -50,7 +50,7 @@ Since the go language does not yet support generics, there is 
an `Action` defini
 
 == Operator resource mapping
 
-By default the Camel K operator (global mode) will manage all Camel K 
resources on the cluster doing the reconciliation loops for the resources in 
order to apply the mentioned state machine.
+By default, the Camel K operator (global mode) will manage all Camel K 
resources on the cluster doing the reconciliation loops for the resources in 
order to apply the mentioned state machine.
 
 For clusters with multiple Camel K tenants this approach is not going to work 
as user groups may want to separate the workloads with respective
 authentication and authorization schemes. For multi tenancy the Camel K 
operator uses an operator id that can be applied to resources in the form of
@@ -59,7 +59,7 @@ an annotation. The annotation selects the operator that 
should handle the resour
 This approach allows multiple Camel K installations and operators on the same 
cluster with each operator handling an explicit set of Camel K resources 
identified
 by the operator id.
 
-By default the Camel K operator has the id `camel-k` and users with only one 
single installation on the cluster will not even notice the existence of this 
identifier. When an administrator wants to add more Camel K operator 
installations to the cluster the
+By default, the Camel K operator has the id `camel-k` and users with only one 
single installation on the cluster will not even notice the existence of this 
identifier. When an administrator wants to add more Camel K operator 
installations to the cluster the
 operator id needs to be unique and resources should be annotated with the 
respective annotation `camel.apache.org/operator.id={operator-id}`. With this 
approach we make sure that only one single operator installation manages
 a resource at a time.
 
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index 1effdf1e8..d92128cb6 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -60,7 +60,7 @@ func newCmdBind(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *bindCmdOptions
cmd.Flags().Bool("skip-checks", false, "Do not verify the binding for 
compliance with Kamelets and other Kubernetes resources")
cmd.Flags().StringArray("step", nil, `Add binding steps as Kubernetes 
resources. Endpoints are expected in the format 
"[[apigroup/]version:]kind:[namespace/]name", plain Camel URIs or Kamelet 
name.`)
cmd.Flags().StringArrayP("trait", "t", nil, `Add a trait to the 
corresponding Integration.`)
-   cmd.Flags().String("operator-id", "camel-k", "Operator id selected to 
manage this Kamelet binding.")
+   cmd.Flags().StringP("operator-id", "x", "camel-k", "Operator id 
selected to manage this Kamelet binding.")
cmd.Flags().StringArray("annotation", nil, "Add an annotation to the 
Kamelet binding. E.g. \"--annotation my.company=hello\"")
cmd.Flags().Bool("force", false, "Force creation of Kamelet binding 
regardless of potential misconfiguration.")
 
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 42e76c557..fe39cbbfb 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -103,7 +103,7 @@ func newCmdInstall(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *installCmdO
cmd.Flags().StringArrayP("property", "p", nil, "Add a camel property")
cmd.Flags().String("runtime-version", "", "Set the camel-k runtime 
version")
cmd.Flags().String("base-image", "", "Set the base Image used to run 
integrations")
-   cmd.Flags().String("operator-id", "camel-k", "Set the operator id that 
is used to select the resources this operator should manage")
+   cmd.Flags().StringP("operator-id", "x", "camel-k&quo

[camel-k] 04/17: Fix #2177: Make sure to properly reinitialize integration

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 4f48c99cad20d682ee5c5640b74fbe83cd449d66
Author: Christoph Deppisch 
AuthorDate: Fri Jun 3 21:01:49 2022 +0200

Fix #2177: Make sure to properly reinitialize integration

- Reinitialize integration when operator id annotation has changed
- Remove IntegrationKit reference for integration that has a new operator 
id annotation
- Add operator id annotation to relevant fields that determine the 
integration digest hash
- Add common utility method to get the operator id annotation from a 
resource
- Allow default operator (id="camel-k") to handle legacy resources that are 
missing proper operator id annotations
- Allow operators that use a proper id to reconcile resources on any 
namespace (regardless of operator mode global vs. local and regardless of 
existing namespace lease)
---
 pkg/apis/camel/v1/common_types_support.go  | 15 
 pkg/controller/build/build_controller.go   |  2 +-
 .../integration/integration_controller.go  | 14 ++--
 pkg/controller/integration/monitor.go  | 18 +++--
 .../integrationkit/integrationkit_controller.go|  2 +-
 .../integrationplatform_controller.go  |  2 +-
 pkg/controller/kamelet/kamelet_controller.go   |  2 +-
 .../kameletbinding/kamelet_binding_controller.go   |  2 +-
 pkg/platform/operator.go   | 93 ++
 pkg/trait/platform.go  |  4 +-
 pkg/util/digest/digest.go  |  6 ++
 11 files changed, 125 insertions(+), 35 deletions(-)

diff --git a/pkg/apis/camel/v1/common_types_support.go 
b/pkg/apis/camel/v1/common_types_support.go
index aec43a183..bb93121b8 100644
--- a/pkg/apis/camel/v1/common_types_support.go
+++ b/pkg/apis/camel/v1/common_types_support.go
@@ -21,6 +21,8 @@ import (
"encoding/json"
"errors"
"fmt"
+
+   metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 )
 
 func (in *Artifact) String() string {
@@ -67,5 +69,18 @@ func (m *RawMessage) UnmarshalJSON(data []byte) error {
return nil
 }
 
+// GetOperatorIDAnnotation to safely get the operator id annotation value
+func GetOperatorIDAnnotation(obj metav1.Object) string {
+   if obj == nil || obj.GetAnnotations() == nil {
+   return ""
+   }
+
+   if operatorId, ok := obj.GetAnnotations()[OperatorIDAnnotation]; ok {
+   return operatorId
+   }
+
+   return ""
+}
+
 var _ json.Marshaler = (*RawMessage)(nil)
 var _ json.Unmarshaler = (*RawMessage)(nil)
diff --git a/pkg/controller/build/build_controller.go 
b/pkg/controller/build/build_controller.go
index 51269b2c8..117ccaa1e 100644
--- a/pkg/controller/build/build_controller.go
+++ b/pkg/controller/build/build_controller.go
@@ -136,7 +136,7 @@ func (r *reconcileBuild) Reconcile(ctx context.Context, 
request reconcile.Reques
}
 
// Only process resources assigned to the operator
-   if !platform.IsOperatorHandler() {
+   if !platform.IsOperatorHandlerConsideringLock(ctx, r.client, 
request.Namespace, ) {
rlog.Info("Ignoring request because resource is not assigned to 
current operator")
return reconcile.Result{}, nil
}
diff --git a/pkg/controller/integration/integration_controller.go 
b/pkg/controller/integration/integration_controller.go
index 11eb81641..c17a1babf 100644
--- a/pkg/controller/integration/integration_controller.go
+++ b/pkg/controller/integration/integration_controller.go
@@ -288,7 +288,7 @@ func (r *reconcileIntegration) Reconcile(ctx 
context.Context, request reconcile.
}
 
// Only process resources assigned to the operator
-   if !platform.IsOperatorHandler() {
+   if !platform.IsOperatorHandlerConsideringLock(ctx, r.client, 
request.Namespace, ) {
rlog.Info("Ignoring request because resource is not assigned to 
current operator")
return reconcile.Result{}, nil
}
@@ -317,9 +317,9 @@ func (r *reconcileIntegration) Reconcile(ctx 
context.Context, request reconcile.
}
 
if newTarget != nil {
-   if res, err := r.update(ctx, , 
newTarget); err != nil {
+   if err := r.update(ctx, , newTarget); 
err != nil {
camelevent.NotifyIntegrationError(ctx, 
r.client, r.recorder, , newTarget, err)
-   return res, err
+   return reconcile.Result{}, err
}
 
if newTarget.Status.Phase != 
instance.Status.Phase {
@@ -341,16 +341,14 @@ func (

[camel-k] 07/17: Fix #2177: Use operator id in KameletBindings

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit c33e0cc189c5b516f5da524b9a5f88032775fbd1
Author: Christoph Deppisch 
AuthorDate: Wed Jun 8 20:11:44 2022 +0200

Fix #2177: Use operator id in KameletBindings

- Introduce operator-id option to kamel CLI bind command
- Make sure to use proper operator id when creating the binding
- Rebuild Kamelet binding when operator id annotation changes
---
 .../v1alpha1/kamelet_binding_types_support.go  |  9 
 pkg/cmd/bind.go| 48 ++
 pkg/cmd/bind_test.go   | 19 -
 pkg/controller/kameletbinding/monitor.go   |  7 +++-
 4 files changed, 80 insertions(+), 3 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/kamelet_binding_types_support.go 
b/pkg/apis/camel/v1alpha1/kamelet_binding_types_support.go
index d47024609..90c36c821 100644
--- a/pkg/apis/camel/v1alpha1/kamelet_binding_types_support.go
+++ b/pkg/apis/camel/v1alpha1/kamelet_binding_types_support.go
@@ -66,6 +66,15 @@ func (c KameletBindingCondition) GetMessage() string {
return c.Message
 }
 
+// SetOperatorID sets the given operator id as an annotation
+func (in *KameletBinding) SetOperatorID(operatorID string) {
+   if in.Annotations == nil {
+   in.Annotations = make(map[string]string)
+   }
+
+   in.Annotations[v1.OperatorIDAnnotation] = operatorID
+}
+
 // GetCondition returns the condition with the provided type.
 func (in *KameletBindingStatus) GetCondition(condType 
KameletBindingConditionType) *KameletBindingCondition {
for i := range in.Conditions {
diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index 2a1c4ad26..b86b08e88 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -25,6 +25,7 @@ import (
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
"github.com/apache/camel-k/pkg/apis/camel/v1alpha1"
+   platformutil "github.com/apache/camel-k/pkg/platform"
"github.com/apache/camel-k/pkg/trait"
"github.com/apache/camel-k/pkg/util/kubernetes"
"github.com/apache/camel-k/pkg/util/reference"
@@ -60,6 +61,9 @@ func newCmdBind(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *bindCmdOptions
cmd.Flags().Bool("skip-checks", false, "Do not verify the binding for 
compliance with Kamelets and other Kubernetes resources")
cmd.Flags().StringArray("step", nil, `Add binding steps as Kubernetes 
resources. Endpoints are expected in the format 
"[[apigroup/]version:]kind:[namespace/]name", plain Camel URIs or Kamelet 
name.`)
cmd.Flags().StringArrayP("trait", "t", nil, `Add a trait to the 
corresponding Integration.`)
+   cmd.Flags().String("operator-id", "camel-k", "Operator id selected to 
manage this Kamelet binding.")
+   cmd.Flags().StringArray("annotation", nil, "Add an annotation to the 
Kamelet binding. E.g. \"--annotation my.company=hello\"")
+   cmd.Flags().Bool("force", false, "Force creation of Kamelet binding 
regardless of potential misconfiguration.")
 
return , 
 }
@@ -81,6 +85,9 @@ type bindCmdOptions struct {
SkipChecks   bool `mapstructure:"skip-checks" yaml:",omitempty"`
Steps[]string `mapstructure:"steps" yaml:",omitempty"`
Traits   []string `mapstructure:"traits" yaml:",omitempty"`
+   OperatorId   string   `mapstructure:"operator-id" yaml:",omitempty"`
+   Annotations  []string `mapstructure:"annotations" yaml:",omitempty"`
+   Forcebool `mapstructure:"force" yaml:",omitempty"`
 }
 
 func (o *bindCmdOptions) preRunE(cmd *cobra.Command, args []string) error {
@@ -109,6 +116,17 @@ func (o *bindCmdOptions) validate(cmd *cobra.Command, args 
[]string) error {
return errors.New("source or sink arguments are missing")
}
 
+   if o.OperatorId == "" {
+   return fmt.Errorf("cannot use empty operator id")
+   }
+
+   for _, annotation := range o.Annotations {
+   parts := strings.SplitN(annotation, "=", 2)
+   if len(parts) != 2 {
+   return fmt.Errorf(`invalid annotation specification %s. 
Expected "="`, annotation)
+   }
+   }
+
for _, p := range o.Properties {
if _, _, _, err := o.parseProperty(p); err != nil {
return err
@@ -215,6 +233,36 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args 
[]string) error {
}
}
 

[camel-k] 11/17: Fix #2177: Fix golangci-lint errors

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 734dc8354921d145e5eb9a02500e3f2e35b757a6
Author: Christoph Deppisch 
AuthorDate: Thu Jun 9 08:37:52 2022 +0200

Fix #2177: Fix golangci-lint errors
---
 pkg/cmd/bind.go  | 16 
 pkg/cmd/install.go   | 14 --
 pkg/cmd/operator.go  | 10 +-
 pkg/cmd/operator/operator.go |  8 +---
 pkg/cmd/run.go   | 16 
 pkg/cmd/version.go   |  6 +++---
 pkg/controller/kameletbinding/monitor.go |  4 ++--
 pkg/platform/platform.go |  7 ---
 pkg/trait/environment.go |  4 ++--
 9 files changed, 45 insertions(+), 40 deletions(-)

diff --git a/pkg/cmd/bind.go b/pkg/cmd/bind.go
index b86b08e88..0632c8d87 100644
--- a/pkg/cmd/bind.go
+++ b/pkg/cmd/bind.go
@@ -85,7 +85,7 @@ type bindCmdOptions struct {
SkipChecks   bool `mapstructure:"skip-checks" yaml:",omitempty"`
Steps[]string `mapstructure:"steps" yaml:",omitempty"`
Traits   []string `mapstructure:"traits" yaml:",omitempty"`
-   OperatorId   string   `mapstructure:"operator-id" yaml:",omitempty"`
+   OperatorID   string   `mapstructure:"operator-id" yaml:",omitempty"`
Annotations  []string `mapstructure:"annotations" yaml:",omitempty"`
Forcebool `mapstructure:"force" yaml:",omitempty"`
 }
@@ -116,7 +116,7 @@ func (o *bindCmdOptions) validate(cmd *cobra.Command, args 
[]string) error {
return errors.New("source or sink arguments are missing")
}
 
-   if o.OperatorId == "" {
+   if o.OperatorID == "" {
return fmt.Errorf("cannot use empty operator id")
}
 
@@ -237,24 +237,24 @@ func (o *bindCmdOptions) run(cmd *cobra.Command, args 
[]string) error {
binding.Annotations = make(map[string]string)
}
 
-   if o.OperatorId != "" {
-   if pl, err := platformutil.LookupForPlatformName(o.Context, 
client, o.OperatorId); err != nil {
+   if o.OperatorID != "" {
+   if pl, err := platformutil.LookupForPlatformName(o.Context, 
client, o.OperatorID); err != nil {
if k8serrors.IsForbidden(err) {
-   o.PrintfVerboseOutf(cmd, "Unable to verify 
existence of operator id [%s] due to lack of user privileges\n", o.OperatorId)
+   o.PrintfVerboseOutf(cmd, "Unable to verify 
existence of operator id [%s] due to lack of user privileges\n", o.OperatorID)
} else {
return err
}
} else if pl == nil {
if o.Force {
-   o.PrintfVerboseOutf(cmd, "Unable to find 
operator with given id [%s] - Kamelet binding may not be reconciled and get 
stuck in waiting state\n", o.OperatorId)
+   o.PrintfVerboseOutf(cmd, "Unable to find 
operator with given id [%s] - Kamelet binding may not be reconciled and get 
stuck in waiting state\n", o.OperatorID)
} else {
-   return errors.New(fmt.Sprintf("unable to find 
integration platform for given operator id '%s', use --force option or make 
sure to use a proper operator id", o.OperatorId))
+   return fmt.Errorf("unable to find integration 
platform for given operator id '%s', use --force option or make sure to use a 
proper operator id", o.OperatorID)
}
}
}
 
// --operator-id={id} is a syntax sugar for '--annotation 
camel.apache.org/operator.id={id}'
-   binding.SetOperatorID(strings.TrimSpace(o.OperatorId))
+   binding.SetOperatorID(strings.TrimSpace(o.OperatorID))
 
for _, annotation := range o.Annotations {
parts := strings.SplitN(annotation, "=", 2)
diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 1efba233e..2176f22db 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -180,7 +180,7 @@ type installCmdOptions struct {
OutputFormat string   `mapstructure:"output"`
RuntimeVersion   string   `mapstructure:"runtime-version"`
BaseImagestring   `mapstructure:"base-image"`
-   OperatorId   string   `mapstructure:"operator-id"`
+   OperatorID   string   `mapstructure:&quo

[camel-k] 02/17: Fix #2177: Use operator id by default

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit ee137fedc1a247b82719e5be5cf36229e792ee93
Author: Christoph Deppisch 
AuthorDate: Wed Jun 8 10:42:00 2022 +0200

Fix #2177: Use operator id by default

- By default use an operator-id (default='camel-k')
- Introduce operator-id setting on kamel CLI when installing Camel K
- Introduce operator-id setting on kamel CLI when running integrations
- Make sure to use an operator-id when installing Camel K and running 
integrations
- Set camel.apache.org/operator.id annotation on resources managed by 
operator with given id
- Add operator id as environment variable to integration pods
- Use default operator id in OLM deployment
- Add more comfortable way to set operator id annotation on resources
---
 config/manager/operator-deployment.yaml|  2 ++
 e2e/support/test_support.go|  4 ++--
 pkg/apis/camel/v1/integration_types_support.go |  9 +
 pkg/apis/camel/v1/integrationkit_types_support.go  |  9 +
 pkg/apis/camel/v1/integrationplatform_types_support.go |  9 +
 pkg/cmd/install.go | 11 ++-
 pkg/cmd/run.go | 16 +---
 pkg/cmd/run_test.go|  4 
 pkg/install/operator.go|  7 ---
 pkg/resources/resources.go |  4 ++--
 pkg/trait/container.go |  2 +-
 pkg/trait/environment.go   |  2 ++
 pkg/trait/quarkus.go   |  2 +-
 13 files changed, 68 insertions(+), 13 deletions(-)

diff --git a/config/manager/operator-deployment.yaml 
b/config/manager/operator-deployment.yaml
index 15311da44..36b75343b 100644
--- a/config/manager/operator-deployment.yaml
+++ b/config/manager/operator-deployment.yaml
@@ -61,6 +61,8 @@ spec:
   fieldPath: metadata.namespace
 - name: OPERATOR_NAME
   value: "camel-k"
+- name: OPERATOR_ID
+  value: "camel-k"
 - name: POD_NAME
   valueFrom:
 fieldRef:
diff --git a/e2e/support/test_support.go b/e2e/support/test_support.go
index 967580303..b7ab45f15 100644
--- a/e2e/support/test_support.go
+++ b/e2e/support/test_support.go
@@ -545,7 +545,7 @@ func AssignIntegrationToOperator(ns, name, operator string) 
error {
if it.Annotations == nil {
it.Annotations = make(map[string]string)
}
-   it.Annotations[v1.OperatorIDAnnotation] = operator
+   it.SetOperatorID(operator)
return TestClient().Update(TestContext, it)
 }
 
@@ -1300,7 +1300,7 @@ func AssignPlatformToOperator(ns, operator string) error {
if pl.Annotations == nil {
pl.Annotations = make(map[string]string)
}
-   pl.Annotations[v1.OperatorIDAnnotation] = operator
+   pl.SetOperatorID(operator)
return TestClient().Update(TestContext, pl)
 }
 
diff --git a/pkg/apis/camel/v1/integration_types_support.go 
b/pkg/apis/camel/v1/integration_types_support.go
index 360c1df48..9d137de41 100644
--- a/pkg/apis/camel/v1/integration_types_support.go
+++ b/pkg/apis/camel/v1/integration_types_support.go
@@ -255,6 +255,15 @@ func (in *SourceSpec) InferLanguage() Language {
return ""
 }
 
+// SetOperatorID sets the given operator id as an annotation
+func (in *Integration) SetOperatorID(operatorID string) {
+   if in.Annotations == nil {
+   in.Annotations = make(map[string]string)
+   }
+
+   in.Annotations[OperatorIDAnnotation] = operatorID
+}
+
 func (in *Integration) SetIntegrationPlatform(platform *IntegrationPlatform) {
cs := corev1.ConditionTrue
 
diff --git a/pkg/apis/camel/v1/integrationkit_types_support.go 
b/pkg/apis/camel/v1/integrationkit_types_support.go
index 408a88416..5862805f9 100644
--- a/pkg/apis/camel/v1/integrationkit_types_support.go
+++ b/pkg/apis/camel/v1/integrationkit_types_support.go
@@ -54,6 +54,15 @@ func (in *IntegrationKitSpec) Configurations() 
[]ConfigurationSpec {
return in.Configuration
 }
 
+// SetOperatorID sets the given operator id as an annotation
+func (in *IntegrationKit) SetOperatorID(operatorID string) {
+   if in.Annotations == nil {
+   in.Annotations = make(map[string]string)
+   }
+
+   in.Annotations[OperatorIDAnnotation] = operatorID
+}
+
 func (in *IntegrationKit) Configurations() []ConfigurationSpec {
if in == nil {
return []ConfigurationSpec{}
diff --git a/pkg/apis/camel/v1/integrationplatform_types_support.go 
b/pkg/apis/camel/v1/integrationplatform_types_support.go
index b644f462e..faa287750 

[camel-k] 13/17: Fix #2177: Update docs

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 93245fd35c7a118d35ee9fc9369956c2838bddf6
Author: Christoph Deppisch 
AuthorDate: Tue Jun 14 12:15:30 2022 +0200

Fix #2177: Update docs
---
 docs/modules/ROOT/pages/architecture/operator.adoc | 21 +--
 .../ROOT/pages/installation/advanced/multi.adoc| 31 +++---
 2 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/docs/modules/ROOT/pages/architecture/operator.adoc 
b/docs/modules/ROOT/pages/architecture/operator.adoc
index 6a980a789..252487f21 100644
--- a/docs/modules/ROOT/pages/architecture/operator.adoc
+++ b/docs/modules/ROOT/pages/architecture/operator.adoc
@@ -21,7 +21,7 @@ The Camel K Operator defines a number of new Kubernetes API 
through the https://
 
 All the api conform to the Kubernetes 
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md[api
 conventions].
 
-To manage the interaction with them, a simple control loop was not enough and 
we ended up with a sort of “Hierarchical Operator Pattern” where the reconcile 
phase may trigger other controllers and supervises them.
+To manage the interaction with them, a simple control loop was not enough. So 
we ended up with a sort of “Hierarchical Operator Pattern” where the reconcile 
phase may trigger other controllers and supervises them.
 
 image::architecture/camel-k-operator-control-loop.png[control-loop]
 
@@ -31,7 +31,7 @@ With the exception of the `CamelCatalog`, each CR has a 
dedicated state machine
 
 image::architecture/camel-k-state-machine-basic.png[State Machine]
 
-Each state of the CR is handled by a dedicated handler, named `Action`, 
defined as follow:
+Each state of the CR is handled by a dedicated handler, named `Action`, 
defined as follows:
 
 [source,go]
 
@@ -47,3 +47,20 @@ type Action interface {
 
 Since the go language does not yet support generics, there is an `Action` 
definition per CR, The full list of definitions can be found in the 
https://github.com/apache/camel-k/tree/main/pkg/controller[controller package]
 
+
+== Operator resource mapping
+
+By default the Camel K operator (global mode) will manage all Camel K 
resources on the cluster doing the reconciliation loops for the resources in 
order to apply the mentioned state machine.
+
+For clusters with multiple Camel K tenants this approach is not going to work 
as user groups may want to separate the workloads with respective
+authentication and authorization schemes. For multi tenancy the Camel K 
operator uses an operator id that can be applied to resources in the form of
+an annotation. The annotation selects the operator that should handle the 
resource.
+
+This approach allows multiple Camel K installations and operators on the same 
cluster with each operator handling an explicit set of Camel K resources 
identified
+by the operator id.
+
+By default the Camel K operator has the id `camel-k` and users with only one 
single installation on the cluster will not even notice the existence of this 
identifier. When an administrator wants to add more Camel K operator 
installations to the cluster the
+operator id needs to be unique and resources should be annotated with the 
respective annotation `camel.apache.org/operator.id={operator-id}`. With this 
approach we make sure that only one single operator installation manages
+a resource at a time.
+
+Read more about this topic in xref:installation/advanced/multi.adoc[Multiple 
Operators and Selective Upgrades]
diff --git a/docs/modules/ROOT/pages/installation/advanced/multi.adoc 
b/docs/modules/ROOT/pages/installation/advanced/multi.adoc
index c95da15ba..fdad7bdba 100644
--- a/docs/modules/ROOT/pages/installation/advanced/multi.adoc
+++ b/docs/modules/ROOT/pages/installation/advanced/multi.adoc
@@ -1,19 +1,22 @@
 [[advanced-installation-multiple-operators]]
 = Multiple Operators and Selective Upgrades
 
-It's possible to setup multiple Camel K operators in a cluster to watch the 
same namespaces. It's not
+It is possible to set up multiple Camel K operators on a cluster to watch 
resources on namespaces. It's not
 possible to configure Camel K this way using OLM (Operator Hub), since OLM 
prevents two operators from watching the same namespaces,
 but it's technically possible to achieve this setup manually.
 
-A typical example is when you install two global operators in different 
namespaces (e.g. `kamel install --global --olm=false -n camel-ns-1` and `kamel 
install --global --olm=false -n camel-ns-2`).
-In this  situation, both operators will watch the same resources in the 
cluster, so that if a user creates an integration in any namespace,
-both operators will contend the integration and the reconciliation will most 
probably result in an error (actual behavior is undefined).
+A typical example is when you need

[camel-k] 08/17: Fix #2177: Introduce integration platform viewer role

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 4e6a2db1614901a65ad1df9858a957b26e0f91d2
Author: Christoph Deppisch 
AuthorDate: Fri Jun 3 21:04:59 2022 +0200

Fix #2177: Introduce integration platform viewer role

- Integration platforms need to be visible to authenticated users in order 
to verify operator ids
- Add integration platform viewer role in all namespaces that hold at least 
one integration platform so users can get and list these platform instances
- Automatically add the role during kamel CLI installation and in platform 
trait
---
 pkg/cmd/install.go |  4 +++
 pkg/install/platform.go| 32 +++
 pkg/platform/platform.go   | 13 +++-
 pkg/resources/resources.go | 16 ++
 pkg/trait/platform.go  | 14 +
 .../user-global-platform-viewer-role-binding.yaml  | 35 +
 .../viewer/user-global-platform-viewer-role.yaml   | 36 ++
 7 files changed, 149 insertions(+), 1 deletion(-)

diff --git a/pkg/cmd/install.go b/pkg/cmd/install.go
index 368eaeb31..1efba233e 100644
--- a/pkg/cmd/install.go
+++ b/pkg/cmd/install.go
@@ -485,6 +485,10 @@ func (o *installCmdOptions) install(cobraCmd 
*cobra.Command, _ []string) error {
return err
}
 
+   if err := install.IntegrationPlatformViewerRole(o.Context, c, 
namespace); err != nil && !k8serrors.IsAlreadyExists(err) {
+   return errors.Wrap(err, "Error while installing global 
IntegrationPlatform viewer role")
+   }
+
if o.ExampleSetup {
err = install.ExampleOrCollect(o.Context, c, namespace, 
collection, o.Force)
if err != nil {
diff --git a/pkg/install/platform.go b/pkg/install/platform.go
new file mode 100644
index 0..9a087d077
--- /dev/null
+++ b/pkg/install/platform.go
@@ -0,0 +1,32 @@
+/*
+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 install
+
+import (
+   "context"
+
+   "github.com/apache/camel-k/pkg/client"
+)
+
+// IntegrationPlatformViewerRole installs the role that allows any user ro 
access integrationplatforms in the global namespace.
+func IntegrationPlatformViewerRole(ctx context.Context, c client.Client, 
namespace string) error {
+   if err := Resource(ctx, c, namespace, true, IdentityResourceCustomizer, 
"/viewer/user-global-platform-viewer-role.yaml"); err != nil {
+   return err
+   }
+   return Resource(ctx, c, namespace, true, IdentityResourceCustomizer, 
"/viewer/user-global-platform-viewer-role-binding.yaml")
+}
diff --git a/pkg/platform/platform.go b/pkg/platform/platform.go
index 8d27391e4..8b5f5c9c1 100644
--- a/pkg/platform/platform.go
+++ b/pkg/platform/platform.go
@@ -21,6 +21,7 @@ import (
"context"
 
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+   "github.com/apache/camel-k/pkg/util/defaults"
"github.com/apache/camel-k/pkg/util/kubernetes"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
k8sclient "sigs.k8s.io/controller-runtime/pkg/client"
@@ -68,9 +69,19 @@ func getOrFindForResource(ctx context.Context, c 
k8sclient.Reader, o k8sclient.O
if selectedPlatform, ok := 
o.GetAnnotations()[v1.PlatformSelectorAnnotation]; ok {
return get(ctx, c, o.GetNamespace(), selectedPlatform)
}
+
+   platformName := defaults.OperatorID()
if it, ok := o.(*v1.Integration); ok {
-   return getOrFind(ctx, c, it.Namespace, it.Status.Platform, 
active, local)
+   if it.Status.Platform != "" {
+   platformName = it.Status.Platform
+   }
+
+   return getOrFind(ctx, c, it.Namespace, platformName, active, 
local)
} else if ik, ok := o.(*v1.IntegrationKit); ok {
+   if ik.Status.

[camel-k] 03/17: Fix #2177: Align namespace operator lease with operator id

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit c2302fa9b25a7a22e247037161786bc4da76ef3d
Author: Christoph Deppisch 
AuthorDate: Fri Jun 3 09:56:46 2022 +0200

Fix #2177: Align namespace operator lease with operator id

- Use operator id when creating the operator lease so only operator 
instances with the same id elect a leader
---
 pkg/cmd/operator.go  | 18 +++---
 pkg/platform/operator.go | 10 +-
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/pkg/cmd/operator.go b/pkg/cmd/operator.go
index b1b8c59dd..b2570a356 100644
--- a/pkg/cmd/operator.go
+++ b/pkg/cmd/operator.go
@@ -18,10 +18,12 @@ limitations under the License.
 package cmd
 
 import (
+   "fmt"
+   "github.com/apache/camel-k/pkg/platform"
+   "github.com/apache/camel-k/pkg/util/defaults"
"github.com/spf13/cobra"
 
"github.com/apache/camel-k/pkg/cmd/operator"
-   "github.com/apache/camel-k/pkg/platform"
 )
 
 const operatorCommand = "operator"
@@ -41,7 +43,7 @@ func newCmdOperator() (*cobra.Command, *operatorCmdOptions) {
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().Bool("leader-election", true, "Use leader election")
-   cmd.Flags().String("leader-election-id", platform.OperatorLockName, 
"Use the given ID as the leader election Lease name")
+   cmd.Flags().String("leader-election-id", "", "Use the given ID as the 
leader election Lease name")
 
return , 
 }
@@ -54,5 +56,15 @@ type operatorCmdOptions struct {
 }
 
 func (o *operatorCmdOptions) run(_ *cobra.Command, _ []string) {
-   operator.Run(o.HealthPort, o.MonitoringPort, o.LeaderElection, 
o.LeaderElectionID)
+
+   leaderElectionId := o.LeaderElectionID
+   if leaderElectionId == "" {
+   if defaults.OperatorID() != "" {
+   leaderElectionId = fmt.Sprintf("%s-lock", 
defaults.OperatorID())
+   } else {
+   leaderElectionId = platform.OperatorLockName
+   }
+   }
+
+   operator.Run(o.HealthPort, o.MonitoringPort, o.LeaderElection, 
leaderElectionId)
 }
diff --git a/pkg/platform/operator.go b/pkg/platform/operator.go
index c9fe67c77..602a99105 100644
--- a/pkg/platform/operator.go
+++ b/pkg/platform/operator.go
@@ -19,6 +19,7 @@ package platform
 
 import (
"context"
+   "fmt"
"os"
"strings"
 
@@ -80,8 +81,15 @@ func IsNamespaceLocked(ctx context.Context, c ctrl.Reader, 
namespace string) (bo
return false, nil
}
 
+   var operatorLockName string
+   if defaults.OperatorID() != "" {
+   operatorLockName = fmt.Sprintf("%s-lock", defaults.OperatorID())
+   } else {
+   operatorLockName = OperatorLockName
+   }
+
lease := coordination.Lease{}
-   if err := c.Get(ctx, ctrl.ObjectKey{Namespace: namespace, Name: 
OperatorLockName}, ); err != nil && k8serrors.IsNotFound(err) {
+   if err := c.Get(ctx, ctrl.ObjectKey{Namespace: namespace, Name: 
operatorLockName}, ); err != nil && k8serrors.IsNotFound(err) {
return false, nil
} else if err != nil {
return true, err



[camel-k] branch main updated (b680d5dff -> 0e51e5bdf)

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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


from b680d5dff fix(doc): fix gen-crd-api-reference-docs and regen API doc 
with Traits
 new d6da80d52 Fix #2177: Cosmetic changes
 new ee137fedc Fix #2177: Use operator id by default
 new c2302fa9b Fix #2177: Align namespace operator lease with operator id
 new 4f48c99ca Fix #2177: Make sure to properly reinitialize integration
 new 656bb0672 Fix #2177: Ensure unique operator id during install
 new 417b7b873 Fix #2177: Ensure valid operator id when running integrations
 new c33e0cc18 Fix #2177: Use operator id in KameletBindings
 new 4e6a2db16 Fix #2177: Introduce integration platform viewer role
 new a3be4d23b Fix #2177: Create proper integration platform as part of the 
operator
 new ad6a74900 Fix #2177: Improve operator version lookup
 new 734dc8354 Fix #2177: Fix golangci-lint errors
 new aadc81640 Fix #2177: Fix e2e tests
 new 93245fd35 Fix #2177: Update docs
 new 1c2426732 fix(#2177): Reduce duplicate code
 new a1f6fc77b fix(#2177): Add `-x` shorthand to `--operator-id` kamel CLI 
option
 new fb172cc4a fix(#2177): Fix preflight test script and e2e upgrade tests
 new 0e51e5bdf fix(#2177): Remove obsolete kamel-install GitHub action

The 17 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .github/actions/e2e-knative-yaks/action.yml|   9 +-
 .github/actions/kamel-install-yaks/action.yml  |   5 +-
 .../actions/kamel-preflight-test/preflight-test.sh |   4 +-
 .github/workflows/upgrade.yml  |   2 +-
 addons/threescale/3scale.go|  12 +-
 config/manager/operator-deployment.yaml|   2 +
 docs/modules/ROOT/pages/architecture/operator.adoc |  21 ++-
 .../ROOT/pages/installation/advanced/multi.adoc|  31 +++--
 e2e/global/builder/build_test.go   |   4 +-
 e2e/global/builder/docker_hub_test.go  |   5 +-
 e2e/global/builder/github_packages_test.go |   5 +-
 e2e/global/common/build/incremental_build_test.go  |   7 +-
 e2e/global/common/build/maven_ca_secret_test.go|   5 +-
 e2e/global/common/build/maven_repository_test.go   |   5 +-
 e2e/global/common/config/config_test.go|  44 +++---
 e2e/global/common/cron_test.go |  13 +-
 e2e/global/common/integration_fail_test.go |   5 +-
 e2e/global/common/kamelet_binding_test.go  |   3 +-
 e2e/global/common/kamelet_test.go  |   5 +-
 e2e/global/common/kamelet_update_test.go   |   3 +-
 e2e/global/common/languages/groovy_test.go |   5 +-
 e2e/global/common/languages/init_test_support.go   |   2 +-
 e2e/global/common/languages/java_test.go   |   7 +-
 e2e/global/common/languages/js_test.go |   5 +-
 e2e/global/common/languages/kotlin_test.go |   5 +-
 e2e/global/common/languages/polyglot_test.go   |   5 +-
 e2e/global/common/languages/xml_test.go|   5 +-
 e2e/global/common/languages/yaml_test.go   |   5 +-
 e2e/global/common/operator_metrics_test.go |   5 +-
 e2e/global/common/platformless_run_test.go |   5 +-
 e2e/global/common/promote_test.go  |   6 +-
 e2e/global/common/reset_test.go|  14 +-
 e2e/global/common/rest_test.go |   7 +-
 e2e/global/common/scale_binding_test.go|   5 +-
 e2e/global/common/scale_integration_test.go|   7 +-
 e2e/global/common/secondary_platform_test.go   |   9 +-
 e2e/global/common/structured_logs_test.go  |   5 +-
 e2e/global/common/traits/affinity_test.go  |   9 +-
 e2e/global/common/traits/error_handler_test.go |   5 +-
 e2e/global/common/traits/health_test.go|   5 +-
 e2e/global/common/traits/istio_test.go |   5 +-
 e2e/global/common/traits/jolokia_test.go   |   5 +-
 e2e/global/common/traits/jvm_test.go   |   5 +-
 e2e/global/common/traits/master_test.go|   9 +-
 e2e/global/common/traits/openapi_test.go   |  14 +-
 e2e/global/common/traits/pdb_test.go   |   5 +-
 e2e/global/common/traits/pod_test.go   |   5 +-
 e2e/global/common/traits/prometheus_test.go|   5 +-
 e2e/global/common/traits/pull_secret_test.go   |   9 +-
 e2e/global/common/traits/route_test.go |  13 +-
 e2e/global/common/traits/service_test.go   |   7 +-
 e2e/global/common/traits/toleration_test.go|   9 +-
 e2e/global/knative/kamelet_test.go |   5 +-
 e2e/global/knative/knative_platform_test.go|   7 +-
 e2e/global/kna

[camel-k] 06/17: Fix #2177: Ensure valid operator id when running integrations

2022-07-11 Thread astefanutti
This is an automated email from the ASF dual-hosted git repository.

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

commit 417b7b873f4aea59488cddfcc9ddf2f548248194
Author: Christoph Deppisch 
AuthorDate: Thu Jun 2 16:53:53 2022 +0200

Fix #2177: Ensure valid operator id when running integrations

- Make sure to use a known operator id when running an integration
- Check performs a cluster wide search for integration platforms and 
verifies that the platform name exists
- Users may use --force option to skip the check
---
 pkg/cmd/root_test.go | 11 ---
 pkg/cmd/run.go   | 20 +++-
 pkg/cmd/run_test.go  |  6 +-
 3 files changed, 32 insertions(+), 5 deletions(-)

diff --git a/pkg/cmd/root_test.go b/pkg/cmd/root_test.go
index 8fe884d0d..d2b4eb7d5 100644
--- a/pkg/cmd/root_test.go
+++ b/pkg/cmd/root_test.go
@@ -23,6 +23,7 @@ import (
"os"
"testing"
 
+   "github.com/apache/camel-k/pkg/client"
"github.com/apache/camel-k/pkg/util/test"
"github.com/spf13/cobra"
"github.com/spf13/viper"
@@ -37,17 +38,21 @@ func kamelTestPostAddCommandInit(t *testing.T, rootCmd 
*cobra.Command) {
}
 }
 
-func kamelTestPreAddCommandInit() (*RootCmdOptions, *cobra.Command) {
-   fakeClient, _ := test.NewFakeClient()
+func kamelTestPreAddCommandInitWithClient(client client.Client) 
(*RootCmdOptions, *cobra.Command) {
options := RootCmdOptions{
Context: context.Background(),
-   _client: fakeClient,
+   _client: client,
}
rootCmd := kamelPreAddCommandInit()
rootCmd.Run = test.EmptyRun
return , rootCmd
 }
 
+func kamelTestPreAddCommandInit() (*RootCmdOptions, *cobra.Command) {
+   fakeClient, _ := test.NewFakeClient()
+   return kamelTestPreAddCommandInitWithClient(fakeClient)
+}
+
 func TestLoadFromEnvVar(t *testing.T) {
defer teardown(t)
// shows how to include a "," character inside an env value see VAR1 
value
diff --git a/pkg/cmd/run.go b/pkg/cmd/run.go
index fd1e5c53f..a3ad6b6e1 100644
--- a/pkg/cmd/run.go
+++ b/pkg/cmd/run.go
@@ -118,6 +118,7 @@ func newCmdRun(rootCmdOptions *RootCmdOptions) 
(*cobra.Command, *runCmdOptions)
cmd.Flags().StringArray("label", nil, "Add a label to the integration. 
E.g. \"--label my.company=hello\"")
cmd.Flags().StringArray("source", nil, "Add source file to your 
integration, this is added to the list of files listed as arguments of the 
command")
cmd.Flags().String("pod-template", "", "The path of the YAML file 
containing a PodSpec template to be used for the Integration pods")
+   cmd.Flags().Bool("force", false, "Force creation of integration 
regardless of potential misconfiguration.")
 
cmd.Flags().Bool("save", false, "Save the run parameters into the 
default kamel configuration file (kamel-config.yaml)")
 
@@ -157,11 +158,12 @@ type runCmdOptions struct {
Annotations []string `mapstructure:"annotations" yaml:",omitempty"`
Sources []string `mapstructure:"sources" yaml:",omitempty"`
RegistryOptions url.Values
+   Force   bool `mapstructure:"force" yaml:",omitempty"`
 }
 
 func (o *runCmdOptions) preRunE(cmd *cobra.Command, args []string) error {
if o.OutputFormat != "" {
-   // let the command to work in offline mode
+   // let the command work in offline mode
cmd.Annotations[offlineCommandLabel] = "true"
}
return o.RootCmdOptions.preRun(cmd, args)
@@ -550,6 +552,22 @@ func (o *runCmdOptions) createOrUpdateIntegration(cmd 
*cobra.Command, c client.C
integration.Annotations = make(map[string]string)
}
 
+   if o.OperatorId != "" {
+   if pl, err := platformutil.LookupForPlatformName(o.Context, c, 
o.OperatorId); err != nil {
+   if k8serrors.IsForbidden(err) {
+   o.PrintfVerboseOutf(cmd, "Unable to verify 
existence of operator id [%s] due to lack of user privileges\n", o.OperatorId)
+   } else {
+   return nil, err
+   }
+   } else if pl == nil {
+   if o.Force {
+   o.PrintfVerboseOutf(cmd, "Unable to find 
operator with given id [%s] - integration may not be reconciled and get stuck 
in waiting state\n", o.OperatorId)
+   } else {
+   return nil, errors.New(fmt.Sprintf("unable to 
find integration platform for given 

  1   2   3   4   5   6   7   8   9   10   >