Skip to content

Commit

Permalink
PingSource stored version is now v1 (#5381)
Browse files Browse the repository at this point in the history
* PingSource stored version is now v1

* rekt now create v1 PingSource objects
  • Loading branch information
lionelvillard committed May 18, 2021
1 parent 6addb58 commit 62a75eb
Show file tree
Hide file tree
Showing 23 changed files with 204 additions and 466 deletions.
82 changes: 0 additions & 82 deletions cmd/v0.22/pingsource-cleanup/README.md

This file was deleted.

43 changes: 0 additions & 43 deletions cmd/v0.22/pingsource-cleanup/injection.go

This file was deleted.

92 changes: 0 additions & 92 deletions cmd/v0.22/pingsource-cleanup/main.go

This file was deleted.

4 changes: 2 additions & 2 deletions config/core/resources/pingsource.yaml
Expand Up @@ -33,7 +33,7 @@ spec:
- &version
name: v1beta2
served: true
storage: true
storage: false
subresources:
status: {}
schema:
Expand Down Expand Up @@ -196,7 +196,7 @@ spec:
- <<: *version
name: v1
served: true
storage: false
storage: true
# v1 schema is identical to the v1beta2 schema
names:
categories:
Expand Down
42 changes: 0 additions & 42 deletions config/post-install/pingsource-cleanup.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion config/post-install/storage-version-migrator.yaml
Expand Up @@ -20,7 +20,7 @@ metadata:
#
# If `ttlSecondsAfterFinished` feature gate becomes generally available in the future,
# we can rely on that and keep using the same Job name.
name: v0.21-storage-version-migration
name: v0.23-storage-version-migration
namespace: knative-eventing
labels:
app: "storage-version-migration"
Expand Down
6 changes: 3 additions & 3 deletions pkg/adapter/mtping/adapter.go
Expand Up @@ -32,7 +32,7 @@ import (
"knative.dev/pkg/logging"

"knative.dev/eventing/pkg/adapter/v2"
v1beta2 "knative.dev/eventing/pkg/apis/sources/v1beta2"
sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1"
)

const (
Expand Down Expand Up @@ -93,7 +93,7 @@ func GetNoShutDownAfterValue() int {

// Implements MTAdapter

func (a *mtpingAdapter) Update(ctx context.Context, source *v1beta2.PingSource) {
func (a *mtpingAdapter) Update(ctx context.Context, source *sourcesv1.PingSource) {
logging.FromContext(ctx).Info("Synchronizing schedule")

key := fmt.Sprintf("%s/%s", source.Namespace, source.Name)
Expand All @@ -113,7 +113,7 @@ func (a *mtpingAdapter) Update(ctx context.Context, source *v1beta2.PingSource)
a.entryidMu.Unlock()
}

func (a *mtpingAdapter) Remove(source *v1beta2.PingSource) {
func (a *mtpingAdapter) Remove(source *sourcesv1.PingSource) {
key := fmt.Sprintf("%s/%s", source.Namespace, source.Name)

a.entryidMu.RLock()
Expand Down
8 changes: 4 additions & 4 deletions pkg/adapter/mtping/adapter_test.go
Expand Up @@ -24,7 +24,7 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"knative.dev/eventing/pkg/apis/sources/v1beta2"
sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1"

"github.com/robfig/cron/v3"

Expand Down Expand Up @@ -70,7 +70,7 @@ func TestUpdateRemoveAdapter(t *testing.T) {
entryids: make(map[string]cron.EntryID),
}

adapter.Update(ctx, &v1beta2.PingSource{
adapter.Update(ctx, &sourcesv1.PingSource{
ObjectMeta: metav1.ObjectMeta{
Name: "test-name",
Namespace: "test-ns",
Expand All @@ -81,7 +81,7 @@ func TestUpdateRemoveAdapter(t *testing.T) {
t.Error(`Expected cron entries to contain "test-ns/test-name"`)
}

adapter.Remove(&v1beta2.PingSource{
adapter.Remove(&sourcesv1.PingSource{
ObjectMeta: metav1.ObjectMeta{
Name: "test-name",
Namespace: "test-ns",
Expand All @@ -96,7 +96,7 @@ type testRunner struct {
CronJobRunner
}

func (*testRunner) AddSchedule(*v1beta2.PingSource) cron.EntryID {
func (*testRunner) AddSchedule(*sourcesv1.PingSource) cron.EntryID {
return cron.EntryID(1)
}
func (*testRunner) RemoveSchedule(cron.EntryID) {}
10 changes: 5 additions & 5 deletions pkg/adapter/mtping/controller.go
Expand Up @@ -22,9 +22,9 @@ import (
"k8s.io/client-go/tools/cache"

"knative.dev/eventing/pkg/adapter/v2"
"knative.dev/eventing/pkg/apis/sources/v1beta2"
pingsourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1beta2/pingsource"
pingsourcereconciler "knative.dev/eventing/pkg/client/injection/reconciler/sources/v1beta2/pingsource"
sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1"
pingsourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1/pingsource"
pingsourcereconciler "knative.dev/eventing/pkg/client/injection/reconciler/sources/v1/pingsource"
"knative.dev/pkg/controller"
"knative.dev/pkg/logging"
"knative.dev/pkg/reconciler"
Expand All @@ -35,10 +35,10 @@ import (
// MTAdapter is the interface the multi-tenant PingSource adapter must implement
type MTAdapter interface {
// Update is called when the source is ready and when the specification and/or status has changed.
Update(ctx context.Context, source *v1beta2.PingSource)
Update(ctx context.Context, source *sourcesv1.PingSource)

// Remove is called when the source has been deleted.
Remove(source *v1beta2.PingSource)
Remove(source *sourcesv1.PingSource)

// RemoveAll is called when the adapter stopped leading
RemoveAll(ctx context.Context)
Expand Down

0 comments on commit 62a75eb

Please sign in to comment.