From bfff7104aa513d6f76b56b9894ee3de884d73abc Mon Sep 17 00:00:00 2001 From: irti Date: Thu, 25 Apr 2019 14:11:31 +0500 Subject: [PATCH 1/3] [fix-config-change-logs-issue] logs issue fixed --- internal/pkg/handler/update.go | 3 +-- internal/pkg/handler/upgrade.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/pkg/handler/update.go b/internal/pkg/handler/update.go index 5a51ad4c..543f0ae3 100644 --- a/internal/pkg/handler/update.go +++ b/internal/pkg/handler/update.go @@ -3,7 +3,7 @@ package handler import ( "github.com/sirupsen/logrus" "github.com/stakater/Reloader/internal/pkg/util" - "k8s.io/api/core/v1" + "k8s.io/api/core/v1" ) // ResourceUpdatedHandler contains updated objects @@ -19,7 +19,6 @@ func (r ResourceUpdatedHandler) Handle() error { } else { config, oldSHAData := r.GetConfig() if config.SHAValue != oldSHAData { - logrus.Infof("Changes detected in '%s' of type '%s' in namespace '%s'", config.ResourceName, config.Type, config.Namespace) // process resource based on its type doRollingUpgrade(config) } diff --git a/internal/pkg/handler/upgrade.go b/internal/pkg/handler/upgrade.go index 8c3fb9fa..2333f5db 100644 --- a/internal/pkg/handler/upgrade.go +++ b/internal/pkg/handler/upgrade.go @@ -98,6 +98,7 @@ func PerformRollingUpgrade(client kubernetes.Interface, config util.Config, upgr logrus.Errorf("Update for '%s' of type '%s' in namespace '%s' failed with error %v", resourceName, upgradeFuncs.ResourceType, config.Namespace, err) } else { logrus.Infof("Updated '%s' of type '%s' in namespace '%s'", resourceName, upgradeFuncs.ResourceType, config.Namespace) + logrus.Infof("Changes detected in '%s' of type '%s' in namespace '%s'", config.ResourceName, config.Type, config.Namespace) } } } @@ -177,7 +178,7 @@ func getContainerToUpdate(upgradeFuncs callbacks.RollingUpgradeFuncs, item inter // Get the container with referenced secret or configmap as env var container = getContainerWithEnvReference(containers, config.ResourceName, config.Type) - if container == nil && len(initContainers) > 0 { + if container == nil && len(initContainers) > 0 { container = getContainerWithEnvReference(initContainers, config.ResourceName, config.Type) if container != nil { // if configmap/secret is being used in init container then return the first Pod container to save reloader env From 40aa9955cd16c7dea2a27073d411b70cce30583e Mon Sep 17 00:00:00 2001 From: irti Date: Thu, 25 Apr 2019 14:16:42 +0500 Subject: [PATCH 2/3] [fix-config-change-logs-issue] fixed the issue in create.go file --- internal/pkg/handler/create.go | 1 - 1 file changed, 1 deletion(-) diff --git a/internal/pkg/handler/create.go b/internal/pkg/handler/create.go index 0f3c5ed4..cbfaa7c8 100644 --- a/internal/pkg/handler/create.go +++ b/internal/pkg/handler/create.go @@ -17,7 +17,6 @@ func (r ResourceCreatedHandler) Handle() error { logrus.Errorf("Resource creation handler received nil resource") } else { config, _ := r.GetConfig() - logrus.Infof("Resource '%s' of type '%s' in namespace '%s' has been created", config.ResourceName, config.Type, config.Namespace) // process resource based on its type doRollingUpgrade(config) } From 66f9b07817542cffc8c857b87a9a8d27d83a8a4b Mon Sep 17 00:00:00 2001 From: irti Date: Thu, 25 Apr 2019 14:19:52 +0500 Subject: [PATCH 3/3] [fix-config-change-logs-issue] fixed log statement placement --- internal/pkg/handler/upgrade.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/pkg/handler/upgrade.go b/internal/pkg/handler/upgrade.go index 2333f5db..f2f640e4 100644 --- a/internal/pkg/handler/upgrade.go +++ b/internal/pkg/handler/upgrade.go @@ -97,8 +97,8 @@ func PerformRollingUpgrade(client kubernetes.Interface, config util.Config, upgr if err != nil { logrus.Errorf("Update for '%s' of type '%s' in namespace '%s' failed with error %v", resourceName, upgradeFuncs.ResourceType, config.Namespace, err) } else { - logrus.Infof("Updated '%s' of type '%s' in namespace '%s'", resourceName, upgradeFuncs.ResourceType, config.Namespace) logrus.Infof("Changes detected in '%s' of type '%s' in namespace '%s'", config.ResourceName, config.Type, config.Namespace) + logrus.Infof("Updated '%s' of type '%s' in namespace '%s'", resourceName, upgradeFuncs.ResourceType, config.Namespace) } } }