Skip to content

Commit

Permalink
EES-4696 - Updating log levels for controller and proxy (#78)
Browse files Browse the repository at this point in the history
* Updating log levels for controller and proxy

* updating chart version

* update cluster role name to conform to Kubernetes naming requirements
  • Loading branch information
s-radyuk authored Dec 1, 2020
1 parent 7d81181 commit 46a6f35
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion charts/kangal/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- performance tests
- tests runner
name: kangal
version: 1.4.2
version: 1.4.3
home: https://github.com/hellofresh/kangal
icon: https://raw.githubusercontent.com/hellofresh/kangal/master/kangal_logo.svg
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/kangal/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: ClusterRole
metadata:
labels:
kubernetes.io/bootstrapping: rbac-defaults
name: system:controller:kangal-controller:{{ $.Release.Namespace }}
name: system-controller-kangal-controller-{{ $.Release.Namespace }}
rules:

- apiGroups:
Expand Down
2 changes: 1 addition & 1 deletion charts/kangal/templates/clusterrolebinding.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: system:controller:kangal-controller:{{ $.Release.Namespace }}
name: system-controller-kangal-controller-{{ $.Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
Expand Down
2 changes: 1 addition & 1 deletion charts/kangal/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ proxy:
# Health check
livenessProbe:
httpGet:
path: /
path: /status
port: http
initialDelaySeconds: 15
periodSeconds: 10
Expand Down
4 changes: 2 additions & 2 deletions pkg/controller/loadtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ func (c *Controller) processNextWorkItem() bool {
// Finally, if no error occurs we Forget this item so it does not
// get queued again until another change happens.
c.workQueue.Forget(obj)
c.logger.Info("Successfully synced", zap.String("loadTest", key))
c.logger.Debug("Successfully synced", zap.String("loadTest", key))
return nil
}(obj)

Expand Down Expand Up @@ -390,7 +390,7 @@ func (c *Controller) handleObject(obj interface{}) {
c.logger.Debug("Processing object", zap.String("loadtest", object.GetName()))
foo, err := c.loadtestsLister.Get(ownerRef.Name)
if err != nil {
c.logger.Info("ignoring orphaned object", zap.String("loadtest", object.GetSelfLink()),
c.logger.Debug("ignoring orphaned object", zap.String("loadtest", object.GetSelfLink()),
zap.String("object_owner", ownerRef.Name))
return
}
Expand Down
14 changes: 5 additions & 9 deletions pkg/core/middleware/request_logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import (
"go.uber.org/zap"
)

var static = [...]string{".css", ".js", ".png", ".jpg", ".jpeg", ".ico"}

// RequestLogger is a struct for logging request
type RequestLogger struct{}

Expand Down Expand Up @@ -39,7 +37,7 @@ func (m *RequestLogger) Handler(next http.Handler) http.Handler {
zap.String("duration-fmt", m.Duration.String()),
)

if IsStaticRequest(r) {
if IsStatusRequest(r) {
logEntry.Debug("Finished serving request")
return
}
Expand All @@ -48,12 +46,10 @@ func (m *RequestLogger) Handler(next http.Handler) http.Handler {
})
}

// IsStaticRequest checks extension suffix
func IsStaticRequest(r *http.Request) bool {
for _, ext := range static {
if strings.HasSuffix(r.URL.Path, ext) {
return true
}
// IsStatusRequest checks if the request is a health check request
func IsStatusRequest(r *http.Request) bool {
if strings.HasSuffix(r.URL.Path, "status") {
return true
}

return false
Expand Down

0 comments on commit 46a6f35

Please sign in to comment.