@@ -46,6 +46,9 @@ type ClusterReconciler struct {
4646const (
4747 // HashAnnotation ...
4848 HashAnnotation = "registry.ethos.adobe.com/hash"
49+
50+ // SkipCacheInvalidationAnnotation ...
51+ SkipCacheInvalidationAnnotation = "registry.ethos.adobe.com/skip-cache-invalidation"
4952)
5053
5154//+kubebuilder:rbac:groups=registry.ethos.adobe.com,resources=clusters,verbs=get;list;watch;create;update;patch;delete
@@ -89,10 +92,18 @@ func (r *ClusterReconciler) ReconcileCreateUpdate(instance *registryv1.Cluster,
8992 if annotations == nil {
9093 annotations = make (map [string ]string , 1 )
9194 }
95+
9296 annotations [HashAnnotation ] = hash
97+
98+ skipCacheInvalidation := false
99+ if _ , ok := annotations [SkipCacheInvalidationAnnotation ]; ok {
100+ delete (annotations , SkipCacheInvalidationAnnotation )
101+ skipCacheInvalidation = true
102+ }
103+
93104 instance .SetAnnotations (annotations )
94105
95- err := r .enqueue (instance )
106+ err := r .enqueue (instance , skipCacheInvalidation )
96107 if err != nil {
97108 r .Log .Error (err , "error enqueuing message" )
98109 return ctrl.Result {}, err
@@ -132,7 +143,7 @@ func (r *ClusterReconciler) eventFilters() predicate.Predicate {
132143 }
133144}
134145
135- func (r * ClusterReconciler ) enqueue (instance * registryv1.Cluster ) error {
146+ func (r * ClusterReconciler ) enqueue (instance * registryv1.Cluster , skipCacheInvalidation bool ) error {
136147 ctx , cancel := context .WithTimeout (context .Background (), 10 * time .Second )
137148 defer cancel ()
138149
@@ -160,6 +171,10 @@ func (r *ClusterReconciler) enqueue(instance *registryv1.Cluster) error {
160171 DataType : aws .String ("String" ),
161172 StringValue : aws .String (instance .Spec .Name ),
162173 },
174+ "SkipCacheInvalidation" : {
175+ DataType : aws .String ("String" ),
176+ StringValue : aws .String (fmt .Sprintf ("%t" , skipCacheInvalidation )),
177+ },
163178 },
164179 MessageBody : aws .String (string (obj )),
165180 },
@@ -182,12 +197,13 @@ func (r *ClusterReconciler) SetupWithManager(mgr ctrl.Manager) error {
182197}
183198
184199// hashCluster returns a SHA256 hash of the Cluster object, after removing the ResourceVersion,
185- // ManagedFields and hashCluster annotation
200+ // ManagedFields and hash/no-cache annotation
186201func hashCluster (instance * registryv1.Cluster ) string {
187202 clone := instance .DeepCopyObject ().(* registryv1.Cluster )
188203
189204 annotations := clone .GetAnnotations ()
190205 delete (annotations , HashAnnotation )
206+ delete (annotations , SkipCacheInvalidationAnnotation )
191207 clone .SetAnnotations (annotations )
192208
193209 clone .SetResourceVersion ("" )
0 commit comments