Skip to content

Commit 157cce0

Browse files
committed
sa not found
Signed-off-by: rashmi_kh <[email protected]>
1 parent e87203a commit 157cce0

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

internal/authentication/tokengetter.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package authentication
22

33
import (
4+
"fmt"
45
"context"
56
"sync"
67
"time"
@@ -9,6 +10,7 @@ import (
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
"k8s.io/apimachinery/pkg/types"
1112
corev1 "k8s.io/client-go/kubernetes/typed/core/v1"
13+
"k8s.io/apimachinery/pkg/api/errors"
1214
"k8s.io/utils/ptr"
1315
)
1416

@@ -86,6 +88,10 @@ func (t *TokenGetter) getToken(ctx context.Context, key types.NamespacedName) (*
8688
Spec: authenticationv1.TokenRequestSpec{ExpirationSeconds: ptr.To(int64(t.expirationDuration / time.Second))},
8789
}, metav1.CreateOptions{})
8890
if err != nil {
91+
if errors.IsNotFound(err) {
92+
var saNotFoundError = fmt.Errorf("service account not found")
93+
return nil, saNotFoundError
94+
}
8995
return nil, err
9096
}
9197
return &req.Status, nil

0 commit comments

Comments
 (0)