Skip to content

Commit d0c035b

Browse files
[release-1.16] Add observedGeneration in JobSink OpenAPI schema (#8300)
Add observedGeneration in JobSink OpenAPI schema Signed-off-by: Pierangelo Di Pilato <[email protected]> Co-authored-by: Pierangelo Di Pilato <[email protected]>
1 parent 6db9011 commit d0c035b

File tree

2 files changed

+40
-4
lines changed

2 files changed

+40
-4
lines changed

Diff for: config/core/resources/jobsink.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ spec:
9494
name:
9595
description: The name of the applied EventPolicy
9696
type: string
97+
observedGeneration:
98+
description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
99+
type: integer
100+
format: int64
97101
conditions:
98102
description: Conditions the latest available observations of a resource's current state.
99103
type: array

Diff for: pkg/reconciler/jobsink/jobsink_test.go

+36-4
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ import (
2828
utilrand "k8s.io/apimachinery/pkg/util/rand"
2929
clientgotesting "k8s.io/client-go/testing"
3030
"k8s.io/utils/ptr"
31-
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
32-
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
33-
. "knative.dev/eventing/pkg/reconciler/testing/v1"
34-
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
3531
"knative.dev/pkg/apis"
3632
duckv1 "knative.dev/pkg/apis/duck/v1"
3733
v1 "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
@@ -40,6 +36,12 @@ import (
4036
logtesting "knative.dev/pkg/logging/testing"
4137
"knative.dev/pkg/network"
4238
. "knative.dev/pkg/reconciler/testing"
39+
40+
"knative.dev/eventing/pkg/apis/sinks/v1alpha1"
41+
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
42+
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
43+
. "knative.dev/eventing/pkg/reconciler/testing/v1"
44+
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
4345
)
4446

4547
const (
@@ -198,6 +200,36 @@ func TestReconcile(t *testing.T) {
198200
},
199201
},
200202
},
203+
{
204+
Name: "Successful reconciliation, observed generation",
205+
Key: testKey,
206+
Objects: []runtime.Object{
207+
NewJobSink(jobSinkName, testNamespace,
208+
func(sink *v1alpha1.JobSink) {
209+
sink.Generation = 4242
210+
},
211+
WithJobSinkJob(testJob("")),
212+
WithInitJobSinkConditions),
213+
},
214+
WantErr: false,
215+
WantCreates: []runtime.Object{
216+
testJob("test-jobSinkml6mm"),
217+
},
218+
WantStatusUpdates: []clientgotesting.UpdateActionImpl{
219+
{
220+
Object: NewJobSink(jobSinkName, testNamespace,
221+
WithJobSinkJob(testJob("")),
222+
WithJobSinkAddressableReady(),
223+
WithJobSinkJobStatusSelector(),
224+
WithJobSinkAddress(&jobSinkAddressable),
225+
func(sink *v1alpha1.JobSink) {
226+
sink.Generation = 4242
227+
sink.Status.ObservedGeneration = 4242
228+
},
229+
WithJobSinkEventPoliciesReadyBecauseOIDCDisabled()),
230+
},
231+
},
232+
},
201233
}
202234

203235
logger := logtesting.TestLogger(t)

0 commit comments

Comments
 (0)