-
Notifications
You must be signed in to change notification settings - Fork 604
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
Used the kmeta.ChildName() to generate OIDC service account name #7471
Conversation
Hi @MeenuyD. Thanks for your PR. I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/ok-to-test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @MeenuyD it looks like the serviceaccount unit tests are failing:
--- FAIL: TestGetOIDCServiceAccountNameForResource (0.00s)
--- FAIL: TestGetOIDCServiceAccountNameForResource/should_return_SA_name_in_correct_format (0.00s)
serviceaccount_test.go:63: GetServiceAccountName() = nameoidc-group-kind, want oidc-group-kind-name
--- FAIL: TestGetOIDCServiceAccountNameForResource/should_return_SA_name_in_lower_case (0.00s)
serviceaccount_test.go:63: GetServiceAccountName() = my-brokeroidc-eventing.knative.dev-broker, want oidc-eventing.knative.dev-broker-my-broker
Could you fix them?
Wow this was fast @MeenuyD 🚀 |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MeenuyD The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@@ -60,7 +60,7 @@ func TestGetOIDCServiceAccountNameForResource(t *testing.T) { | |||
for _, tt := range tests { | |||
t.Run(tt.name, func(t *testing.T) { | |||
if got := GetOIDCServiceAccountNameForResource(tt.gvk, tt.objectMeta); got != tt.want { | |||
t.Errorf("GetServiceAccountName() = %v, want %v", got, tt.want) | |||
t.Errorf("GetOIDCServiceAccountNameForResource() = %v, want %v", got, tt.want) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MeenuyD I think you need to change the want
fields in the array of tests above. If you look at the test failures here, you'll see that they are failing because you changed the format of the string being returned by the function, and they are expecting the old format. So, just update the expected values and they should pass!
Co-authored-by: Calum Murray <[email protected]>
@MeenuyD: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@MeenuyD any updates on this? Can we help you with anything specific on this? |
Hello @creydr why the test cases are failing |
In the unit test, the eventing/pkg/auth/serviceaccount_test.go Lines 30 to 59 in 7ad1518
To get more details, click on the "details" column of the failing test comment (#7471 (comment)) And your PR needs a rebase |
@MeenuyD do you need any more information for this? |
Closing this, as done in #7521 |
Refactor OIDC service account naming in GetOIDCServiceAccountNameForResource
This updates the method
GetOIDCServiceAccountNameForResource
ineventing/pkg/auth/serviceaccount.go
to refactor the way OIDC service account names are generated. Instead of combining Group/Kind and the name of the parent object directly, it now useskmeta.ChildName
to generate the service account names. This change is made to prevent names from exceeding the maximum allowed length.#7470