Skip to content
Snippets Groups Projects
Commit 7d4ceeaf authored by Francisco Borges Aurindo Barros's avatar Francisco Borges Aurindo Barros
Browse files

Merge branch 'clone-label-annotation' into 'master'

Change clone labels to annotations

See merge request !196
parents 6299edce f9cece02
No related branches found
No related tags found
1 merge request!196Change clone labels to annotations
Pipeline #4701818 passed
...@@ -457,7 +457,7 @@ var _ = Describe("DrupalSite controller", func() { ...@@ -457,7 +457,7 @@ var _ = Describe("DrupalSite controller", func() {
By("Expecting the clone labels to be set on the cloned site") By("Expecting the clone labels to be set on the cloned site")
Eventually(func() bool { Eventually(func() bool {
k8sClient.Get(ctx, types.NamespacedName{Name: keyClone.Name, Namespace: keyClone.Namespace}, &cr) k8sClient.Get(ctx, types.NamespacedName{Name: keyClone.Name, Namespace: keyClone.Namespace}, &cr)
return (cr.Labels["clonedFrom"] == key.Name && cr.Labels["clonedOn"] != "") return (cr.Annotations["clonedFrom"] == key.Name && cr.Annotations["clonedOn"] != "")
}, timeout, interval).Should(BeTrue()) }, timeout, interval).Should(BeTrue())
// Check if the cloneFrom field is reset on the drupalSite // Check if the cloneFrom field is reset on the drupalSite
......
...@@ -199,14 +199,14 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web ...@@ -199,14 +199,14 @@ func (r *DrupalSiteReconciler) ensureSpecFinalizer(ctx context.Context, drp *web
update = true update = true
} }
} else { } else {
if drp.Labels == nil { if drp.Annotations == nil {
drp.Labels = map[string]string{} drp.Annotations = map[string]string{}
} }
// Source site name from which the clone was requested // Source site name from which the clone was requested
drp.Labels["clonedFrom"] = string(drp.Spec.Configuration.CloneFrom) drp.Annotations["clonedFrom"] = string(drp.Spec.Configuration.CloneFrom)
// Set the time when the clone was requested // Set the time when the clone was requested
loc, _ := time.LoadLocation("") loc, _ := time.LoadLocation("Europe/Zurich")
drp.Labels["clonedOn"] = time.Now().In(loc).Format("Jan_2_2006_3-04pm_UTC") drp.Annotations["clonedOn"] = time.Now().In(loc).Format("Jan 2 2006 3:04PM CET")
// Reset the `cloneFrom` field // Reset the `cloneFrom` field
drp.Spec.Configuration.CloneFrom = "" drp.Spec.Configuration.CloneFrom = ""
update = true update = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment