mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-06 02:26:07 +00:00
Automatic merge from submit-queue [Pet Set] Clean up code <!-- Thanks for sending a pull request! Here are some tips for you: 1. If this is your first time, read our contributor guidelines https://github.com/kubernetes/kubernetes/blob/master/CONTRIBUTING.md and developer guide https://github.com/kubernetes/kubernetes/blob/master/docs/devel/development.md 2. If you want *faster* PR reviews, read how: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/faster_reviews.md 3. Follow the instructions for writing a release note: https://github.com/kubernetes/kubernetes/blob/master/docs/devel/pull-requests.md#release-notes --> **What this PR does / why we need it**: Clean code of petset, from: ``` func (p *apiServerPetClient) getPVC(pvcName, pvcNamespace string) (*api.PersistentVolumeClaim, bool, error) ``` to: ``` func (p *apiServerPetClient) getPVC(pvcName, pvcNamespace string) (*api.PersistentVolumeClaim, error) ``` I think the 2nd(bool type) return value of [getPVC](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/pet.go#L228) is unnecessary, as the caller can be responsible for checking the error type and tell if it exists via the [error type](https://github.com/kubernetes/kubernetes/blob/master/pkg/controller/petset/pet.go#L231-L233). So, I remove the 2nd return value of `getPVC()`. The benefit of this change is that we can simplify the code of `getPVC()` while don't increase the caller's code.