Skip to content

Handler does not receive delete event  #173

@fanminshi

Description

@fanminshi

When user deletes a existing Custom Resource(CR) that the operator is watching, user expects a delete event for that CR to be delivered to the Handle(ctx types.Context, event types.Event) error. However, that's not the case.

Steps to reproduce:

Change pkg/stub/handler.go to print out received event:

func (h *Handler) Handle(ctx types.Context, event types.Event) error {
	switch o := event.Object.(type) {
	case *v1alpha1.App:
		logrus.Printf("Name %v Deleted? %v", o.Name, event.Deleted)
	}
	return nil
}

Create a CR:

$ kubectl create -f deploy/cr.yaml

output:

$ kubectl logs -f app-operator-67c6b694-nh7l7
...
time="2018-04-04T23:15:12Z" level=info msg="Name example Deleted? false"

Delete a CR:

$ kubectl delete -f deploy/cr.yaml

Expect "Name example Deleted? true", but got none.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions