You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by as...@apache.org on 2020/06/03 13:02:01 UTC
[camel-k] branch master updated (726d849 -> 9eaf3ea)
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 726d849 fix: Remove Prometheus container port name from condition message
new ce2fa65 chore: Remove deployer traits member leftovers
new a35f5d1 chore: Group integration readiness condition with replicas reconciliation logic
new 6659ef2 chore: Remove unecessary type declaration
new 9eaf3ea chore: Remove unused parameters
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/controller/integration/monitor.go | 4 ++++
pkg/trait/cron.go | 9 ++-------
pkg/trait/deployer.go | 6 ------
pkg/trait/deployer_test.go | 2 +-
pkg/trait/deployment.go | 19 ++-----------------
pkg/trait/deployment_test.go | 1 -
pkg/trait/knative_service.go | 2 +-
pkg/trait/prometheus.go | 2 +-
pkg/trait/trait_types.go | 6 ++----
9 files changed, 13 insertions(+), 38 deletions(-)
[camel-k] 03/04: chore: Remove unecessary type declaration
Posted by as...@apache.org.
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 6659ef27dd7b4a54b6a98868bd8642bbaa6f8703
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Jun 2 15:51:22 2020 +0200
chore: Remove unecessary type declaration
---
pkg/trait/trait_types.go | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index 457afcf..e3c8c46 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -223,7 +223,7 @@ const (
ControllerStrategyKnativeService ControllerStrategy = "knative-service"
ControllerStrategyCronJob ControllerStrategy = "cron-job"
- DefaultControllerStrategy ControllerStrategy = ControllerStrategyDeployment
+ DefaultControllerStrategy = ControllerStrategyDeployment
)
// GetTrait --
[camel-k] 02/04: chore: Group integration readiness condition with
replicas reconciliation logic
Posted by as...@apache.org.
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 a35f5d1d877cb9a69c4ed50193914acf357d99bd
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Jun 2 15:23:58 2020 +0200
chore: Group integration readiness condition with replicas reconciliation logic
---
pkg/controller/integration/monitor.go | 4 ++++
pkg/trait/deployer.go | 6 ------
pkg/trait/deployer_test.go | 2 +-
3 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/pkg/controller/integration/monitor.go b/pkg/controller/integration/monitor.go
index 344c694..4cea23e 100644
--- a/pkg/controller/integration/monitor.go
+++ b/pkg/controller/integration/monitor.go
@@ -27,6 +27,7 @@ import (
"github.com/apache/camel-k/pkg/trait"
"github.com/apache/camel-k/pkg/util/defaults"
"github.com/apache/camel-k/pkg/util/digest"
+ "github.com/apache/camel-k/pkg/util/kubernetes"
)
// NewMonitorAction creates a new monitoring action for an integration
@@ -91,6 +92,9 @@ func (action *monitorAction) Handle(ctx context.Context, integration *v1.Integra
}
}
+ // Mirror ready condition from the sub resource (e.g.ReplicaSet, Deployment, CronJob, ...) to the integration
+ kubernetes.MirrorReadyCondition(ctx, action.client, integration)
+
return integration, nil
}
diff --git a/pkg/trait/deployer.go b/pkg/trait/deployer.go
index da55a7e..8368110 100644
--- a/pkg/trait/deployer.go
+++ b/pkg/trait/deployer.go
@@ -110,12 +110,6 @@ func (t *deployerTrait) Apply(e *Environment) error {
}
return nil
})
-
- // Mirror ready condition from the sub resource to the integration
- e.PostActions = append(e.PostActions, func(e *Environment) error {
- kubernetes.MirrorReadyCondition(t.Ctx, t.Client, e.Integration)
- return nil
- })
}
return nil
diff --git a/pkg/trait/deployer_test.go b/pkg/trait/deployer_test.go
index 7160f55..d5ffb97 100644
--- a/pkg/trait/deployer_test.go
+++ b/pkg/trait/deployer_test.go
@@ -52,7 +52,7 @@ func TestApplyDeployerTraitDoesSucceed(t *testing.T) {
err := deployerTrait.Apply(environment)
assert.Nil(t, err)
- assert.Len(t, environment.PostActions, 2)
+ assert.Len(t, environment.PostActions, 1)
}
func TestApplyDeployerTraitInInitializationPhaseDoesSucceed(t *testing.T) {
[camel-k] 04/04: chore: Remove unused parameters
Posted by as...@apache.org.
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 9eaf3eaa6df02176a3c7c084d9840c5ecec4b673
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Wed Jun 3 10:59:34 2020 +0200
chore: Remove unused parameters
---
pkg/trait/cron.go | 2 +-
pkg/trait/deployment.go | 2 +-
pkg/trait/knative_service.go | 2 +-
pkg/trait/prometheus.go | 2 +-
pkg/trait/trait_types.go | 4 +---
5 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/pkg/trait/cron.go b/pkg/trait/cron.go
index 98707f4..3f740b1 100644
--- a/pkg/trait/cron.go
+++ b/pkg/trait/cron.go
@@ -194,7 +194,7 @@ func (t *cronTrait) Configure(e *Environment) (bool, error) {
}
// CronJob strategy requires common schedule
- strategy, err := e.DetermineControllerStrategy(t.Ctx, t.Client)
+ strategy, err := e.DetermineControllerStrategy()
if err != nil {
e.Integration.Status.SetErrorCondition(
v1.IntegrationConditionCronJobAvailable,
diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index 985fd97..a56ec06 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -63,7 +63,7 @@ func (t *deploymentTrait) Configure(e *Environment) (bool, error) {
//
// Don't deploy when a different strategy is needed (e.g. Knative, Cron)
//
- strategy, err := e.DetermineControllerStrategy(t.Ctx, t.Client)
+ strategy, err := e.DetermineControllerStrategy()
if err != nil {
e.Integration.Status.SetErrorCondition(
v1.IntegrationConditionDeploymentAvailable,
diff --git a/pkg/trait/knative_service.go b/pkg/trait/knative_service.go
index 8bbe95c..bea1513 100644
--- a/pkg/trait/knative_service.go
+++ b/pkg/trait/knative_service.go
@@ -121,7 +121,7 @@ func (t *knativeServiceTrait) Configure(e *Environment) (bool, error) {
return false, nil
}
- strategy, err := e.DetermineControllerStrategy(t.Ctx, t.Client)
+ strategy, err := e.DetermineControllerStrategy()
if err != nil {
e.Integration.Status.SetErrorCondition(
v1.IntegrationConditionKnativeServiceAvailable,
diff --git a/pkg/trait/prometheus.go b/pkg/trait/prometheus.go
index 03b89f7..9beeb2c 100644
--- a/pkg/trait/prometheus.go
+++ b/pkg/trait/prometheus.go
@@ -123,7 +123,7 @@ func (t *prometheusTrait) Apply(e *Environment) (err error) {
// Configure the Prometheus container port
containerPort := t.getContainerPort()
- controller, err := e.DetermineControllerStrategy(t.Ctx, t.Client)
+ controller, err := e.DetermineControllerStrategy()
if err != nil {
return err
}
diff --git a/pkg/trait/trait_types.go b/pkg/trait/trait_types.go
index e3c8c46..6352c7a 100644
--- a/pkg/trait/trait_types.go
+++ b/pkg/trait/trait_types.go
@@ -28,8 +28,6 @@ import (
"github.com/apache/camel-k/pkg/util"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
- controller "sigs.k8s.io/controller-runtime/pkg/client"
-
"k8s.io/apimachinery/pkg/runtime"
v1 "github.com/apache/camel-k/pkg/apis/camel/v1"
@@ -298,7 +296,7 @@ func (e *Environment) DetermineProfile() v1.TraitProfile {
}
// DetermineControllerStrategy determines the type of controller that should be used for the integration
-func (e *Environment) DetermineControllerStrategy(ctx context.Context, c controller.Reader) (ControllerStrategy, error) {
+func (e *Environment) DetermineControllerStrategy() (ControllerStrategy, error) {
defaultStrategy := DefaultControllerStrategy
for _, creator := range e.getControllerStrategyChoosers() {
if strategy, err := creator.SelectControllerStrategy(e); err != nil {
[camel-k] 01/04: chore: Remove deployer traits member leftovers
Posted by as...@apache.org.
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 ce2fa65a51b1ec8b839e2774e91722ac44f09c19
Author: Antonin Stefanutti <an...@stefanutti.fr>
AuthorDate: Tue Jun 2 15:21:53 2020 +0200
chore: Remove deployer traits member leftovers
---
pkg/trait/cron.go | 7 +------
pkg/trait/deployment.go | 17 +----------------
pkg/trait/deployment_test.go | 1 -
3 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/pkg/trait/cron.go b/pkg/trait/cron.go
index 853e682..98707f4 100644
--- a/pkg/trait/cron.go
+++ b/pkg/trait/cron.go
@@ -75,8 +75,7 @@ type cronTrait struct {
//
// It's 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).
- Auto *bool `property:"auto"`
- deployer deployerTrait
+ Auto *bool `property:"auto"`
}
var _ ControllerStrategySelector = &cronTrait{}
@@ -180,10 +179,6 @@ func (t *cronTrait) Configure(e *Environment) (bool, error) {
}
}
}
- dt := e.Catalog.GetTrait("deployer")
- if dt != nil {
- t.deployer = *dt.(*deployerTrait)
- }
// Fallback strategy can be implemented in any other controller
if t.Fallback != nil && *t.Fallback {
diff --git a/pkg/trait/deployment.go b/pkg/trait/deployment.go
index 088a721..985fd97 100644
--- a/pkg/trait/deployment.go
+++ b/pkg/trait/deployment.go
@@ -33,7 +33,6 @@ import (
// +camel-k:trait=deployment
type deploymentTrait struct {
BaseTrait `property:",squash"`
- deployer deployerTrait
}
var _ ControllerStrategySelector = &deploymentTrait{}
@@ -85,15 +84,7 @@ func (t *deploymentTrait) Configure(e *Environment) (bool, error) {
return false, nil
}
- enabled := e.IntegrationInPhase(v1.IntegrationPhaseDeploying)
- if enabled {
- dt := e.Catalog.GetTrait("deployer")
- if dt != nil {
- t.deployer = *dt.(*deployerTrait)
- }
- }
-
- return enabled, nil
+ return e.IntegrationInPhase(v1.IntegrationPhaseDeploying), nil
}
func (t *deploymentTrait) SelectControllerStrategy(e *Environment) (*ControllerStrategy, error) {
@@ -146,12 +137,6 @@ func (t *deploymentTrait) IsPlatformTrait() bool {
return true
}
-// **********************************
-//
-// Deployment
-//
-// **********************************
-
func (t *deploymentTrait) getDeploymentFor(e *Environment) *appsv1.Deployment {
// create a copy to avoid sharing the underlying annotation map
annotations := make(map[string]string)
diff --git a/pkg/trait/deployment_test.go b/pkg/trait/deployment_test.go
index a20293f..9798e72 100644
--- a/pkg/trait/deployment_test.go
+++ b/pkg/trait/deployment_test.go
@@ -68,7 +68,6 @@ func TestConfigureDeploymentTraitDoesSucceed(t *testing.T) {
assert.Nil(t, err)
assert.True(t, configured)
- assert.NotNil(t, deploymentTrait.deployer)
}
func TestConfigureDeploymentTraitWhileBuildingKitDoesNotSucceed(t *testing.T) {