Skip to content
This repository has been archived by the owner on Jun 19, 2022. It is now read-only.

Commit

Permalink
Create pkg/duck/{v1alpha1,v1beta1} (#811)
Browse files Browse the repository at this point in the history
* Move pkg/duck to pkg/duck/v1alpha1.

* Create v1beta1 and change package name.
  • Loading branch information
Harwayne authored Apr 13, 2020
1 parent 7c2ed1f commit f0945e7
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/cloudauditlogssource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import (
"knative.dev/pkg/webhook/resourcesemantics"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
kngcpduck "github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
duckv1 "knative.dev/pkg/apis/duck/v1"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/cloudbuildsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"fmt"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
kngcpduck "github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis/duck"
"knative.dev/pkg/kmeta"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/cloudpubsubsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"time"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
kngcpduck "github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis/duck"
"knative.dev/pkg/kmeta"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/cloudschedulersource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
kngcpduck "github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck"
duckv1 "knative.dev/pkg/apis/duck/v1"
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/events/v1alpha1/cloudstoragesource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
kngcpduck "github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
"knative.dev/pkg/apis"
"knative.dev/pkg/apis/duck"
duckv1 "knative.dev/pkg/apis/duck/v1"
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/messaging/v1alpha1/channel_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"knative.dev/pkg/webhook/resourcesemantics"

duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
"github.com/google/knative-gcp/pkg/duck"
kngcpduck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
)

// +genclient
Expand Down Expand Up @@ -55,7 +55,7 @@ var (
_ apis.Defaultable = (*Channel)(nil)
_ runtime.Object = (*Channel)(nil)
_ resourcesemantics.GenericCRD = (*Channel)(nil)
_ duck.Identifiable = (*Channel)(nil)
_ kngcpduck.Identifiable = (*Channel)(nil)
)

// ChannelSpec defines which subscribers have expressed interest in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package duck
package v1alpha1

import (
"knative.dev/pkg/apis"
Expand Down
2 changes: 1 addition & 1 deletion pkg/duck/pubsubable.go → pkg/duck/v1alpha1/pubsubable.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package duck
package v1alpha1

import (
duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
Expand Down
34 changes: 34 additions & 0 deletions pkg/duck/v1beta1/identifiable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
Copyright 2020 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

import (
"knative.dev/pkg/apis"
"knative.dev/pkg/kmeta"

duckv1beta1 "github.com/google/knative-gcp/pkg/apis/duck/v1beta1"
)

type Identifiable interface {
kmeta.OwnerRefable
// IdentitySpec returns the IdentitySpec portion of the Spec.
IdentitySpec() *duckv1beta1.IdentitySpec
// IdentityStatus returns the IdentityStatus portion of the Status.
IdentityStatus() *duckv1beta1.IdentityStatus
// ConditionSet returns the apis.ConditionSet of the embedding object
ConditionSet() *apis.ConditionSet
}
31 changes: 31 additions & 0 deletions pkg/duck/v1beta1/pubsubable.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
Copyright 2019 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1beta1

import (
duckv1beta1 "github.com/google/knative-gcp/pkg/apis/duck/v1beta1"
)

// PubSubable is an interface that each duckv1beta1.PubSub duck type must
// support in order to get reconciled properly in a generic way.
type PubSubable interface {
Identifiable
// PubSubSpec returns the PubSubSpec portion of the Spec.
PubSubSpec() *duckv1beta1.PubSubSpec
// PubSubStatus returns the PubSubStatus portion of the Status.
PubSubStatus() *duckv1beta1.PubSubStatus
}
2 changes: 1 addition & 1 deletion pkg/reconciler/identity/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import (
"knative.dev/pkg/logging"
"knative.dev/pkg/ptr"

"github.com/google/knative-gcp/pkg/duck"
duck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
"github.com/google/knative-gcp/pkg/reconciler/identity/resources"
"github.com/google/knative-gcp/pkg/utils"
)
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/pubsub/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
duckv1alpha1 "github.com/google/knative-gcp/pkg/apis/duck/v1alpha1"
pubsubv1alpha1 "github.com/google/knative-gcp/pkg/apis/pubsub/v1alpha1"
clientset "github.com/google/knative-gcp/pkg/client/clientset/versioned"
"github.com/google/knative-gcp/pkg/duck"
duck "github.com/google/knative-gcp/pkg/duck/v1alpha1"
"github.com/google/knative-gcp/pkg/reconciler"
"github.com/google/knative-gcp/pkg/reconciler/pubsub/resources"
"go.uber.org/zap"
Expand Down

0 comments on commit f0945e7

Please sign in to comment.