-
Notifications
You must be signed in to change notification settings - Fork 592
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
Upgrade pingsource storage to v1alpha2 #3274
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
core/roles/pingsource-adapter-clusterrole.yaml | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,8 +70,8 @@ spec: | |
JSONPath: .metadata.creationTimestamp | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
storage: true | ||
served: false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this work like this? I thought you needed both v1alpha1 / v1alpha2 to be served since the storage migration reads v1alpha1 then upgrades to v1alpha2, so if you remove the serving, not sure it will work? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hm, ok, well, wow, I'm really confused then :) I thought it would exactly use the pingsources.v1alpha1.sources.knative.dev (as in versioned read) of v1alpha1, then patch using v1alpha2. I think pingsources.sources.knative.dev will give you the v1alpha2 already converted. But, if you've already verified that the actual conversion happens and the storage version gets bumped, 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The migration tools list all resources and perform an empty patch which triggers a migration on the K8s API server. I did it twice and it works. |
||
storage: false | ||
- name: v1alpha2 | ||
served: true | ||
storage: false | ||
storage: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# 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. | ||
|
||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: knative-eventing-pingsource-adapter | ||
labels: | ||
eventing.knative.dev/release: devel | ||
rules: [] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# 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. | ||
|
||
apiVersion: apiextensions.k8s.io/v1beta1 | ||
kind: CustomResourceDefinition | ||
metadata: | ||
labels: | ||
eventing.knative.dev/release: devel | ||
eventing.knative.dev/source: "true" | ||
duck.knative.dev/source: "true" | ||
knative.dev/crd-install: "true" | ||
annotations: | ||
# TODO add schemas and descriptions | ||
registry.knative.dev/eventTypes: | | ||
[ | ||
{ "type": "dev.knative.sources.ping" } | ||
] | ||
name: pingsources.sources.knative.dev | ||
spec: | ||
group: sources.knative.dev | ||
names: | ||
categories: | ||
- all | ||
- knative | ||
- eventing | ||
- sources | ||
kind: PingSource | ||
plural: pingsources | ||
scope: Namespaced | ||
subresources: | ||
status: {} | ||
preserveUnknownFields: false | ||
validation: | ||
openAPIV3Schema: | ||
type: object | ||
# this is a work around so we don't need to flesh out the | ||
# schema for each version at this time | ||
# | ||
# see issue: https://github.com/knative/serving/issues/912 | ||
x-kubernetes-preserve-unknown-fields: true | ||
conversion: | ||
strategy: Webhook | ||
webhookClientConfig: | ||
service: | ||
name: eventing-webhook | ||
namespace: knative-eventing | ||
additionalPrinterColumns: | ||
- name: Ready | ||
type: string | ||
JSONPath: ".status.conditions[?(@.type=='Ready')].status" | ||
- name: Reason | ||
type: string | ||
JSONPath: ".status.conditions[?(@.type=='Ready')].reason" | ||
- name: Sink | ||
type: string | ||
JSONPath: .status.sinkUri | ||
- name: Age | ||
type: date | ||
JSONPath: .metadata.creationTimestamp | ||
versions: | ||
- name: v1alpha1 | ||
served: false | ||
storage: false | ||
- name: v1alpha2 | ||
served: true | ||
storage: true |
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -22,7 +22,6 @@ import ( | |||||||
"github.com/kelseyhightower/envconfig" | ||||||||
appsv1 "k8s.io/api/apps/v1" | ||||||||
"k8s.io/client-go/tools/cache" | ||||||||
"knative.dev/eventing/pkg/apis/sources/v1alpha1" | ||||||||
"knative.dev/pkg/configmap" | ||||||||
"knative.dev/pkg/controller" | ||||||||
"knative.dev/pkg/logging" | ||||||||
|
@@ -31,10 +30,13 @@ import ( | |||||||
"knative.dev/pkg/system" | ||||||||
"knative.dev/pkg/tracker" | ||||||||
|
||||||||
pingsourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha1/pingsource" | ||||||||
pingsourcereconciler "knative.dev/eventing/pkg/client/injection/reconciler/sources/v1alpha1/pingsource" | ||||||||
"knative.dev/eventing/pkg/apis/sources/v1alpha2" | ||||||||
pingsourceinformer "knative.dev/eventing/pkg/client/injection/informers/sources/v1alpha2/pingsource" | ||||||||
pingsourcereconciler "knative.dev/eventing/pkg/client/injection/reconciler/sources/v1alpha2/pingsource" | ||||||||
kubeclient "knative.dev/pkg/client/injection/kube/client" | ||||||||
deploymentinformer "knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment" | ||||||||
"knative.dev/pkg/client/injection/kube/informers/core/v1/serviceaccount" | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Format Go code:
Suggested change
|
||||||||
"knative.dev/pkg/client/injection/kube/informers/rbac/v1/rolebinding" | ||||||||
) | ||||||||
|
||||||||
// envConfig will be used to extract the required environment variables using | ||||||||
|
@@ -54,11 +56,15 @@ func NewController( | |||||||
|
||||||||
deploymentInformer := deploymentinformer.Get(ctx) | ||||||||
pingSourceInformer := pingsourceinformer.Get(ctx) | ||||||||
serviceAccountInformer := serviceaccount.Get(ctx) | ||||||||
roleBindingInformer := rolebinding.Get(ctx) | ||||||||
|
||||||||
r := &Reconciler{ | ||||||||
kubeClientSet: kubeclient.Get(ctx), | ||||||||
pingLister: pingSourceInformer.Lister(), | ||||||||
deploymentLister: deploymentInformer.Lister(), | ||||||||
kubeClientSet: kubeclient.Get(ctx), | ||||||||
pingLister: pingSourceInformer.Lister(), | ||||||||
deploymentLister: deploymentInformer.Lister(), | ||||||||
serviceAccountLister: serviceAccountInformer.Lister(), | ||||||||
roleBindingLister: roleBindingInformer.Lister(), | ||||||||
|
||||||||
loggingContext: ctx, | ||||||||
} | ||||||||
|
@@ -79,7 +85,7 @@ func NewController( | |||||||
|
||||||||
// Watch for deployments owned by the source | ||||||||
deploymentInformer.Informer().AddEventHandler(cache.FilteringResourceEventHandler{ | ||||||||
FilterFunc: controller.FilterControllerGK(v1alpha1.Kind("PingSource")), | ||||||||
FilterFunc: controller.FilterControllerGK(v1alpha2.Kind("PingSource")), | ||||||||
Handler: controller.HandleAll(impl.EnqueueControllerOf), | ||||||||
}) | ||||||||
|
||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add trailing newline: