Skip to content

Commit

Permalink
Warn on infrastructure-roles.yaml format violations (zalando#177)
Browse files Browse the repository at this point in the history
Emit a warning if there are unprocessed entries in the infrastructure-roles secret.
  • Loading branch information
sdudoladov authored and alexeyklyukin committed Dec 15, 2017
1 parent 5d5fa68 commit 3c178f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions manifests/infrastructure-roles.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
apiVersion: v1
data:
# required format (w/o quotes): 'propertyNumber: value'
# allowed properties: 'user', 'password', 'inrole'
# numbers >= 1 are mandatory

# robot_zmon_acid_monitoring
user1: cm9ib3Rfem1vbl9hY2lkX21vbml0b3Jpbmc=
# robot_zmon
Expand Down
8 changes: 8 additions & 0 deletions pkg/controller/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,21 @@ Users:
c.logger.Warningf("unknown key %q", p)
}
}

delete(data, key)
}

if t.Name != "" {
result[t.Name] = t
}
}

if len(data) != 0 {
c.logger.Warningf("%d unprocessed entries in the infrastructure roles' secret", len(data))
c.logger.Info(`infrastructure role entries should be in the {key}{id} format, where {key} can be either of "user", "password", "inrole" and the {id} a monotonically increasing integer starting with 1`)
c.logger.Debugf("unprocessed entries: %#v", data)
}

return result, nil
}

Expand Down

0 comments on commit 3c178f6

Please sign in to comment.