Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize logging in reloader #19

Merged
merged 5 commits into from
Aug 2, 2018
Merged

Optimize logging in reloader #19

merged 5 commits into from
Aug 2, 2018

Conversation

faizanahmad055
Copy link
Contributor

This PR handles the issue 16

@stakater-user
Copy link
Contributor

@faizanahmad055 Yikes! You better fix it before anyone else finds out! Build 1 has Failed!

@stakater-user
Copy link
Contributor

@faizanahmad055 Yikes! You better fix it before anyone else finds out! Build 2 has Failed!

@stakater-user
Copy link
Contributor

@faizanahmad055 Image is available for testing. docker pull stakater/reloader:PR-19-3

} else {
logrus.Warnf("Invalid resource: Resource should be 'Secret' or 'Configmap' but found, %v", r.Resource)
}
logrus.Errorf("Create Handler received nil object")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is create handler @faizanahmad055 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it to Resource creation handler received nil resource . Resource creation handler can handle the creation of new resource (i.e. Secret Or Configmap).

@@ -13,17 +12,7 @@ type ResourceCreatedHandler struct {
// Handle processes the newly created resource
func (r ResourceCreatedHandler) Handle() error {
if r.Resource == nil {
logrus.Errorf("Error in Handler")
} else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did we remove else section? why was it put in first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rasheedamir , Else section was put there to show a log statement that a new resource (i.e. secret or configmap) has been added. But it does not add any value to the reloader functionality because reloader should only show the logs when a resource has been updated.

@@ -112,6 +107,8 @@ func PerformRollingUpgrade(client kubernetes.Interface, config util.Config, enva
var err error
for _, i := range items {
containers := upgradeFuncs.ContainersFunc(i)
resourceName := util.ToObjectMeta(i).Name
logrus.Infof("Changes Detected in %s of type '%s' in namespace: %s", config.ResourceName, envarPostfix, config.Namespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use small "d" for detected

@@ -120,13 +117,13 @@ func PerformRollingUpgrade(client kubernetes.Interface, config util.Config, enva
if value == config.ResourceName {
updated := updateContainers(containers, value, config.SHAValue, envarPostfix)
if !updated {
logrus.Warnf("Rolling upgrade did not happen")
logrus.Warnf("Rolling upgrade did not happen for %s of type %s in namespace: %s", resourceName, upgradeFuncs.ResourceType, config.Namespace)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why didn't it happen? shouldn't we add the reason to make the log more meaningful?

@@ -23,9 +23,8 @@ type ResourceUpdatedHandler struct {
// Handle processes the updated resource
func (r ResourceUpdatedHandler) Handle() error {
if r.Resource == nil || r.OldResource == nil {
logrus.Errorf("Error in Handler")
logrus.Errorf("Update Handler received nil object")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will suggest small "u" for Update

@stakater-user
Copy link
Contributor

@faizanahmad055 Image is available for testing. docker pull stakater/reloader:PR-19-4

@stakater-user
Copy link
Contributor

@faizanahmad055 Image is available for testing. docker pull stakater/reloader:PR-19-5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants