Commit 2cbbae02 authored by Edmund Ochieng's avatar Edmund Ochieng

incorporate checksum in runner configmaps

parent 51854ad5
......@@ -70,5 +70,8 @@ func GetConfigMap(cr *gitlabv1beta1.Runner) *corev1.ConfigMap {
"configure": configureScript,
}
// update configmap with checksum in annotation
gitlabutils.ConfigMapWithHash(runnerConfigMap)
return runnerConfigMap
}
......@@ -284,12 +284,12 @@ func GetDeploymentPods(kclient client.Client, name, namespace string) (result []
return result, err
}
// ConfigMapWithHash returns configmap with
// ConfigMapWithHash updates configmap with
// annotation containing a SHA256 hash of its data
func ConfigMapWithHash(cm *corev1.ConfigMap) (*corev1.ConfigMap, error) {
func ConfigMapWithHash(cm *corev1.ConfigMap) {
jdata, err := json.Marshal(cm.Data)
if err != nil {
return nil, err
return
}
hash := sha256.Sum256(jdata)
......@@ -297,6 +297,4 @@ func ConfigMapWithHash(cm *corev1.ConfigMap) (*corev1.ConfigMap, error) {
cm.Annotations = map[string]string{
"checksum": hex.EncodeToString(hash[:]),
}
return cm, nil
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment