Skip to content

Commit

Permalink
[release-1.15] Add observedGeneration in JobSink OpenAPI schema (#8299)
Browse files Browse the repository at this point in the history
Add observedGeneration in JobSink OpenAPI schema

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Co-authored-by: Pierangelo Di Pilato <[email protected]>
  • Loading branch information
knative-prow-robot and pierDipi authored Nov 4, 2024
1 parent 19e4c4b commit 6ccaa08
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
4 changes: 4 additions & 0 deletions config/core/resources/jobsink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ spec:
name:
description: The name of the applied EventPolicy
type: string
observedGeneration:
description: ObservedGeneration is the 'Generation' of the Service that was last processed by the controller.
type: integer
format: int64
conditions:
description: Conditions the latest available observations of a resource's current state.
type: array
Expand Down
40 changes: 36 additions & 4 deletions pkg/reconciler/jobsink/jobsink_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import (
utilrand "k8s.io/apimachinery/pkg/util/rand"
clientgotesting "k8s.io/client-go/testing"
"k8s.io/utils/ptr"
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
. "knative.dev/eventing/pkg/reconciler/testing/v1"
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
"knative.dev/pkg/apis"
duckv1 "knative.dev/pkg/apis/duck/v1"
v1 "knative.dev/pkg/client/injection/ducks/duck/v1/addressable"
Expand All @@ -40,6 +36,12 @@ import (
logtesting "knative.dev/pkg/logging/testing"
"knative.dev/pkg/network"
. "knative.dev/pkg/reconciler/testing"

"knative.dev/eventing/pkg/apis/sinks/v1alpha1"
fakeeventingclient "knative.dev/eventing/pkg/client/injection/client/fake"
jobsinkreconciler "knative.dev/eventing/pkg/client/injection/reconciler/sinks/v1alpha1/jobsink"
. "knative.dev/eventing/pkg/reconciler/testing/v1"
. "knative.dev/eventing/pkg/reconciler/testing/v1alpha1"
)

const (
Expand Down Expand Up @@ -198,6 +200,36 @@ func TestReconcile(t *testing.T) {
},
},
},
{
Name: "Successful reconciliation, observed generation",
Key: testKey,
Objects: []runtime.Object{
NewJobSink(jobSinkName, testNamespace,
func(sink *v1alpha1.JobSink) {
sink.Generation = 4242
},
WithJobSinkJob(testJob("")),
WithInitJobSinkConditions),
},
WantErr: false,
WantCreates: []runtime.Object{
testJob("test-jobSinkml6mm"),
},
WantStatusUpdates: []clientgotesting.UpdateActionImpl{
{
Object: NewJobSink(jobSinkName, testNamespace,
WithJobSinkJob(testJob("")),
WithJobSinkAddressableReady(),
WithJobSinkJobStatusSelector(),
WithJobSinkAddress(&jobSinkAddressable),
func(sink *v1alpha1.JobSink) {
sink.Generation = 4242
sink.Status.ObservedGeneration = 4242
},
WithJobSinkEventPoliciesReadyBecauseOIDCDisabled()),
},
},
},
}

logger := logtesting.TestLogger(t)
Expand Down

0 comments on commit 6ccaa08

Please sign in to comment.