-
Notifications
You must be signed in to change notification settings - Fork 67
🐛 wrap service account not found error #1477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 28 commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
664a51f
changes to derice minimum service account
rashmi43 75c5f7c
remove headers
rashmi43 24d93f1
add details about registry+v1 support
rashmi43 fdf7e9d
render yml correctly
rashmi43 ba9193d
Merge branch 'operator-framework:main' into main
rashmi43 4067d8c
Merge branch 'operator-framework:main' into main
rashmi43 a6b2ebc
Merge branch 'operator-framework:main' into main
rashmi43 e87203a
Merge branch 'operator-framework:main' into main
rashmi43 157cce0
sa not found
rashmi43 eabd252
Merge branch 'operator-framework:main' into sa-err-msg
rashmi43 6062677
Delete docs/drafts/derive-serviceaccount.md
rashmi43 738a59c
add custom sa not found
rashmi43 6ed7b58
remove unused imports
rashmi43 5d5d2de
Update tokengetter.go
rashmi43 815115e
Update tokengetter.go
rashmi43 49549f2
update error message string
rashmi43 aa4f6e9
pass sa name to error message
rashmi43 1bbb34a
Update tokengetter.go
rashmi43 5196201
wrap error message
rashmi43 e8e76c6
Update internal/authentication/tokengetter.go
rashmi43 3ef45b6
Update tokengetter.go
rashmi43 1334b69
Update clusterextension_controller.go
rashmi43 83e188c
add unit test cases
rashmi43 683db58
updates testcases
rashmi43 7893d90
reverting this change
rashmi43 bad6695
review comment
rashmi43 9c0df21
update error msg
rashmi43 5df5a1a
review comments incorporated
rashmi43 7b23746
Merge branch 'main' into sa-err-msg
rashmi43 452703d
review comments
rashmi43 100c39e
review comments
rashmi43 668e370
add unwrap function
rashmi43 f6e5d66
add import in the right section
rashmi43 91bd298
review comment about error message with namespace
rashmi43 03187f4
Update internal/controllers/clusterextension_controller.go
rashmi43 ae8094d
update test with sa condition error
rashmi43 b103f5d
add mock applier
rashmi43 3c21bba
add e2e test
rashmi43 ddf9c64
add nil checks in e2e testcase
rashmi43 40bd6ba
Merge branch 'operator-framework:main' into sa-err-msg
rashmi43 04f81cb
remove e2e add unit
rashmi43 53494ca
remove nil checks
rashmi43 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -677,6 +677,97 @@ func TestClusterExtensionInstallationSucceeds(t *testing.T) { | |
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) | ||
} | ||
|
||
func TestClusterExtensionInstallationFailsWithNoServiceAccount(t *testing.T) { | ||
camilamacedo86 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
cl, reconciler := newClientAndReconciler(t) | ||
reconciler.Unpacker = &MockUnpacker{ | ||
result: &source.Result{ | ||
State: source.StateUnpacked, | ||
Bundle: fstest.MapFS{}, | ||
}, | ||
} | ||
|
||
ctx := context.Background() | ||
extKey := types.NamespacedName{Name: fmt.Sprintf("cluster-extension-test-%s", rand.String(8))} | ||
|
||
t.Log("When the cluster extension specifies a channel with version that exist") | ||
t.Log("By initializing cluster state") | ||
pkgName := "prometheus" | ||
pkgVer := "1.0.0" | ||
pkgChan := "beta" | ||
namespace := fmt.Sprintf("test-ns-%s", rand.String(8)) | ||
serviceAccount := fmt.Sprintf("test-does-not-exist-%s", rand.String(8)) | ||
|
||
clusterExtension := &ocv1.ClusterExtension{ | ||
ObjectMeta: metav1.ObjectMeta{Name: extKey.Name}, | ||
Spec: ocv1.ClusterExtensionSpec{ | ||
Source: ocv1.SourceConfig{ | ||
SourceType: "Catalog", | ||
Catalog: &ocv1.CatalogSource{ | ||
PackageName: pkgName, | ||
Version: pkgVer, | ||
Channels: []string{pkgChan}, | ||
}, | ||
}, | ||
Namespace: namespace, | ||
ServiceAccount: ocv1.ServiceAccountReference{ | ||
Name: serviceAccount, | ||
}, | ||
}, | ||
} | ||
err := cl.Create(ctx, clusterExtension) | ||
require.NoError(t, err) | ||
|
||
t.Log("It sets resolution success status") | ||
t.Log("By running reconcile") | ||
reconciler.Resolver = resolve.Func(func(_ context.Context, _ *ocv1.ClusterExtension, _ *ocv1.BundleMetadata) (*declcfg.Bundle, *bsemver.Version, *declcfg.Deprecation, error) { | ||
v := bsemver.MustParse("1.0.0") | ||
return &declcfg.Bundle{ | ||
Name: "prometheus.v1.0.0", | ||
Package: "prometheus", | ||
Image: "quay.io/operatorhubio/[email protected]", | ||
}, &v, nil, nil | ||
}) | ||
reconciler.Applier = &MockApplier{ | ||
objs: []client.Object{}, | ||
} | ||
reconciler.Manager = &MockManagedContentCacheManager{ | ||
cache: &MockManagedContentCache{}, | ||
} | ||
res, err := reconciler.Reconcile(ctx, ctrl.Request{NamespacedName: extKey}) | ||
require.Equal(t, ctrl.Result{}, res) | ||
require.NoError(t, err) | ||
|
||
t.Log("By fetching updated cluster extension after reconcile") | ||
require.NoError(t, cl.Get(ctx, extKey, clusterExtension)) | ||
|
||
t.Log("By checking the status fields") | ||
require.Equal(t, ocv1.BundleMetadata{Name: "prometheus.v1.0.0", Version: "1.0.0"}, clusterExtension.Status.Install.Bundle) | ||
|
||
t.Log("By checking the expected installed conditions") | ||
|
||
installedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeInstalled) | ||
t.Log("By checking the installed conditions message", installedCond.Message) | ||
require.NotNil(t, installedCond) | ||
t.Log("By checking the installed conditions status", installedCond.Status) | ||
t.Log("By checking the installed conditions reason", installedCond.Reason) | ||
require.Equal(t, metav1.ConditionTrue, installedCond.Status) | ||
require.Equal(t, ocv1.ReasonSucceeded, installedCond.Reason) | ||
|
||
t.Log("By checking the expected progressing conditions") | ||
progressingCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.TypeProgressing) | ||
t.Log("Progressing condition message", progressingCond.Message) | ||
require.NotNil(t, progressingCond) | ||
t.Log("Progressing condition status", progressingCond.Status) | ||
t.Log("Progressing condition reason", progressingCond.Reason) | ||
//require.Equal(t, metav1.ConditionTrue, progressingCond.Status) | ||
camilamacedo86 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
require.Equal(t, ocv1.ReasonFailed, progressingCond.Reason) | ||
failedCond := apimeta.FindStatusCondition(clusterExtension.Status.Conditions, ocv1.ReasonFailed) | ||
t.Log("By checking the failed conditions message", failedCond.Message) | ||
t.Log("By checking the failed conditions status", failedCond.Status, failedCond.Reason) | ||
|
||
require.NoError(t, cl.DeleteAllOf(ctx, &ocv1.ClusterExtension{})) | ||
} | ||
|
||
func TestClusterExtensionDeleteFinalizerFails(t *testing.T) { | ||
cl, reconciler := newClientAndReconciler(t) | ||
reconciler.Unpacker = &MockUnpacker{ | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.