kubernetes-sigs / application

Application metadata descriptor CRD
Apache License 2.0
513 stars 167 forks source link

Fix the controller crashing issue #193

Closed nan-yu closed 4 years ago

nan-yu commented 4 years ago

If no spec.selector.matchingLabels is set, the application controller crashes due to a nil pointer. This commit fixes the issue by checking if selector is nil before getting the matching labels from it. If no selector is set, it matches all objects.

k8s-ci-robot commented 4 years ago

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: nan-yu To complete the pull request process, please assign ant31 You can assign the PR to them by writing /assign @ant31 in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files: - **[OWNERS](https://github.com/kubernetes-sigs/application/blob/master/OWNERS)** Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
nan-yu commented 4 years ago

@janetkuo The PR is updated. Per the API doc, if spec.selector is nil, it matches no objects. If spec.selector is empty, it matches all objects. Unit tests are added to reflect the changes. Please re-review this PR. Thanks.

janetkuo commented 4 years ago

/lgtm