Skip to content

Conversation

@randmonkey
Copy link
Contributor

@randmonkey randmonkey commented Nov 18, 2025

What this PR does / why we need it:

Test adopting KongConsumer and all KongCredential* entities in envtest.

Which issue this PR fixes

Part of #2545

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect significant changes

@randmonkey randmonkey force-pushed the test/envtest_adopting_consumers_credentials branch from 2147267 to 3f4ecfc Compare November 19, 2025 10:11
@randmonkey randmonkey self-assigned this Nov 19, 2025
@randmonkey randmonkey marked this pull request as ready for review November 19, 2025 10:13
@randmonkey randmonkey requested a review from a team as a code owner November 19, 2025 10:13
Copy link
Member

@tao12345666333 tao12345666333 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is some repetitive code. I think we can simplify it by creating a function.

@randmonkey randmonkey force-pushed the test/envtest_adopting_consumers_credentials branch from ee31754 to 529b118 Compare November 25, 2025 07:53
@randmonkey randmonkey force-pushed the test/envtest_adopting_consumers_credentials branch from 529b118 to a3553b5 Compare November 25, 2025 10:02
Comment on lines +1428 to +1434
Adopt: &commonv1alpha1.AdoptOptions{
From: commonv1alpha1.AdoptSourceKonnect,
Mode: commonv1alpha1.AdoptModeOverride,
Konnect: &commonv1alpha1.AdoptKonnectOptions{
ID: jwtID,
},
},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is OK to be used as is in this PR but I think we can extract this to a generate function in a separate PR and refactor all the usages of AdoptOptions to use that new function. WDYT?

"HMAC credential should get the Programmed condition",
)
})

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

t.Log("Creating a KongCredentialBasicAuth to adopt the BasicAuth")
createdBasicAuth := &configurationv1alpha1.KongCredentialBasicAuth{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "basic-auth",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GenerateName: "basic-auth",
GenerateName: "basic-auth-",

t.Log("Creating a KongCredentialACL to adopt the ACL")
createdACL := &configurationv1alpha1.KongCredentialACL{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "acl",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GenerateName: "acl",
GenerateName: "acl-",

t.Log("Creating a KongCredentialHMACAuth to adopt the existing HMAC auth")
createdHMACAuth := &configurationv1alpha1.KongCredentialHMAC{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "hmac",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GenerateName: "hmac",
GenerateName: "hmac-",

t.Log("Creating a KongCredentialJWT for adopting the existing JWT auth")
createdJWT := &configurationv1alpha1.KongCredentialJWT{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "jwt",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GenerateName: "jwt",
GenerateName: "jwt-",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants