Merge pull request #60 from stakater/fix-config-change-logs-issue

fix-config-change-logs-issue
This commit is contained in:
Ali Kahoot
2019-04-25 14:55:07 +05:00
committed by GitHub
3 changed files with 3 additions and 4 deletions
-1
View File
@@ -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)
}
+1 -2
View File
@@ -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)
}
+2 -1
View File
@@ -97,6 +97,7 @@ 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("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)
}
}
@@ -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