Skip to content

Conversation

@irby
Copy link
Contributor

@irby irby commented Jun 23, 2025

  • Add support for OwnerRoleName and OwnerRoleId in ClusterIssuer resources. This field may be required if the certificate template / enrollment pattern / system-wide setting requires it.
  • Some code paths were not being properly unit tested. Refactored the code a little bit so the CSR request generation is properly unit tested.

@irby irby changed the title Feat/ab#72725/owner role name id support Support Owner Role Name and OwnerRole ID in Issuer / ClusterIssuer configuration Jun 23, 2025
@irby irby changed the base branch from main to feat/AB#71008/enrollment-pattern-support June 23, 2025 15:47
@irby irby changed the base branch from feat/AB#71008/enrollment-pattern-support to release-2.3 July 15, 2025 13:04
@irby irby marked this pull request as ready for review July 15, 2025 13:09
@spbsoluble spbsoluble requested a review from Copilot July 24, 2025 21:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for OwnerRoleName and OwnerRoleId fields to Issuer and ClusterIssuer configurations, providing the ability to specify certificate ownership roles during enrollment. The implementation includes comprehensive testing coverage and refactoring to improve unit testability.

  • Added OwnerRoleName and OwnerRoleId fields to both Issuer and ClusterIssuer specs with precedence logic (ID takes precedence over name)
  • Refactored the CSR enrollment request generation into a separate buildCsrEnrollRequest method for better unit testing
  • Enhanced end-to-end tests to cover both Issuer and ClusterIssuer resources with the new owner role functionality

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
internal/controller/certificaterequest_controller.go Passes new owner role fields from issuer spec to command configuration
internal/command/command_test.go Adds comprehensive unit tests for the new buildCsrEnrollRequest method and owner role functionality
internal/command/command.go Implements owner role support in CSR enrollment with annotation override capability
e2e/run_tests.sh Extends e2e tests to validate owner role functionality for both Issuer and ClusterIssuer resources
Multiple CRD files Updates Custom Resource Definitions to include ownerRoleId and ownerRoleName fields
Documentation files Updates README and documentation to describe the new owner role fields and their usage

Comment on lines 218 to 219
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

There is a spelling error in 'tkae' which should be 'take'.

Suggested change
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |

Copilot uses AI. Check for mistakes.
Comment on lines 218 to 219
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

There is a spelling error in 'tkae' which should be 'take'.

Suggested change
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines 250 to 251
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

There is a spelling error in 'tkae' which should be 'take'.

Suggested change
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |

Copilot uses AI. Check for mistakes.
README.md Outdated
Comment on lines 250 to 251
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
Copy link

Copilot AI Jul 24, 2025

Choose a reason for hiding this comment

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

There is a spelling error in 'tkae' which should be 'take'.

Suggested change
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will tkae precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleId | The ID of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |
| ownerRoleName | The name of the security role assigned as the certificate owner. The security role must be assigned to the identity context of the issuer. If `ownerRoleId` and `ownerRoleName` are both specified, `ownerRoleId` will take precedence. This field is **required** if the enrollment pattern, certificate template, or system-wide setting requires it. |

Copilot uses AI. Check for mistakes.
Signed-off-by: Matthew H. Irby <matt.irby@outlook.com>
@doebrowsk doebrowsk merged commit d07421e into release-2.3 Jul 29, 2025
47 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants