Skip to content

Commit 71a6c9f

Browse files
authored
fix: EventTransform not updating when expression changes (#8848)
1 parent 45c284b commit 71a6c9f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

pkg/reconciler/eventtransform/eventtransform_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ func TestReconcile(t *testing.T) {
13391339
},
13401340
})
13411341

1342-
d.Annotations[JsonataCertificateRevisionKey] = "1"
1342+
d.Spec.Template.Annotations[JsonataCertificateRevisionKey] = "1"
13431343
}),
13441344
&corev1.Endpoints{
13451345
ObjectMeta: metav1.ObjectMeta{
@@ -1552,7 +1552,7 @@ func TestReconcile(t *testing.T) {
15521552
},
15531553
})
15541554

1555-
d.Annotations[JsonataCertificateRevisionKey] = "1"
1555+
d.Spec.Template.Annotations[JsonataCertificateRevisionKey] = "1"
15561556
}),
15571557
&corev1.Endpoints{
15581558
ObjectMeta: metav1.ObjectMeta{
@@ -1942,7 +1942,7 @@ func TestReconcile(t *testing.T) {
19421942
},
19431943
})
19441944

1945-
d.Annotations[JsonataCertificateRevisionKey] = "1"
1945+
d.Spec.Template.Annotations[JsonataCertificateRevisionKey] = "1"
19461946
}),
19471947
&corev1.Endpoints{
19481948
ObjectMeta: metav1.ObjectMeta{

pkg/reconciler/eventtransform/resources_jsonata.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,9 @@ func jsonataDeployment(ctx context.Context, withCombinedTrustBundle bool, cw *re
9292

9393
d := appsv1.Deployment{
9494
ObjectMeta: metav1.ObjectMeta{
95-
Name: kmeta.ChildName(transform.Name, JsonataResourcesNameSuffix),
96-
Namespace: transform.GetNamespace(),
97-
Labels: jsonataLabels(transform),
98-
Annotations: make(map[string]string, 2),
95+
Name: kmeta.ChildName(transform.Name, JsonataResourcesNameSuffix),
96+
Namespace: transform.GetNamespace(),
97+
Labels: jsonataLabels(transform),
9998
OwnerReferences: []metav1.OwnerReference{
10099
*kmeta.NewControllerRef(transform),
101100
},
@@ -114,6 +113,7 @@ func jsonataDeployment(ctx context.Context, withCombinedTrustBundle bool, cw *re
114113
JsonataResourcesLabelKey: JsonataResourcesLabelValue,
115114
NameLabelKey: transform.GetName(),
116115
},
116+
Annotations: make(map[string]string),
117117
},
118118
Spec: corev1.PodSpec{
119119
Containers: []corev1.Container{
@@ -269,11 +269,11 @@ func jsonataDeployment(ctx context.Context, withCombinedTrustBundle bool, cw *re
269269

270270
// hashPayload annotation is used to detect and roll out a new deployment when expressions change.
271271
hash := sha256.Sum256([]byte(hashPayload))
272-
d.Annotations[JsonataExpressionHashKey] = base64.StdEncoding.EncodeToString(hash[:])
272+
d.Spec.Template.Annotations[JsonataExpressionHashKey] = base64.StdEncoding.EncodeToString(hash[:])
273273

274274
if certificate != nil && certificate.Status.Revision != nil {
275275
// certificate revision annotation is used to detect and roll out a new deployment when certificates change.
276-
d.Annotations[JsonataCertificateRevisionKey] = fmt.Sprintf("%d", *certificate.Status.Revision)
276+
d.Spec.Template.Annotations[JsonataCertificateRevisionKey] = fmt.Sprintf("%d", *certificate.Status.Revision)
277277
}
278278

279279
if feature.FromContext(ctx).IsStrictTransportEncryption() {

0 commit comments

Comments
 (0)