You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ts...@apache.org on 2022/07/20 05:40:07 UTC
[camel-k] branch release-1.9.x updated (bc832247f -> 603fa2c9c)
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a change to branch release-1.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
from bc832247f Fix CLI test - update file name path
new bd88d4ad6 fix(olm): fix profile name: Openshift -> OpenShift
new 603fa2c9c fix(trait): more robust, case-insensitive trait profile comparison
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 | 4 +-
config/samples/patch-integration-platform.yaml | 2 +-
docs/modules/ROOT/pages/architecture/traits.adoc | 4 +-
.../pages/contributing/local-deployment-olm.adoc | 2 +-
docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 89 +++++++++++++++++++++-
docs/modules/traits/pages/route.adoc | 8 +-
e2e/yaks/openshift/monitoring/alerting.feature | 2 +-
helm/camel-k/crds/crd-integration-platform.yaml | 4 +-
install/Makefile | 2 +-
pkg/apis/camel/v1/common_types.go | 17 +++++
pkg/apis/camel/v1/common_types_support.go | 25 +++---
pkg/apis/camel/v1/integrationplatform_types.go | 23 +-----
.../camel/v1/integrationplatform_types_support.go | 11 ---
pkg/apis/camel/v1/maven_types_support.go | 9 +++
pkg/trait/ingress.go | 2 +-
pkg/trait/knative.go | 2 +-
pkg/trait/knative_service.go | 2 +-
pkg/trait/pull_secret.go | 6 +-
pkg/trait/route.go | 4 +-
pkg/trait/service.go | 4 +-
pkg/trait/trait_types.go | 2 +-
release.adoc | 2 +-
resources/traits.yaml | 2 +-
23 files changed, 157 insertions(+), 71 deletions(-)
[camel-k] 01/02: fix(olm): fix profile name: Openshift -> OpenShift
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch release-1.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit bd88d4ad675c89805d9b876716309810f084c450
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Tue Jul 19 18:50:45 2022 +0900
fix(olm): fix profile name: Openshift -> OpenShift
Also fixes every occurrence of "Openshift" to "OpenShift" in the docs.
---
.../camel.apache.org_integrationplatforms.yaml | 4 +-
config/samples/patch-integration-platform.yaml | 2 +-
docs/modules/ROOT/pages/architecture/traits.adoc | 4 +-
.../pages/contributing/local-deployment-olm.adoc | 2 +-
docs/modules/ROOT/partials/apis/camel-k-crds.adoc | 89 +++++++++++++++++++++-
docs/modules/traits/pages/route.adoc | 8 +-
e2e/yaks/openshift/monitoring/alerting.feature | 2 +-
helm/camel-k/crds/crd-integration-platform.yaml | 4 +-
install/Makefile | 2 +-
pkg/apis/camel/v1/integrationplatform_types.go | 4 +-
pkg/trait/pull_secret.go | 6 +-
pkg/trait/route.go | 2 +-
release.adoc | 2 +-
resources/traits.yaml | 2 +-
14 files changed, 107 insertions(+), 26 deletions(-)
diff --git a/config/crd/bases/camel.apache.org_integrationplatforms.yaml b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
index 91884f24f..5c33a7d11 100644
--- a/config/crd/bases/camel.apache.org_integrationplatforms.yaml
+++ b/config/crd/bases/camel.apache.org_integrationplatforms.yaml
@@ -268,7 +268,7 @@ spec:
type: object
cluster:
description: what kind of cluster you're running (ie, plain Kubernetes
- or Openshift)
+ or OpenShift)
type: string
configuration:
description: list of configuration properties to be attached to all
@@ -543,7 +543,7 @@ spec:
type: object
cluster:
description: what kind of cluster you're running (ie, plain Kubernetes
- or Openshift)
+ or OpenShift)
type: string
conditions:
description: which are the conditions met (particularly useful when
diff --git a/config/samples/patch-integration-platform.yaml b/config/samples/patch-integration-platform.yaml
index 0f60cd2ab..4af3fedc8 100644
--- a/config/samples/patch-integration-platform.yaml
+++ b/config/samples/patch-integration-platform.yaml
@@ -24,7 +24,7 @@ spec:
# The profile to be implemented by default
# ie. OpenShift, Kubernetes, Knative
#
- profile: Openshift
+ profile: OpenShift
#
#
# Options propagated to integrations
diff --git a/docs/modules/ROOT/pages/architecture/traits.adoc b/docs/modules/ROOT/pages/architecture/traits.adoc
index 203445c06..23c154a32 100644
--- a/docs/modules/ROOT/pages/architecture/traits.adoc
+++ b/docs/modules/ROOT/pages/architecture/traits.adoc
@@ -19,10 +19,10 @@ Traits are typically used to tune several aspects of an `Integration`. However,
Another important concept related to the trait lifecycle is the **trait profile**. At this time, Camel K is supporting the following profiles:
* Kubernetes
-* Openshift
+* OpenShift
* Knative
-A profile is useful to identify on which kind of cluster a trait has to run: vanilla `Kubernetes`, `Openshift` or OpenShift/Kubernetes clusters powered by `Knative`. The default is to allow a trait on any profile; each trait can specify a different behavior (ie, running a trait only for a profile as it happens with `Knative`).
+A profile is useful to identify on which kind of cluster a trait has to run: vanilla `Kubernetes`, `OpenShift` or OpenShift/Kubernetes clusters powered by `Knative`. The default is to allow a trait on any profile; each trait can specify a different behavior (ie, running a trait only for a profile as it happens with `Knative`).
[[traits-configuration]]
=== Trait configuration
diff --git a/docs/modules/ROOT/pages/contributing/local-deployment-olm.adoc b/docs/modules/ROOT/pages/contributing/local-deployment-olm.adoc
index fc42ff012..996c8b731 100644
--- a/docs/modules/ROOT/pages/contributing/local-deployment-olm.adoc
+++ b/docs/modules/ROOT/pages/contributing/local-deployment-olm.adoc
@@ -6,7 +6,7 @@ The following steps assume that
- you've already built the camel-k image using `make images` and made it available in the cluster as an imagestream
- you've already built the bundle image using `make bundle` and have pushed it to some registry
-To perform OLM (Operator Lifecycle Manager) based deployment of camel-k, built from source locally on an Openshift cluster, you can follow the steps below.
+To perform OLM (Operator Lifecycle Manager) based deployment of camel-k, built from source locally on an OpenShift cluster, you can follow the steps below.
Login to the cluster using the standard "oc" tool, create new project, complete the basic setup process. Reference commands below
diff --git a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
index f770369f6..6bf12fdb0 100644
--- a/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
+++ b/docs/modules/ROOT/partials/apis/camel-k-crds.adoc
@@ -1792,7 +1792,7 @@ IntegrationPlatformSpec defines the desired state of IntegrationPlatform
|
-what kind of cluster you're running (ie, plain Kubernetes or Openshift)
+what kind of cluster you're running (ie, plain Kubernetes or OpenShift)
|`profile` +
*xref:#_camel_apache_org_v1_TraitProfile[TraitProfile]*
@@ -2301,6 +2301,13 @@ base Maven specification
additional repositories
+|`servers` +
+*xref:#_camel_apache_org_v1_Server[[\]Server]*
+|
+
+
+Servers (auth)
+
|===
@@ -2346,6 +2353,7 @@ the Maven settings.
|
+Deprecated: use CASecrets
The Secret name and key, containing the CA certificate(s) used to connect
to remote Maven repositories.
It can contain X.509 certificates, and PKCS#7 formatted certificate chains.
@@ -2353,6 +2361,18 @@ A JKS formatted keystore is automatically created to store the CA certificate(s)
and configured to be used as a trusted certificate(s) by the Maven commands.
Note that the root CA certificates are also imported into the created keystore.
+|`caSecrets` +
+*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#secretkeyselector-v1-core[[\]Kubernetes core/v1.SecretKeySelector]*
+|
+
+
+The Secrets name and key, containing the CA certificate(s) used to connect
+to remote Maven repositories.
+It can contain X.509 certificates, and PKCS#7 formatted certificate chains.
+A JKS formatted keystore is automatically created to store the CA certificate(s),
+and configured to be used as a trusted certificate(s) by the Maven commands.
+Note that the root CA certificates are also imported into the created keystore.
+
|`extension` +
*xref:#_camel_apache_org_v1_MavenArtifact[[\]MavenArtifact]*
|
@@ -2457,9 +2477,8 @@ NodeSelector
TopologySpreadConstraints
-
|`securityContext` +
-*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core[[\]Kubernetes core/v1.PodSecurityContext]*
+*https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.20/#podsecuritycontext-v1-core[Kubernetes core/v1.PodSecurityContext]*
|
@@ -2492,6 +2511,16 @@ the specification
|===
+[#_camel_apache_org_v1_Properties]
+=== Properties(`map[string]string` alias)
+
+*Appears on:*
+
+* <<#_camel_apache_org_v1_Server, Server>>
+
+
+
+
[#_camel_apache_org_v1_PublishTask]
=== PublishTask
@@ -2864,6 +2893,58 @@ string
used by the ImageStream
+|===
+
+[#_camel_apache_org_v1_Server]
+=== Server
+
+*Appears on:*
+
+* <<#_camel_apache_org_v1_MavenBuildSpec, MavenBuildSpec>>
+
+
+
+[cols="2,2a",options="header"]
+|===
+|Field
+|Description
+
+|`-` +
+encoding/xml.Name
+|
+
+
+
+
+|`id` +
+string
+|
+
+
+
+
+|`username` +
+string
+|
+
+
+
+
+|`password` +
+string
+|
+
+
+
+
+|`configuration` +
+*xref:#_camel_apache_org_v1_Properties[Properties]*
+|
+
+
+
+
+
|===
[#_camel_apache_org_v1_SourceSpec]
@@ -3114,4 +3195,4 @@ Selects a key of a ConfigMap.
Selects a key of a secret.
-|===
+|===
\ No newline at end of file
diff --git a/docs/modules/traits/pages/route.adoc b/docs/modules/traits/pages/route.adoc
index 493586cef..dbb3ceb76 100755
--- a/docs/modules/traits/pages/route.adoc
+++ b/docs/modules/traits/pages/route.adoc
@@ -3,7 +3,7 @@
// Start of autogenerated code - DO NOT EDIT! (description)
The Route trait can be used to configure the creation of OpenShift routes for the integration.
-The certificate and key contents may be sourced either from the local filesystem or in a Openshift `secret` object.
+The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object.
The user may use the parameters ending in `-secret` (example: `tls-certificate-secret`) to reference a certificate stored in a `secret`.
Parameters ending in `-secret` have higher priorities and in case the same route parameter is set, for example: `tls-key-secret` and `tls-key`,
then `tls-key-secret` is used.
@@ -107,7 +107,7 @@ Refer to the OpenShift route documentation for additional information.
== Examples
-These examples uses *secrets* to store the certificates and keys to be referenced in the integrations. Read Openshift route documentation for detailed information about routes. The https://github.com/apache/camel-k/blob/main/examples/http/PlatformHttpServer.java[PlatformHttpServer.java] is the integration example.
+These examples uses *secrets* to store the certificates and keys to be referenced in the integrations. Read OpenShift route documentation for detailed information about routes. The https://github.com/apache/camel-k/blob/main/examples/http/PlatformHttpServer.java[PlatformHttpServer.java] is the integration example.
As a requirement to run these examples, you should have a `secret` with a key and certificate.
@@ -141,12 +141,12 @@ kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc
[source,console]
kamel run --dev PlatformHttpServer.java --resource secret:my-combined-certs@/etc/ssl/my-combined-certs -p quarkus.http.ssl.certificate.file=/etc/ssl/my-combined-certs/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/my-combined-certs/tls.key -t route.tls-termination=reencrypt -t route.tls-destination-ca-certificate-secret=my-combined-certs/tls.crt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
-* To add a *reencrypt* route using a specific certificate from a secret for the route and https://docs.openshift.com/container-platform/4.8/security/certificates/service-serving-certificate.html#add-service-certificate_service-serving-certificate[Openshift service serving certificates] for the integration endpoint. This way the Openshift service serving certificates is set up only in the integration pod. The keys and certificates should be visible in the running integration pod, to achie [...]
+* To add a *reencrypt* route using a specific certificate from a secret for the route and https://docs.openshift.com/container-platform/4.8/security/certificates/service-serving-certificate.html#add-service-certificate_service-serving-certificate[OpenShift service serving certificates] for the integration endpoint. This way the OpenShift service serving certificates is set up only in the integration pod. The keys and certificates should be visible in the running integration pod, to achie [...]
+
[source,console]
kamel run --dev PlatformHttpServer.java --resource secret:cert-from-openshift@/etc/ssl/cert-from-openshift -p quarkus.http.ssl.certificate.file=/etc/ssl/cert-from-openshift/tls.crt -p quarkus.http.ssl.certificate.key-file=/etc/ssl/cert-from-openshift/tls.key -t route.tls-termination=reencrypt -t route.tls-certificate-secret=my-combined-certs/tls.crt -t route.tls-key-secret=my-combined-certs/tls.key -t container.port=8443
+
-Then you should annotate the integration service to inject the Openshift service serving certificates
+Then you should annotate the integration service to inject the OpenShift service serving certificates
+
[source,console]
oc annotate service platform-http-server service.beta.openshift.io/serving-cert-secret-name=cert-from-openshift
diff --git a/e2e/yaks/openshift/monitoring/alerting.feature b/e2e/yaks/openshift/monitoring/alerting.feature
index 3a5750998..04b5d4a6b 100644
--- a/e2e/yaks/openshift/monitoring/alerting.feature
+++ b/e2e/yaks/openshift/monitoring/alerting.feature
@@ -1,4 +1,4 @@
-Feature: Alerts from Camel K are propagated to Openshift Prometheus
+Feature: Alerts from Camel K are propagated to OpenShift Prometheus
Background: Prepare Thanos-ruler URL
Given URL: https://thanos-ruler.openshift-user-workload-monitoring:9091
diff --git a/helm/camel-k/crds/crd-integration-platform.yaml b/helm/camel-k/crds/crd-integration-platform.yaml
index 91884f24f..5c33a7d11 100644
--- a/helm/camel-k/crds/crd-integration-platform.yaml
+++ b/helm/camel-k/crds/crd-integration-platform.yaml
@@ -268,7 +268,7 @@ spec:
type: object
cluster:
description: what kind of cluster you're running (ie, plain Kubernetes
- or Openshift)
+ or OpenShift)
type: string
configuration:
description: list of configuration properties to be attached to all
@@ -543,7 +543,7 @@ spec:
type: object
cluster:
description: what kind of cluster you're running (ie, plain Kubernetes
- or Openshift)
+ or OpenShift)
type: string
conditions:
description: which are the conditions met (particularly useful when
diff --git a/install/Makefile b/install/Makefile
index faf8466d6..2838115d9 100644
--- a/install/Makefile
+++ b/install/Makefile
@@ -307,7 +307,7 @@ endif
# Customizes the samples patches for openshift
#
.platform-openshift-patch:
- @sed -i 's/.*profile:.*/ profile: Openshift/' $(SAMPLES)/$(INT_PLATFORM_PATCH).$(YAML)
+ @sed -i 's/.*profile:.*/ profile: OpenShift/' $(SAMPLES)/$(INT_PLATFORM_PATCH).$(YAML)
#
# Install the integration platform
diff --git a/pkg/apis/camel/v1/integrationplatform_types.go b/pkg/apis/camel/v1/integrationplatform_types.go
index c78af0388..2bf9f8f4b 100644
--- a/pkg/apis/camel/v1/integrationplatform_types.go
+++ b/pkg/apis/camel/v1/integrationplatform_types.go
@@ -27,7 +27,7 @@ import (
// IntegrationPlatformSpec defines the desired state of IntegrationPlatform
type IntegrationPlatformSpec struct {
- // what kind of cluster you're running (ie, plain Kubernetes or Openshift)
+ // what kind of cluster you're running (ie, plain Kubernetes or OpenShift)
Cluster IntegrationPlatformCluster `json:"cluster,omitempty"`
// the profile you wish to use. It will apply certain traits which are required by the specific profile chosen.
// It usually relates the Cluster with the optional definition of special profiles (ie, Knative)
@@ -176,7 +176,7 @@ const (
IntegrationPlatformBuildPublishStrategyKaniko IntegrationPlatformBuildPublishStrategy = "Kaniko"
// IntegrationPlatformBuildPublishStrategyS2I uses the Source to Images (S2I) feature
// (https://docs.openshift.com/container-platform/4.9/openshift_images/create-images.html#images-create-s2i_create-images)
- // provided by an Openshift cluster in order to create and push the images to the registry. It is the default choice on Openshift cluster
+ // provided by an OpenShift cluster in order to create and push the images to the registry. It is the default choice on OpenShift cluster
IntegrationPlatformBuildPublishStrategyS2I IntegrationPlatformBuildPublishStrategy = "S2I"
// IntegrationPlatformBuildPublishStrategySpectrum uses Spectrum project (https://github.com/container-tools/spectrum)
// in order to push the incremental images to the image repository. It is the default choice on vanilla Kubernetes cluster
diff --git a/pkg/trait/pull_secret.go b/pkg/trait/pull_secret.go
index 10414e5ff..bc108c6c4 100644
--- a/pkg/trait/pull_secret.go
+++ b/pkg/trait/pull_secret.go
@@ -85,17 +85,17 @@ func (t *pullSecretTrait) Configure(e *Environment) (bool, error) {
}
}
if t.ImagePullerDelegation == nil {
- var isOpenshift bool
+ var isOpenShift bool
if t.Client != nil {
var err error
- isOpenshift, err = openshift.IsOpenShift(t.Client)
+ isOpenShift, err = openshift.IsOpenShift(t.Client)
if err != nil {
return false, err
}
}
isOperatorGlobal := platform.IsCurrentOperatorGlobal()
isKitExternal := e.Integration.GetIntegrationKitNamespace(e.Platform) != e.Integration.Namespace
- needsDelegation := isOpenshift && isOperatorGlobal && isKitExternal
+ needsDelegation := isOpenShift && isOperatorGlobal && isKitExternal
t.ImagePullerDelegation = &needsDelegation
}
}
diff --git a/pkg/trait/route.go b/pkg/trait/route.go
index c3d541789..3f5b494c6 100644
--- a/pkg/trait/route.go
+++ b/pkg/trait/route.go
@@ -34,7 +34,7 @@ import (
// The Route trait can be used to configure the creation of OpenShift routes for the integration.
//
-// The certificate and key contents may be sourced either from the local filesystem or in a Openshift `secret` object.
+// The certificate and key contents may be sourced either from the local filesystem or in a OpenShift `secret` object.
// The user may use the parameters ending in `-secret` (example: `tls-certificate-secret`) to reference a certificate stored in a `secret`.
// Parameters ending in `-secret` have higher priorities and in case the same route parameter is set, for example: `tls-key-secret` and `tls-key`,
// then `tls-key-secret` is used.
diff --git a/release.adoc b/release.adoc
index 8ba2600f8..1a7de581d 100644
--- a/release.adoc
+++ b/release.adoc
@@ -245,7 +245,7 @@ The https://github.com/k8s-operatorhub/community-operators/[OperatorHub] downstr
of Camel K, so that it can be easily installed on platforms that support Operator Hub.
The https://github.com/redhat-openshift-ecosystem/community-operators-prod/[Embedded OperatorHub in OpenShift and OKD] downstream channel should be synced to publish the latest version
-of Camel K, so that it can be easily installed on Openshift and OKD.
+of Camel K, so that it can be easily installed on OpenShift and OKD.
You can create the bundle using the `make bundle` command.
diff --git a/resources/traits.yaml b/resources/traits.yaml
index 15183bb70..d006ef569 100755
--- a/resources/traits.yaml
+++ b/resources/traits.yaml
@@ -1038,7 +1038,7 @@ traits:
- OpenShift
description: 'The Route trait can be used to configure the creation of OpenShift
routes for the integration. The certificate and key contents may be sourced either
- from the local filesystem or in a Openshift `secret` object. The user may use
+ from the local filesystem or in a OpenShift `secret` object. The user may use
the parameters ending in `-secret` (example: `tls-certificate-secret`) to reference
a certificate stored in a `secret`. Parameters ending in `-secret` have higher
priorities and in case the same route parameter is set, for example: `tls-key-secret`
[camel-k] 02/02: fix(trait): more robust, case-insensitive trait profile comparison
Posted by ts...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tsato pushed a commit to branch release-1.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 603fa2c9c4e19a172d1b45473f238d26d7ac0529
Author: Tadayoshi Sato <sa...@gmail.com>
AuthorDate: Tue Jul 19 19:27:37 2022 +0900
fix(trait): more robust, case-insensitive trait profile comparison
---
pkg/apis/camel/v1/common_types.go | 17 +++++++++++++++
pkg/apis/camel/v1/common_types_support.go | 25 ++++++++++++++--------
pkg/apis/camel/v1/integrationplatform_types.go | 19 +---------------
.../camel/v1/integrationplatform_types_support.go | 11 ----------
pkg/apis/camel/v1/maven_types_support.go | 9 ++++++++
pkg/trait/ingress.go | 2 +-
pkg/trait/knative.go | 2 +-
pkg/trait/knative_service.go | 2 +-
pkg/trait/route.go | 2 +-
pkg/trait/service.go | 4 ++--
pkg/trait/trait_types.go | 2 +-
11 files changed, 50 insertions(+), 45 deletions(-)
diff --git a/pkg/apis/camel/v1/common_types.go b/pkg/apis/camel/v1/common_types.go
index 1d9be8ceb..43e5c97fb 100644
--- a/pkg/apis/camel/v1/common_types.go
+++ b/pkg/apis/camel/v1/common_types.go
@@ -101,6 +101,23 @@ type FailureRecovery struct {
AttemptTime metav1.Time `json:"attemptTime"`
}
+// TraitProfile represents lists of traits that are enabled for the specific installation/integration
+type TraitProfile string
+
+const (
+ // TraitProfileOpenShift is used by default on OpenShift clusters
+ TraitProfileOpenShift TraitProfile = "OpenShift"
+ // TraitProfileKubernetes is used by default on Kubernetes clusters
+ TraitProfileKubernetes TraitProfile = "Kubernetes"
+ // TraitProfileKnative is used by default on OpenShift/Kubernetes clusters powered by Knative
+ TraitProfileKnative TraitProfile = "Knative"
+ // DefaultTraitProfile is the trait profile used as default when no other profile is set
+ DefaultTraitProfile = TraitProfileKubernetes
+)
+
+// AllTraitProfiles contains all allowed profiles
+var AllTraitProfiles = []TraitProfile{TraitProfileKubernetes, TraitProfileKnative, TraitProfileOpenShift}
+
// A TraitSpec contains the configuration of a trait
type TraitSpec struct {
// TraitConfiguration parameters configuration
diff --git a/pkg/apis/camel/v1/common_types_support.go b/pkg/apis/camel/v1/common_types_support.go
index aec43a183..c4ce7f0f4 100644
--- a/pkg/apis/camel/v1/common_types_support.go
+++ b/pkg/apis/camel/v1/common_types_support.go
@@ -21,21 +21,13 @@ import (
"encoding/json"
"errors"
"fmt"
+ "strings"
)
func (in *Artifact) String() string {
return in.ID
}
-func (in *MavenArtifact) GetDependencyID() string {
- switch {
- case in.Version == "":
- return "mvn:" + in.GroupID + ":" + in.ArtifactID
- default:
- return "mvn:" + in.GroupID + ":" + in.ArtifactID + ":" + in.Version
- }
-}
-
func (in *ConfigurationSpec) String() string {
return fmt.Sprintf("%s=%s", in.Type, in.Value)
}
@@ -50,6 +42,21 @@ func (in *RuntimeSpec) CapabilityDependencies(capability string) []MavenArtifact
return deps
}
+// TraitProfileByName returns the trait profile corresponding to the given name (case insensitive).
+func TraitProfileByName(name string) TraitProfile {
+ for _, p := range AllTraitProfiles {
+ if strings.EqualFold(name, string(p)) {
+ return p
+ }
+ }
+ return ""
+}
+
+// Equal checks if the profile is equal to the given profile (case insensitive).
+func (p TraitProfile) Equal(other TraitProfile) bool {
+ return strings.EqualFold(string(p), string(other))
+}
+
// MarshalJSON returns m as the JSON encoding of m.
func (m RawMessage) MarshalJSON() ([]byte, error) {
if m == nil {
diff --git a/pkg/apis/camel/v1/integrationplatform_types.go b/pkg/apis/camel/v1/integrationplatform_types.go
index 2bf9f8f4b..03ae42ba2 100644
--- a/pkg/apis/camel/v1/integrationplatform_types.go
+++ b/pkg/apis/camel/v1/integrationplatform_types.go
@@ -95,7 +95,7 @@ type IntegrationPlatformList struct {
type IntegrationPlatformCluster string
const (
- // IntegrationPlatformClusterOpenShift is used when targeting a OpenShift cluster
+ // IntegrationPlatformClusterOpenShift is used when targeting an OpenShift cluster
IntegrationPlatformClusterOpenShift IntegrationPlatformCluster = "OpenShift"
// IntegrationPlatformClusterKubernetes is used when targeting a Kubernetes cluster
IntegrationPlatformClusterKubernetes IntegrationPlatformCluster = "Kubernetes"
@@ -104,23 +104,6 @@ const (
// AllIntegrationPlatformClusters --
var AllIntegrationPlatformClusters = []IntegrationPlatformCluster{IntegrationPlatformClusterOpenShift, IntegrationPlatformClusterKubernetes}
-// TraitProfile represents lists of traits that are enabled for the specific installation/integration
-type TraitProfile string
-
-const (
- // TraitProfileOpenShift is used by default on OpenShift clusters
- TraitProfileOpenShift TraitProfile = "OpenShift"
- // TraitProfileKubernetes is used by default on Kubernetes clusters
- TraitProfileKubernetes TraitProfile = "Kubernetes"
- // TraitProfileKnative is used by default on OpenShift/Kubernetes clusters powered by Knative
- TraitProfileKnative TraitProfile = "Knative"
- // DefaultTraitProfile is the trait profile used as default when no other profile is set
- DefaultTraitProfile = TraitProfileKubernetes
-)
-
-// AllTraitProfiles contains all allowed profiles
-var AllTraitProfiles = []TraitProfile{TraitProfileKubernetes, TraitProfileKnative, TraitProfileOpenShift}
-
// IntegrationPlatformBuildSpec contains platform related build information.
// This configuration can be used to tune the behavior of the Integration/IntegrationKit image builds.
// You can define the build strategy, the image registry to use and the Maven configuration to adopt.
diff --git a/pkg/apis/camel/v1/integrationplatform_types_support.go b/pkg/apis/camel/v1/integrationplatform_types_support.go
index b644f462e..3ff4bb6b5 100644
--- a/pkg/apis/camel/v1/integrationplatform_types_support.go
+++ b/pkg/apis/camel/v1/integrationplatform_types_support.go
@@ -19,7 +19,6 @@ package v1
import (
"strconv"
- "strings"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -49,16 +48,6 @@ func NewIntegrationPlatform(namespace string, name string) IntegrationPlatform {
}
}
-// TraitProfileByName returns the trait profile corresponding to the given name (case insensitive)
-func TraitProfileByName(name string) TraitProfile {
- for _, p := range AllTraitProfiles {
- if strings.EqualFold(name, string(p)) {
- return p
- }
- }
- return ""
-}
-
// Configurations --
func (in *IntegrationPlatformSpec) Configurations() []ConfigurationSpec {
if in == nil {
diff --git a/pkg/apis/camel/v1/maven_types_support.go b/pkg/apis/camel/v1/maven_types_support.go
index 0cf9dadc4..d4777bffc 100644
--- a/pkg/apis/camel/v1/maven_types_support.go
+++ b/pkg/apis/camel/v1/maven_types_support.go
@@ -19,6 +19,15 @@ package v1
import "encoding/xml"
+func (in *MavenArtifact) GetDependencyID() string {
+ switch {
+ case in.Version == "":
+ return "mvn:" + in.GroupID + ":" + in.ArtifactID
+ default:
+ return "mvn:" + in.GroupID + ":" + in.ArtifactID + ":" + in.Version
+ }
+}
+
type propertiesEntry struct {
XMLName xml.Name
Value string `xml:",chardata"`
diff --git a/pkg/trait/ingress.go b/pkg/trait/ingress.go
index a5e2b7e89..3302fde74 100644
--- a/pkg/trait/ingress.go
+++ b/pkg/trait/ingress.go
@@ -51,7 +51,7 @@ func newIngressTrait() Trait {
// IsAllowedInProfile overrides default.
func (t *ingressTrait) IsAllowedInProfile(profile v1.TraitProfile) bool {
- return profile == v1.TraitProfileKubernetes
+ return profile.Equal(v1.TraitProfileKubernetes)
}
func (t *ingressTrait) Configure(e *Environment) (bool, error) {
diff --git a/pkg/trait/knative.go b/pkg/trait/knative.go
index f3b611bb0..1ca0adb3e 100644
--- a/pkg/trait/knative.go
+++ b/pkg/trait/knative.go
@@ -100,7 +100,7 @@ func newKnativeTrait() Trait {
// IsAllowedInProfile overrides default.
func (t *knativeTrait) IsAllowedInProfile(profile v1.TraitProfile) bool {
- return profile == v1.TraitProfileKnative
+ return profile.Equal(v1.TraitProfileKnative)
}
func (t *knativeTrait) Configure(e *Environment) (bool, error) {
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index 82576f95b..b0fb03523 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -97,7 +97,7 @@ func newKnativeServiceTrait() Trait {
// IsAllowedInProfile overrides default.
func (t *knativeServiceTrait) IsAllowedInProfile(profile v1.TraitProfile) bool {
- return profile == v1.TraitProfileKnative
+ return profile.Equal(v1.TraitProfileKnative)
}
func (t *knativeServiceTrait) Configure(e *Environment) (bool, error) {
diff --git a/pkg/trait/route.go b/pkg/trait/route.go
index 3f5b494c6..82a9d2937 100644
--- a/pkg/trait/route.go
+++ b/pkg/trait/route.go
@@ -104,7 +104,7 @@ func newRouteTrait() Trait {
// IsAllowedInProfile overrides default.
func (t *routeTrait) IsAllowedInProfile(profile v1.TraitProfile) bool {
- return profile == v1.TraitProfileOpenShift
+ return profile.Equal(v1.TraitProfileOpenShift)
}
func (t *routeTrait) Configure(e *Environment) (bool, error) {
diff --git a/pkg/trait/service.go b/pkg/trait/service.go
index a070c8160..9f362bb94 100644
--- a/pkg/trait/service.go
+++ b/pkg/trait/service.go
@@ -50,8 +50,8 @@ func newServiceTrait() Trait {
// IsAllowedInProfile overrides default.
func (t *serviceTrait) IsAllowedInProfile(profile v1.TraitProfile) bool {
- return profile == v1.TraitProfileKubernetes ||
- profile == v1.TraitProfileOpenShift
+ return profile.Equal(v1.TraitProfileKubernetes) ||
+ profile.Equal(v1.TraitProfileOpenShift)
}
func (t *serviceTrait) Configure(e *Environment) (bool, error) {
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index a53ec9841..56bf93dc4 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -76,7 +76,7 @@ type Trait interface {
// RequiresIntegrationPlatform indicates that the trait cannot work without an integration platform set
RequiresIntegrationPlatform() bool
- // IsAllowedInProfile tels if the trait supports the given profile
+ // IsAllowedInProfile tells if the trait supports the given profile
IsAllowedInProfile(v1.TraitProfile) bool
// Order is the order in which the trait should be executed in the normal flow