Skip to content

Commit

Permalink
change storage versions to v1beta1 (#3169)
Browse files Browse the repository at this point in the history
* change storage versions to v1beta1

* proper defaults since we now store with v1beta1
  • Loading branch information
vaikas authored May 22, 2020
1 parent d433100 commit 12c1ec1
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 16 deletions.
4 changes: 2 additions & 2 deletions config/channels/in-memory-channel/300-in-memory-channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/channel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -136,7 +136,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
- name: v1beta1
served: true
storage: false
storage: true
schema:
openAPIV3Schema:
type: object
Expand Down
4 changes: 2 additions & 2 deletions config/core/resources/eventtype.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/parallel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true

4 changes: 2 additions & 2 deletions config/core/resources/sequence.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/subscription.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
- name: v1beta1
served: true
storage: false
storage: true
4 changes: 2 additions & 2 deletions config/core/resources/trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ spec:
versions:
- name: v1alpha1
served: true
storage: true
storage: false
schema:
openAPIV3Schema:
type: object
Expand Down Expand Up @@ -118,7 +118,7 @@ spec:
x-kubernetes-preserve-unknown-fields: true
- name: v1beta1
served: true
storage: false
storage: true
schema:
openAPIV3Schema:
type: object
Expand Down
18 changes: 17 additions & 1 deletion pkg/apis/messaging/v1alpha1/in_memory_channel_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,26 @@ limitations under the License.

package v1alpha1

import "context"
import (
"context"

"knative.dev/eventing/pkg/apis/messaging"
)

func (imc *InMemoryChannel) SetDefaults(ctx context.Context) {
imc.Spec.SetDefaults(ctx)

// Set the duck subscription to the stored version of the duck
// we support. Reason for this is that the stored version will
// not get a chance to get modified, but for newer versions
// conversion webhook will be able to take a crack at it and
// can modify it to match the duck shape.
if imc.Annotations == nil {
imc.Annotations = make(map[string]string)
}
if _, ok := imc.Annotations[messaging.SubscribableDuckVersionAnnotation]; !ok {
imc.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1beta1"
}
}

func (imcs *InMemoryChannelSpec) SetDefaults(ctx context.Context) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/messaging/v1beta1/in_memory_channel_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func (imc *InMemoryChannel) SetDefaults(ctx context.Context) {
imc.Annotations = make(map[string]string)
}
if _, ok := imc.Annotations[messaging.SubscribableDuckVersionAnnotation]; !ok {
imc.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1alpha1"
imc.Annotations[messaging.SubscribableDuckVersionAnnotation] = "v1beta1"
}

imc.Spec.SetDefaults(ctx)
Expand Down

0 comments on commit 12c1ec1

Please sign in to comment.