Skip to content

Commit 5df5a1a

Browse files
committed
review comments incorporated
Signed-off-by: rashmi_kh <[email protected]>
1 parent 9c0df21 commit 5df5a1a

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

internal/authentication/tokengetter.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ type TokenGetter struct {
2222
}
2323

2424
type ServiceAccountNotFoundError struct {
25-
ServiceAccountName string
25+
ServiceAccountName string // The name of the missing ServiceAccount.
2626
}
2727

28+
// Error implements the error interface for ServiceAccountNotFoundError.
2829
func (e *ServiceAccountNotFoundError) Error() string {
29-
return fmt.Sprintf("Unable to authenticate with Kubernetes cluster using ServiceAccount \"%s\": ServiceAccount \"%s\" not found.", e.ServiceAccountName, e.ServiceAccountName)
30+
return fmt.Sprintf("ServiceAccount \"%s\" not found: Unable to authenticate with the Kubernetes cluster.", e.ServiceAccountName)
3031
}
3132

3233
type TokenGetterOption func(*TokenGetter)
@@ -97,8 +98,7 @@ func (t *TokenGetter) getToken(ctx context.Context, key types.NamespacedName) (*
9798
}, metav1.CreateOptions{})
9899
if err != nil {
99100
if errors.IsNotFound(err) {
100-
saErr := &ServiceAccountNotFoundError{key.Name}
101-
return nil, saErr
101+
return nil, &ServiceAccountNotFoundError{ServiceAccountName: key.Name}
102102
}
103103
return nil, err
104104
}

internal/controllers/clusterextension_controller.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ import (
4747
"github.com/operator-framework/api/pkg/operators/v1alpha1"
4848
catalogd "github.com/operator-framework/catalogd/api/v1"
4949
helmclient "github.com/operator-framework/helm-operator-plugins/pkg/client"
50-
tokengetter "github.com/operator-framework/operator-controller/internal/authentication"
5150
"github.com/operator-framework/operator-registry/alpha/declcfg"
5251

5352
ocv1 "github.com/operator-framework/operator-controller/api/v1"
53+
"github.com/operator-framework/operator-controller/internal/authentication"
5454
"github.com/operator-framework/operator-controller/internal/bundleutil"
5555
"github.com/operator-framework/operator-controller/internal/conditionsets"
5656
"github.com/operator-framework/operator-controller/internal/contentmanager"
@@ -207,7 +207,7 @@ func (r *ClusterExtensionReconciler) reconcile(ctx context.Context, ext *ocv1.Cl
207207
installedBundle, err := r.InstalledBundleGetter.GetInstalledBundle(ctx, ext)
208208
if err != nil {
209209
setInstallStatus(ext, nil)
210-
var saerr *tokengetter.ServiceAccountNotFoundError
210+
var saerr *authentication.ServiceAccountNotFoundError
211211
if errors.As(err, &saerr) {
212212
l.Info("ServiceAccount defined in the ClusterExtension is not found")
213213
err = saerr

0 commit comments

Comments
 (0)