Skip to content

Commit

Permalink
Merge pull request #13 from jpoizat/master
Browse files Browse the repository at this point in the history
Add Sha256 sum instead of full configmap in convertConfigMapToToken
  • Loading branch information
rhuss authored Jan 14, 2019
2 parents 9c02368 + 063ee1d commit 3619145
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 6 additions & 3 deletions controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"

"crypto/sha256"
"encoding/base64"
"sort"

oclient "github.com/openshift/origin/pkg/client"
Expand Down Expand Up @@ -224,9 +226,10 @@ func convertConfigMapToToken(cm *api.ConfigMap) string {
}
sort.Strings(values)
text := strings.Join(values, ";")
// we could zip and base64 encode
// but for now we could leave this easy to read so that its easier to diagnose when & why things changed
return text
hasher := sha256.New()
hasher.Write([]byte(text))
sha := base64.URLEncoding.EncodeToString(hasher.Sum(nil))
return sha
}

func updateContainers(containers []api.Container, annotationValue, configMapVersion string) bool {
Expand Down
2 changes: 1 addition & 1 deletion version/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.11
2.3.12

0 comments on commit 3619145

Please sign in to comment.