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

Use the new PullSubscription and Topic CRD #1050

Merged
merged 30 commits into from
May 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
af878a7
Copy the PubSub PullSubscription and Topic controllers.
Harwayne May 1, 2020
b330382
Prefix PullSubscription and Topic functions with PubSub.
Harwayne May 2, 2020
b3eec6e
Listers too.
Harwayne May 2, 2020
1fb95fd
Add the testing methods.
Harwayne May 2, 2020
34066a8
Merge branch 'master' into 905-new-reconcilers
Harwayne May 4, 2020
e969716
Add to webhook.
Harwayne May 4, 2020
ddbccef
Merge branch 'master' into 905-new-reconcilers
Harwayne May 6, 2020
061bcad
Merge branch 'master' into 905-new-reconcilers
Harwayne May 6, 2020
e8c4a54
Add back the reconciler testing helpers, accidentally removed in a pr…
Harwayne May 6, 2020
db5f6c5
Merge branch 'master' into 905-new-reconcilers
Harwayne May 8, 2020
153c166
Merge branch 'master' into 905-new-reconcilers
Harwayne May 8, 2020
d47b8b6
Switch to the intevents API group.
Harwayne May 8, 2020
6138a61
Move generic pubsub reconciler.
Harwayne May 8, 2020
2885d49
Switch PubSubBase to intevents.
Harwayne May 8, 2020
9344191
Switch to the intevents base reconciler.
Harwayne May 8, 2020
ecba4d4
Unit tests.
Harwayne May 8, 2020
76f2fbd
Missed entries.
Harwayne May 8, 2020
330a06e
Readd the pubsub generic reconciler, used only by components in pkg/r…
Harwayne May 8, 2020
0c1ef9f
Merge branch 'master' into 905-new-reconcilers
Harwayne May 8, 2020
66ac06b
Merge branch 'master' into 905-move-to-new-crds
Harwayne May 8, 2020
1c85941
Merge branch 'master' into 905-new-reconcilers
Harwayne May 11, 2020
f237cbf
Copy over the generic pubsub reconciler.
Harwayne May 11, 2020
77ac113
Merge branch '905-new-reconcilers' into 905-move-to-new-crds
Harwayne May 11, 2020
f5c2088
Merge branch 'master' into 905-move-to-new-crds
Harwayne May 12, 2020
0bba6cd
Remove unused listers.
Harwayne May 12, 2020
ff9e50f
Add the new CRD definitions.
Harwayne May 12, 2020
ef1def0
Add to controller.
Harwayne May 12, 2020
8df578f
Switch tests.
Harwayne May 12, 2020
9324a1f
Merge branch 'master' into 905-move-to-new-crds
Harwayne May 12, 2020
6efb2cb
intenal -> internal
Harwayne May 14, 2020
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
12 changes: 9 additions & 3 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,13 @@ import (
"github.com/google/knative-gcp/pkg/reconciler/events/pubsub"
"github.com/google/knative-gcp/pkg/reconciler/events/scheduler"
"github.com/google/knative-gcp/pkg/reconciler/events/storage"
kedapullsubscription "github.com/google/knative-gcp/pkg/reconciler/intevents/pullsubscription/keda"
staticpullsubscription "github.com/google/knative-gcp/pkg/reconciler/intevents/pullsubscription/static"
"github.com/google/knative-gcp/pkg/reconciler/intevents/topic"
"github.com/google/knative-gcp/pkg/reconciler/messaging/channel"
kedapullsubscription "github.com/google/knative-gcp/pkg/reconciler/pubsub/pullsubscription/keda"
staticpullsubscription "github.com/google/knative-gcp/pkg/reconciler/pubsub/pullsubscription/static"
"github.com/google/knative-gcp/pkg/reconciler/pubsub/topic"
pubsubkedapullsubscription "github.com/google/knative-gcp/pkg/reconciler/pubsub/pullsubscription/keda"
pubsubstaticpullsubscription "github.com/google/knative-gcp/pkg/reconciler/pubsub/pullsubscription/static"
pubsubtopic "github.com/google/knative-gcp/pkg/reconciler/pubsub/topic"
"github.com/google/knative-gcp/pkg/utils/appcredentials"
"knative.dev/pkg/injection/sharedmain"
)
Expand All @@ -48,6 +51,9 @@ func main() {
staticpullsubscription.NewController,
kedapullsubscription.NewController,
topic.NewController,
pubsubstaticpullsubscription.NewController,
pubsubkedapullsubscription.NewController,
pubsubtopic.NewController,
channel.NewController,
deployment.NewController,
broker.NewController,
Expand Down
1 change: 1 addition & 0 deletions config/300-old_pullsubscription.yaml
1 change: 1 addition & 0 deletions config/300-old_topic.yaml
194 changes: 194 additions & 0 deletions config/core/resources/old_pullsubscription.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# Copyright 2019 Google LLC
#
# 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.

apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
labels:
events.cloud.google.com/release: devel
events.cloud.google.com/crd-install: "true"
name: pullsubscriptions.pubsub.cloud.google.com
spec:
group: pubsub.cloud.google.com
names:
categories:
- all
- knative
- pubsub
kind: PullSubscription
plural: pullsubscriptions
scope: Namespaced
subresources:
status: {}
preserveUnknownFields: false
conversion:
strategy: Webhook
webhookClientConfig:
service:
name: webhook
namespace: cloud-run-events
additionalPrinterColumns:
- name: Ready
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].status"
- name: Reason
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].reason"
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
versions:
- name: v1alpha1
served: true
storage: true
- name: v1beta1
served: true
storage: false
# All versions happen to have the same schema today. They will likely diverge in the future.
validation:
openAPIV3Schema:
type: object
properties:
spec:
# TODO: update the OpenAPI to be much more robust.
type: object
required:
- sink
- topic
properties:
googleServiceAccount:
type: string
description: "GCP service account used to poll the Cloud Pub/Sub Subscription. The value of the service account must be a valid Google service account (see https://cloud.google.com/iam/docs/service-accounts)."
secret:
type: object
description: "Credential used to poll the Cloud Pub/Sub Subscription. It is not used to create or delete the Subscription, only to poll it. The value of the secret entry must be a service account key in the JSON format (see https://cloud.google.com/iam/docs/creating-managing-service-account-keys). Defaults to secret.name of 'google-cloud-key' and secret.key of 'key.json'."
properties:
name:
type: string
key:
type: string
optional:
type: boolean
project:
type: string
description: "ID of the Google Cloud Project that the Pub/Sub Topic exists in. E.g. 'my-project-1234' rather than its display name, 'My Project' or its number '1234567890'. If omitted uses the Project ID from the GKE cluster metadata service."
sink:
type: object
description: "Reference to an object that will resolve to a domain name to use as the sink."
properties:
uri:
type: string
minLength: 1
ref:
type: object
required:
- apiVersion
- kind
- name
properties:
apiVersion:
type: string
minLength: 1
kind:
type: string
minLength: 1
name:
type: string
minLength: 1
anyOf:
- properties:
uri:
minLength: 1
- properties:
ref: {}
transformer:
type: object
description: "Reference to an object that will resolve to a domain name to use as the transformer."
x-kubernetes-preserve-unknown-fields: true
ceOverrides:
type: object
description: "Defines overrides to control modifications of the event sent to the sink."
properties:
extensions:
type: object
description: "Extensions specify what attribute are added or overridden on the outbound event. Each `Extensions` key-value pair are set on the event as an attribute extension independently."
x-kubernetes-preserve-unknown-fields: true
mode:
type: string
enum: [CloudEventsBinary, CloudEventsStructured, PushCompatible]
description: "Mode defines the encoding and structure of the payload of when this PullSubscription invokes the sink. Default is CloudEventsBinary."
topic:
type: string
description: "ID of the Cloud Pub/Sub Topic to Subscribe to. It must be in the form of the unique identifier within the project, not the entire name. E.g. it must be 'laconia', not 'projects/my-gcp-project/topics/laconia'."
ackDeadline:
type: string
description: "The default maximum time after a subscriber receives a message before the subscriber should acknowledge the message. Defaults to `30s`. Valid time units are `s`, `m`, `h`. The minimum deadline you can specify is 0 seconds. The maximum deadline you can specify is 600 seconds (10 minutes)."
retainAckedMessages:
type: boolean
description: "Whether to retain acknowledged messages. If true, acknowledged messages will not be expunged until they fall out of the RetentionDuration window."
retentionDuration:
type: string
description: "How long to retain messages in backlog, from the time of publish. If retainAckedMessages is true, this duration affects the retention of acknowledged messages, otherwise only unacknowledged messages are retained. Defaults to 7 days (`168h`). Cannot be longer than 7 days or shorter than 10 minutes. Valid time units are `s`, `m`, `h`."
adapterType:
type: string
description: "AdapterType determines the type of receive adapter that a PullSubscription uses."
status:
type: object
properties:
observedGeneration:
type: integer
format: int64
conditions:
items:
properties:
lastTransitionTime:
# we use a string in the stored object but a wrapper object
# at runtime.
type: string
message:
type: string
reason:
type: string
severity:
type: string
status:
type: string
type:
type: string
required:
- type
- status
type: object
type: array
serviceAccountName:
type: string
sinkUri:
type: string
ceAttributes:
type: array
items:
type: object
properties:
type:
type: string
source:
type: string
projectId:
type: string
topicId:
type: string
subscriptionId:
type: string
transformerUri:
type: string
134 changes: 134 additions & 0 deletions config/core/resources/old_topic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
# Copyright 2019 Google LLC
#
# 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.
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: topics.pubsub.cloud.google.com
labels:
events.cloud.google.com/release: devel
events.cloud.google.com/crd-install: "true"
duck.knative.dev/addressable: "true"
spec:
group: pubsub.cloud.google.com
names:
kind: Topic
plural: topics
singular: topic
categories:
- all
- knative
- pubsub
scope: Namespaced
subresources:
status: {}
preserveUnknownFields: false
conversion:
strategy: Webhook
webhookClientConfig:
service:
name: webhook
namespace: cloud-run-events
additionalPrinterColumns:
- name: Ready
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].status"
- name: Reason
type: string
JSONPath: ".status.conditions[?(@.type==\"Ready\")].reason"
- name: Address
type: string
JSONPath: .status.address.url
- name: Age
type: date
JSONPath: .metadata.creationTimestamp
versions:
- name: v1alpha1
served: true
storage: true
- name: v1beta1
served: true
storage: false
# All versions happen to have the same schema today. They will likely diverge in the future.
validation:
openAPIV3Schema:
type: object
properties:
spec:
type: object
required:
- topic
properties:
googleServiceAccount:
type: string
description: "GCP service account used to poll the Cloud Pub/Sub Subscription. The value of the service account must be a valid Google service account (see https://cloud.google.com/iam/docs/service-accounts)."
secret:
type: object
description: "Credential used to poll the Cloud Pub/Sub Subscription. It is not used to create or delete the Subscription, only to poll it. The value of the secret entry must be a service account key in the JSON format (see https://cloud.google.com/iam/docs/creating-managing-service-account-keys). Defaults to secret.name of 'google-cloud-key' and secret.key of 'key.json'."
properties:
name:
type: string
key:
type: string
optional:
type: boolean
project:
type: string
description: "ID of the Google Cloud Project to own the Pub/Sub credentials. E.g. 'my-project-1234' rather than its display name, 'My Project' or its number '1234567890'. If omitted uses the Project ID from the GKE cluster metadata service."
topic:
type: string
description: "ID of the Cloud Pub/Sub Topic to create. It must be in the form of the unique identifier within the project, not the entire name. E.g. it must be 'laconia', not 'projects/my-gcp-project/topics/laconia'."
propagationPolicy:
type: string
enum: [CreateDelete, CreateNoDelete, NoCreateNoDelete]
description: "Propagation policy defines how Topic controls the Cloud Pub/Sub topic for lifecycle changes. Default is CreateNoDelete."
status:
type: object
properties:
observedGeneration:
type: integer
format: int64
conditions:
type: array
items:
type: object
properties:
lastTransitionTime:
# we use a string in the stored object but a wrapper object
# at runtime.
type: string
message:
type: string
reason:
type: string
severity:
type: string
status:
type: string
type:
type: string
required:
- type
- status
serviceAccountName:
type: string
projectId:
type: string
topicId:
type: string
address:
type: object
properties:
url:
type: string

4 changes: 2 additions & 2 deletions config/core/resources/pullsubscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ metadata:
labels:
events.cloud.google.com/release: devel
events.cloud.google.com/crd-install: "true"
name: pullsubscriptions.pubsub.cloud.google.com
name: pullsubscriptions.internal.events.cloud.google.com
spec:
group: pubsub.cloud.google.com
group: internal.events.cloud.google.com
names:
categories:
- all
Expand Down
4 changes: 2 additions & 2 deletions config/core/resources/topic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: topics.pubsub.cloud.google.com
name: topics.internal.events.cloud.google.com
labels:
events.cloud.google.com/release: devel
events.cloud.google.com/crd-install: "true"
duck.knative.dev/addressable: "true"
spec:
group: pubsub.cloud.google.com
group: internal.events.cloud.google.com
names:
kind: Topic
plural: topics
Expand Down
Loading