Skip to content

Commit 8747527

Browse files
committed
Use go package storage
Signed-off-by: Jian Wang <[email protected]>
1 parent 487df70 commit 8747527

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ require (
1313
github.com/stretchr/testify v1.8.1
1414
k8s.io/api v0.25.4
1515
k8s.io/apimachinery v0.25.4
16+
k8s.io/apiserver v0.25.4
1617
k8s.io/client-go v0.25.4
1718
k8s.io/klog v1.0.0
1819
k8s.io/utils v0.0.0-20220728103510-ee6ede2d64ed

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,8 @@ k8s.io/apiextensions-apiserver v0.25.4 h1:7hu9pF+xikxQuQZ7/30z/qxIPZc2J1lFElPtr7
599599
k8s.io/apiextensions-apiserver v0.25.4/go.mod h1:bkSGki5YBoZWdn5pWtNIdGvDrrsRWlmnvl9a+tAw5vQ=
600600
k8s.io/apimachinery v0.25.4 h1:CtXsuaitMESSu339tfhVXhQrPET+EiWnIY1rcurKnAc=
601601
k8s.io/apimachinery v0.25.4/go.mod h1:jaF9C/iPNM1FuLl7Zuy5b9v+n35HGSh6AQ4HYRkCqwo=
602+
k8s.io/apiserver v0.25.4 h1:/3TwZcgLqX7wUxq7TtXOUqXeBTwXIblVMQdhR5XZ7yo=
603+
k8s.io/apiserver v0.25.4/go.mod h1:rPcm567XxjOnnd7jedDUnGJGmDGAo+cT6H7QHAN+xV0=
602604
k8s.io/client-go v0.25.4 h1:3RNRDffAkNU56M/a7gUfXaEzdhZlYhoW8dgViGy5fn8=
603605
k8s.io/client-go v0.25.4/go.mod h1:8trHCAC83XKY0wsBIpbirZU4NTUpbuhc2JnI7OruGZw=
604606
k8s.io/code-generator v0.25.4 h1:tjQ7/+9eN7UOiU2DP+0v4ntTI4JZLi2c1N0WllpFhTc=

pkg/controllers/chart/chart.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"k8s.io/apimachinery/pkg/runtime"
2929
"k8s.io/apimachinery/pkg/types"
3030
"k8s.io/apimachinery/pkg/util/intstr"
31+
storage "k8s.io/apiserver/pkg/storage"
3132
"k8s.io/client-go/kubernetes"
3233
"k8s.io/client-go/tools/record"
3334
"k8s.io/utils/pointer"
@@ -290,7 +291,7 @@ func (c *Controller) OnRemove(key string, chart *v1.HelmChart) (*v1.HelmChart, e
290291
newChart, err := c.helms.Update(chartCopy)
291292
if err != nil {
292293
// if chart is gone, clean resources
293-
if apierrors.IsNotFound(err) || strings.Contains(err.Error(), "StorageError") {
294+
if apierrors.IsNotFound(err) || storage.IsInvalidObj(err) {
294295
// note: an empty apply removes all resources owned by this chart
295296
err = generic.ConfigureApplyForObject(c.apply, chart, &generic.GeneratingHandlerOptions{
296297
AllowClusterScoped: true,

0 commit comments

Comments
 (0)