From 92ada526108f8bf93ff1672035725cf23568beff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Han?= Date: Mon, 3 Jan 2022 18:24:38 +0100 Subject: [PATCH] nfs: use hashing function from existing k8sutil package MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a function to hash a string so let's use it. Signed-off-by: Sébastien Han --- pkg/operator/ceph/nfs/nfs.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/pkg/operator/ceph/nfs/nfs.go b/pkg/operator/ceph/nfs/nfs.go index 236140003..2da06a4b8 100644 --- a/pkg/operator/ceph/nfs/nfs.go +++ b/pkg/operator/ceph/nfs/nfs.go @@ -18,7 +18,6 @@ limitations under the License. package nfs import ( - "crypto/sha256" "fmt" "github.com/banzaicloud/k8s-objectmatcher/patch" @@ -215,13 +214,7 @@ func (r *ReconcileCephNFS) createConfigMap(n *cephv1.CephNFS, name string) (stri } } - h := sha256.New() - if _, err := h.Write([]byte(fmt.Sprintf("%v", configMap.Data))); err != nil { - return "", "", errors.Wrapf(err, "failed to get hash of ganesha config map") - } - configHash := fmt.Sprintf("%x", h.Sum(nil)) - - return configMap.Name, configHash, nil + return configMap.Name, k8sutil.Hash(fmt.Sprintf("%v", configMap.Data)), nil } // Down scale the ganesha server