nfs: use hashing function from existing k8sutil package

We have a function to hash a string so let's use it.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2022-01-20 18:16:41 +01:00
1 parent 048190d010
commit 92ada52610
1 file changed
+1 -8
+1 -8
View File
@@ -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