[camel-k] branch master updated (8518467 -> 1d38815)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[camel-k] branch master updated (8518467 -> 1d38815)

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

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


    from 8518467  Upgrade Operator SDK to version 0.14.0
     new c58f973  chore(jolokia): Default to using service signing certificate authority
     new f19bd19  feat(jolokia): Add default client principals for OpenShift 4
     new 707b7f4  feat(jolokia): Automatically add camel-management dependency
     new 1d38815  Fix Jolokia trait unit test

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/trait/jolokia.go      | 43 ++++++++++++++++++++++++++++++++++++-------
 pkg/trait/jolokia_test.go |  3 +--
 2 files changed, 37 insertions(+), 9 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[camel-k] 01/04: chore(jolokia): Default to using service signing certificate authority

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

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

commit c58f9732efe7bb9673adb31cc2e4f2f93468ef50
Author: Antonin Stefanutti <[hidden email]>
AuthorDate: Mon Jan 13 10:13:59 2020 +0100

    chore(jolokia): Default to using service signing certificate authority
---
 pkg/trait/jolokia.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go
index 9972b1a..bc8c37e 100644
--- a/pkg/trait/jolokia.go
+++ b/pkg/trait/jolokia.go
@@ -90,7 +90,7 @@ func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
  // Configure HTTPS by default for OpenShift
  if e.DetermineProfile() == v1.TraitProfileOpenShift {
  setDefaultJolokiaOption(options, &t.Protocol, "protocol", "https")
- setDefaultJolokiaOption(options, &t.CaCert, "caCert", "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
+ setDefaultJolokiaOption(options, &t.CaCert, "caCert", "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt")
  setDefaultJolokiaOption(options, &t.ExtendedClientCheck, "extendedClientCheck", true)
  setDefaultJolokiaOption(options, &t.ClientPrincipal, "clientPrincipal", "cn=system:master-proxy")
  setDefaultJolokiaOption(options, &t.UseSslClientAuthentication, "useSslClientAuthentication", true)

Reply | Threaded
Open this post in threaded view
|

[camel-k] 02/04: feat(jolokia): Add default client principals for OpenShift 4

astefanutti-2
In reply to this post by astefanutti-2
This is an automated email from the ASF dual-hosted git repository.

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

commit f19bd194cd8b3a06ec9aff709b0d3ba894bc5e90
Author: Antonin Stefanutti <[hidden email]>
AuthorDate: Mon Jan 13 12:43:34 2020 +0100

    feat(jolokia): Add default client principals for OpenShift 4
---
 pkg/trait/jolokia.go | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go
index bc8c37e..1e63040 100644
--- a/pkg/trait/jolokia.go
+++ b/pkg/trait/jolokia.go
@@ -92,7 +92,6 @@ func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
  setDefaultJolokiaOption(options, &t.Protocol, "protocol", "https")
  setDefaultJolokiaOption(options, &t.CaCert, "caCert", "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt")
  setDefaultJolokiaOption(options, &t.ExtendedClientCheck, "extendedClientCheck", true)
- setDefaultJolokiaOption(options, &t.ClientPrincipal, "clientPrincipal", "cn=system:master-proxy")
  setDefaultJolokiaOption(options, &t.UseSslClientAuthentication, "useSslClientAuthentication", true)
  }
 
@@ -136,7 +135,16 @@ func (t *jolokiaTrait) Apply(e *Environment) (err error) {
 
  // Then add explicitly set trait configuration properties
  addToJolokiaOptions(options, "caCert", t.CaCert)
- addToJolokiaOptions(options, "clientPrincipal", t.ClientPrincipal)
+ if options["clientPrincipal"] == "" && t.ClientPrincipal == nil && e.DetermineProfile() == v1.TraitProfileOpenShift {
+ // TODO: simplify when trait array options are supported
+ // Master API proxy for OpenShift 3
+ addToJolokiaOptions(options, "clientPrincipal.1", "cn=system:master-proxy")
+ // Default Hawtio and Fuse consoles for OpenShift 4
+ addToJolokiaOptions(options, "clientPrincipal.2", "cn=hawtio-online.hawtio.svc")
+ addToJolokiaOptions(options, "clientPrincipal.3", "cn=fuse-console.fuse.svc")
+ } else {
+ addToJolokiaOptions(options, "clientPrincipal", t.ClientPrincipal)
+ }
  addToJolokiaOptions(options, "discoveryEnabled", t.DiscoveryEnabled)
  addToJolokiaOptions(options, "extendedClientCheck", t.ExtendedClientCheck)
  addToJolokiaOptions(options, "host", t.Host)
@@ -211,5 +219,9 @@ func addToJolokiaOptions(options map[string]string, key string, value interface{
  if v != nil {
  options[key] = *v
  }
+ case string:
+ if v != "" {
+ options[key] = v
+ }
  }
 }

Reply | Threaded
Open this post in threaded view
|

[camel-k] 03/04: feat(jolokia): Automatically add camel-management dependency

astefanutti-2
In reply to this post by astefanutti-2
This is an automated email from the ASF dual-hosted git repository.

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

commit 707b7f4e38b9f4127a10f47360fdc7ce37125915
Author: Antonin Stefanutti <[hidden email]>
AuthorDate: Mon Jan 13 14:17:48 2020 +0100

    feat(jolokia): Automatically add camel-management dependency
---
 pkg/trait/jolokia.go | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/pkg/trait/jolokia.go b/pkg/trait/jolokia.go
index 1e63040..60f6022 100644
--- a/pkg/trait/jolokia.go
+++ b/pkg/trait/jolokia.go
@@ -22,10 +22,11 @@ import (
  "strconv"
  "strings"
 
+ corev1 "k8s.io/api/core/v1"
+
  v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
+ "github.com/apache/camel-k/pkg/util"
  "github.com/apache/camel-k/pkg/util/envvar"
-
- corev1 "k8s.io/api/core/v1"
 )
 
 // The Jolokia trait activates and configures the Jolokia Java agent.
@@ -78,6 +79,10 @@ func newJolokiaTrait() *jolokiaTrait {
  }
 }
 
+func (t *jolokiaTrait) isEnabled() bool {
+ return t.Enabled != nil && *t.Enabled
+}
+
 func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
  options, err := parseCsvMap(t.Options)
  if err != nil {
@@ -95,10 +100,22 @@ func (t *jolokiaTrait) Configure(e *Environment) (bool, error) {
  setDefaultJolokiaOption(options, &t.UseSslClientAuthentication, "useSslClientAuthentication", true)
  }
 
- return e.IntegrationInPhase(v1.IntegrationPhaseDeploying, v1.IntegrationPhaseRunning), nil
+ return e.IntegrationInPhase(
+ v1.IntegrationPhaseInitialization,
+ v1.IntegrationPhaseDeploying,
+ v1.IntegrationPhaseRunning,
+ ), nil
 }
 
 func (t *jolokiaTrait) Apply(e *Environment) (err error) {
+ if e.IntegrationInPhase(v1.IntegrationPhaseInitialization) {
+ if t.isEnabled() {
+ // Add Camel management dependency
+ util.StringSliceUniqueAdd(&e.Integration.Status.Dependencies, "mvn:org.apache.camel/camel-management")
+ }
+ return nil
+ }
+
  containerName := defaultContainerName
  dt := e.Catalog.GetTrait(containerTraitID)
  if dt != nil {
@@ -116,7 +133,7 @@ func (t *jolokiaTrait) Apply(e *Environment) (err error) {
  return nil
  }
 
- if t.Enabled == nil || !*t.Enabled {
+ if !t.isEnabled() {
  // Deactivate the Jolokia Java agent
  // Note: the AB_JOLOKIA_OFF environment variable acts as an option flag
  envvar.SetVal(&container.Env, "AB_JOLOKIA_OFF", "true")

Reply | Threaded
Open this post in threaded view
|

[camel-k] 04/04: Fix Jolokia trait unit test

astefanutti-2
In reply to this post by astefanutti-2
This is an automated email from the ASF dual-hosted git repository.

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

commit 1d3881570293c2685a84471e1bcc03d76c457be9
Author: Antonin Stefanutti <[hidden email]>
AuthorDate: Mon Jan 13 14:35:03 2020 +0100

    Fix Jolokia trait unit test
---
 pkg/trait/jolokia_test.go | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/pkg/trait/jolokia_test.go b/pkg/trait/jolokia_test.go
index 858da87..bbaf4e4 100644
--- a/pkg/trait/jolokia_test.go
+++ b/pkg/trait/jolokia_test.go
@@ -77,9 +77,8 @@ func TestConfigureJolokiaTraitForOpenShiftProfileShouldSetDefaultHttpsJolokiaOpt
  assert.Nil(t, err)
  assert.True(t, configured)
  assert.Equal(t, *trait.Protocol, "https")
- assert.Equal(t, *trait.CaCert, "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt")
+ assert.Equal(t, *trait.CaCert, "/var/run/secrets/kubernetes.io/serviceaccount/service-ca.crt")
  assert.Equal(t, *trait.ExtendedClientCheck, true)
- assert.Equal(t, *trait.ClientPrincipal, "cn=system:master-proxy")
  assert.Equal(t, *trait.UseSslClientAuthentication, true)
 }