Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release-1.16] Add observedGeneration in JobSink OpenAPI schema #8300

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading