Skip to content

Commit

Permalink
Accept 0 as a valid value for EventListener replicas
Browse files Browse the repository at this point in the history
This change is intended as a workaround until a proper Knative EventListener implementation is available (see #892). Note: without additional work, replicas=0 results in a broken setup.
  • Loading branch information
Fabian-K committed Jan 25, 2021
1 parent 9cb12c4 commit 53523dd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 16 deletions.
3 changes: 0 additions & 3 deletions pkg/apis/triggers/v1alpha1/event_listener_defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ import (
func (el *EventListener) SetDefaults(ctx context.Context) {
if IsUpgradeViaDefaulting(ctx) {
// set defaults
if el.Spec.Replicas != nil && *el.Spec.Replicas == 0 {
*el.Spec.Replicas = 1
}
for i := range el.Spec.Triggers {
triggerSpecBindingArray(el.Spec.Triggers[i].Bindings).
defaultBindings()
Expand Down
13 changes: 0 additions & 13 deletions pkg/apis/triggers/v1alpha1/event_listener_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ func TestEventListenerSetDefaults(t *testing.T) {
}},
},
},
}, {
name: "set replicas to 1 if provided replicas is 0 as part of eventlistener spec",
in: &v1alpha1.EventListener{
Spec: v1alpha1.EventListenerSpec{
Replicas: ptr.Int32(0),
},
},
wc: v1alpha1.WithUpgradeViaDefaulting,
want: &v1alpha1.EventListener{
Spec: v1alpha1.EventListenerSpec{
Replicas: ptr.Int32(1),
},
},
}, {
name: "deprecate podTemplate nodeselector to resource",
in: &v1alpha1.EventListener{
Expand Down

0 comments on commit 53523dd

Please sign in to comment.