From 063ee1df526c871257cfc6c0a659b34cc93bb33b Mon Sep 17 00:00:00 2001 From: Jean Poizat Date: Thu, 7 Dec 2017 15:20:57 +0000 Subject: [PATCH] Add Sha256 sum instead of full onfigmap in convertConfigMapToToken --- controller/controller.go | 9 ++++++--- version/VERSION | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/controller/controller.go b/controller/controller.go index c064cd28..5f4e28f6 100644 --- a/controller/controller.go +++ b/controller/controller.go @@ -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" @@ -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 { diff --git a/version/VERSION b/version/VERSION index 1ba605fd..b001d235 100644 --- a/version/VERSION +++ b/version/VERSION @@ -1 +1 @@ -2.3.11 \ No newline at end of file +2.3.12