Skip to content

SREP-1332: Add permissions to support adding day2 tag to SecurityGroup #2720

Open
ratnam915 wants to merge 2 commits into
openshift:masterfrom
ratnam915:feature/SREP-1332
Open

SREP-1332: Add permissions to support adding day2 tag to SecurityGroup #2720
ratnam915 wants to merge 2 commits into
openshift:masterfrom
ratnam915:feature/SREP-1332

Conversation

@ratnam915
Copy link
Copy Markdown

@ratnam915 ratnam915 commented Apr 23, 2026

What type of PR is this?

Bug

What this PR does / Why we need it

This PR adds a new CreateDeleteSecurityGroupTags IAM policy statement to the ControlPlaneOperator credentials policy. This statement grants ec2:CreateTags and ec2:DeleteTags permissions on security groups that are tagged with red-hat-managed: true.

HyperShift supports day-2 tag propagation for the Default Worker SecurityGroup ({infraID}-default-sg). When a customer modifies ResourceTags on their HostedCluster, the Control Plane Operator (CPO) reconciles these changes via UpdateResourceTags(). This function calls both ec2:CreateTags for new/modified tags and ec2:DeleteTags for removed tags.

The existing CreateTagsRestrictedActions statement only permits ec2:CreateTags during resource creation (gated by an ec2:CreateAction condition), and therefore does not cover day-2 tag operations on existing security groups. Without ec2:DeleteTags, tag removal fails silently—the CPO catches the permissions error and continues, but stale tags remain on the security group.Policy files updated

File

ARN partition
resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
arn:aws (Commercial)
resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
arn:aws-us-gov (FedRAMP)

Statement added
{
"Sid": "CreateDeleteSecurityGroupTags",
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:DeleteTags"
],
"Resource": [
"arn:aws:ec2:::security-group/*"
],
"Condition": {
"StringEquals": {
"aws:ResourceTag/red-hat-managed": "true"
}
}
}
This statement is scoped to security groups with the red-hat-managed: true resource tag, which is consistent with the existing DeleteSecurityGroup and SecurityGroupIngressEgress statements.Which Jira/Github issue(s) does this PR fix?

Resolves SREP-1332

This MCC policy JSON is the source of truth that Red Hat submits to AWS for the managed policy ROSAControlPlaneOperatorPolicy. The change will take effect in production once AWS publishes the next policy version (v7).

A companion hypershift PR adds the same ec2:DeleteTags permission to the inline CPO policy used in dev/test environments. The two PRs are independent and can be merged in any order.
The new statement is separate from CreateTagsRestrictedActions because that statement uses an ec2:CreateAction condition which only applies at resource creation time and does not cover day-2 tag operations on existing resources.

Pre-checks

Ran unit tests locally — hypershift full test suite passes with the updated policy

Validated the changes in a cluster — confirmed the day-2 tag reconciliation code path in CPO (reconcileDefaultSecurityGroup -> UpdateResourceTags) requires both ec2:CreateTags and ec2:DeleteTags

Summary by CodeRabbit

  • Chores
    • Updated IAM policies for HyperShift control plane operators to permit creating and removing tags on EC2 security groups.
    • Tagging actions are restricted to security groups already marked with the red-hat-managed=true tag, with additional tag-key constraints to limit scope.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Apr 23, 2026
@openshift-ci-robot
Copy link
Copy Markdown

openshift-ci-robot commented Apr 23, 2026

@ratnam915: This pull request references SREP-1332 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

What type of PR is this?

Bug

What this PR does / Why we need it

This PR adds a new CreateDeleteSecurityGroupTags IAM policy statement to the ControlPlaneOperator credentials policy. This statement grants ec2:CreateTags and ec2:DeleteTags permissions on security groups that are tagged with red-hat-managed: true.

HyperShift supports day-2 tag propagation for the Default Worker SecurityGroup ({infraID}-default-sg). When a customer modifies ResourceTags on their HostedCluster, the Control Plane Operator (CPO) reconciles these changes via UpdateResourceTags(). This function calls both ec2:CreateTags for new/modified tags and ec2:DeleteTags for removed tags.

The existing CreateTagsRestrictedActions statement only permits ec2:CreateTags during resource creation (gated by an ec2:CreateAction condition), and therefore does not cover day-2 tag operations on existing security groups. Without ec2:DeleteTags, tag removal fails silently—the CPO catches the permissions error and continues, but stale tags remain on the security group.Policy files updated

File

ARN partition
resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
arn:aws (Commercial)
resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
arn:aws-us-gov (FedRAMP)

Statement added
{
"Sid": "CreateDeleteSecurityGroupTags",
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:DeleteTags"
],
"Resource": [
"arn:aws:ec2:::security-group/*"
],
"Condition": {
"StringEquals": {
"aws:ResourceTag/red-hat-managed": "true"
}
}
}
This statement is scoped to security groups with the red-hat-managed: true resource tag, which is consistent with the existing DeleteSecurityGroup and SecurityGroupIngressEgress statements.Which Jira/Github issue(s) does this PR fix?

Resolves SREP-1332

This MCC policy JSON is the source of truth that Red Hat submits to AWS for the managed policy ROSAControlPlaneOperatorPolicy. The change will take effect in production once AWS publishes the next policy version (v7).

A companion hypershift PR adds the same ec2:DeleteTags permission to the inline CPO policy used in dev/test environments. The two PRs are independent and can be merged in any order.
The new statement is separate from CreateTagsRestrictedActions because that statement uses an ec2:CreateAction condition which only applies at resource creation time and does not cover day-2 tag operations on existing resources.

Pre-checks

Ran unit tests locally — hypershift full test suite passes with the updated policy

Validated the changes in a cluster — confirmed the day-2 tag reconciliation code path in CPO (reconcileDefaultSecurityGroup -> UpdateResourceTags) requires both ec2:CreateTags and ec2:DeleteTags

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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 23, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b7387012-66df-4226-bc74-8574e7474a95

📥 Commits

Reviewing files that changed from the base of the PR and between fbe0a91 and ce0e44c.

📒 Files selected for processing (1)
  • resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json

Walkthrough

Two IAM policy documents are updated to add a new statement CreateDeleteSecurityGroupTags that allows ec2:CreateTags and ec2:DeleteTags on EC2 security-group ARNs, conditioned on the resource tag red-hat-managed=true and additional tag-key constraints. No existing statements were changed.

Changes

IAM Policy Tagging Permission

Layer / File(s) Summary
Policy Statement Addition
resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
Adds Sid: "CreateDeleteSecurityGroupTags" granting ec2:CreateTags and ec2:DeleteTags on security-group ARNs.
Policy Statement Addition
resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
Adds same CreateDeleteSecurityGroupTags statement granting tagging/un-tagging on security-group ARNs.
Conditions / Restrictions
resources/sts/.../openshift_hcp_control_plane_operator_credentials_policy.json
Both statements restrict actions with Condition: StringEquals aws:ResourceTag/red-hat-managed = true, ForAllValues:NotEquals on aws:TagKeys (excludes red-hat-managed), and Null checks on aws:TagKeys.
File Layout / Misc
resources/sts/4.14/..., resources/sts/hypershift/...
New statements appended; no existing statements or permissions modified. One file lacks a trailing newline.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 12
✅ Passed checks (12 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly describes the main change: adding IAM permissions for day-2 security group tagging operations via ec2:CreateTags and ec2:DeleteTags.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PR modifies only JSON IAM policy files. Codebase contains no Go test files or Ginkgo tests. Check is not applicable.
Test Structure And Quality ✅ Passed This check is not applicable. The repository contains only configuration files (JSON, YAML, MD). There are no Go files or Ginkgo tests. The PR modifies IAM policy JSON files, not test code.
Microshift Test Compatibility ✅ Passed This PR adds IAM policy statements to JSON configuration files only. It does not add any Ginkgo e2e tests (It(), Describe(), Context(), When(), etc.). The check is not applicable to this PR.
Single Node Openshift (Sno) Test Compatibility ✅ Passed This PR adds no Ginkgo e2e tests. It only modifies IAM policy JSON files for EC2 tagging permissions. The SNO test compatibility check is not applicable.
Topology-Aware Scheduling Compatibility ✅ Passed PR modifies AWS IAM policy files only, not Kubernetes manifests. Changes grant EC2 permissions but introduce no Kubernetes scheduling constraints, affinity rules, or topology-aware logic.
Ote Binary Stdout Contract ✅ Passed Check not applicable: PR modifies only JSON IAM policy files, not executable code or test binaries. OTE Binary Stdout Contract applies only to Go source code changes.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed This PR adds only IAM policy JSON files (no Go code or tests). The custom check applies only when new Ginkgo e2e tests are added. Since no test files are present, the check is not applicable.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 23, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ratnam915
Once this PR has been reviewed and has the lgtm label, please assign rogbas for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 23, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json`:
- Around line 187-201: Update the policy statement with Sid
"CreateDeleteSecurityGroupTags" to tighten conditions: add aws:TagKeys and Null
constraints so deletions must explicitly target tag keys and cannot remove the
ownership tag. Concretely, in the statement that currently allows
"ec2:CreateTags" and "ec2:DeleteTags" on
"arn:aws-us-gov:ec2:*:*:security-group/*", add Condition clauses (e.g., a
"Null": {"aws:TagKeys":"false"} and a TagKeys equality constraint such as
"ForAllValues:StringEquals": {"aws:TagKeys":["red-hat-managed"]}) so DeleteTags
calls must specify tag keys and cannot delete the "red-hat-managed" ownership
tag.

In
`@resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json`:
- Around line 187-201: The policy statement with Sid
"CreateDeleteSecurityGroupTags" is too permissive for ec2:DeleteTags; split it
into two statements: one allowing ec2:CreateTags (keep resource
"arn:aws:ec2:*:*:security-group/*" and any existing constraints) and a separate
one allowing ec2:DeleteTags but add conditions to (1) require explicit tag keys
in every delete request (e.g., "Null": {"aws:TagKeys":"false"} or equivalent)
and (2) forbid deletion of the reserved key by adding a
ForAllValues:StringNotEquals on "aws:TagKeys": ["red-hat-managed"] so requests
cannot remove the red-hat-managed ownership tag; update or remove the original
"CreateDeleteSecurityGroupTags" combined statement accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ad6452a7-9007-4743-9de6-71f3da0d992c

📥 Commits

Reviewing files that changed from the base of the PR and between 6fb3ff3 and fbe0a91.

📒 Files selected for processing (2)
  • resources/sts/4.14/fedramp-hypershift/openshift_hcp_control_plane_operator_credentials_policy.json
  • resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json

Comment on lines +187 to +201
{
"Sid": "CreateDeleteSecurityGroupTags",
"Effect": "Allow",
"Action": [
"ec2:CreateTags",
"ec2:DeleteTags"
],
"Resource": [
"arn:aws:ec2:*:*:security-group/*"
],
"Condition": {
"StringEquals": {
"aws:ResourceTag/red-hat-managed": "true"
}
}
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 23, 2026

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cat -n resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json | head -250

Repository: openshift/managed-cluster-config

Length of output: 7319


🏁 Script executed:

grep -n "red-hat-managed" resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json

Repository: openshift/managed-cluster-config

Length of output: 532


🌐 Web query:

AWS EC2 DeleteTags IAM condition key aws:TagKeys behavior

💡 Result:

The IAM condition key aws:TagKeys is supported for the AWS EC2 DeleteTags action. It allows policies to restrict which tag keys can be deleted based on the tag keys specified in the DeleteTags request. aws:TagKeys is a global request context key that compares the tag keys provided in the request (the keys of tags being deleted) with the keys specified in the policy condition. It is listed as available for EC2 actions in the official service authorization reference and explicitly applicable to ec2:DeleteTags. Common usage includes: - ForAllValues:StringEquals: Allows deletion only if all requested tag keys exactly match the allowed list (e.g., only delete "temporary" tags). Example from similar service (Auto Scaling, analogous to EC2): { "Effect": "Allow", "Action": "autoscaling:DeleteTags", "Resource": "*", "Condition": { "ForAllValues:StringEquals": { "aws:TagKeys": ["temporary"] } } } This pattern applies to EC2 DeleteTags. - Without ForAllValues, it checks if the request keys are a subset of allowed keys. If no tags are specified in DeleteTags (deletes all user tags), aws:TagKeys condition may not apply or evaluates differently, but typically used when specific keys are targeted. Official docs confirm aws:TagKeys for EC2 tagging actions including DeleteTags to enforce allowed keys, preventing deletion of unauthorized tags.

Citations:


🌐 Web query:

AWS EC2 DeleteTags action aws:ResourceTag condition resource tag protection

💡 Result:

To protect EC2 resource tags from deletion using the DeleteTags action, create an IAM deny policy with a condition on aws:TagKeys. This denies the ec2:DeleteTags action when the request attempts to delete tags with specified protected keys. Example policy: { "Version": "2012-10-17", "Statement": [ { "Sid": "DenyDeleteProtectedTags", "Effect": "Deny", "Action": "ec2:DeleteTags", "Resource": "*", "Condition": { "ForAnyValue:StringEquals": { "aws:TagKeys": ["Name", "Purpose"] } } } ] } This policy denies deletion if any of the specified tag keys (e.g., "Name", "Purpose") are included in the DeleteTags request, regardless of the resource's existing tags. The aws:ResourceTag condition controls access based on existing resource tags but does not directly protect against deletion of those tags. The aws:TagKeys condition matches the tag keys being targeted for deletion in the request. The ec2:DeleteTags action supports tag-related condition keys including aws:TagKeys, aws:RequestTag, and aws:ResourceTag (service-specific variants like ec2:ResourceTag/${TagKey}). No dedicated "tag protection" feature exists beyond IAM conditions; AWS Config can monitor and remediate post-deletion but not prevent it.

Citations:


Prevent deletion of the red-hat-managed ownership tag.

This statement allows deleting any tag on a managed security group, including red-hat-managed. If that tag is removed, later statements guarded by aws:ResourceTag/red-hat-managed=true (DeleteSecurityGroup, SecurityGroupIngressEgress, ManageVPCEndpointWithCondition) no longer match the resource, orphaning it from future management. Additionally, ec2:DeleteTags without tag key constraints can delete all tags when the request omits specific keys. Restrict the action to prevent deletion of the reserved key and require explicit tag keys in every request.

Proposed IAM condition fix
             "Condition": {
                 "StringEquals": {
                     "aws:ResourceTag/red-hat-managed": "true"
+                },
+                "ForAllValues:StringNotEquals": {
+                    "aws:TagKeys": [
+                        "red-hat-managed"
+                    ]
+                },
+                "Null": {
+                    "aws:TagKeys": "false"
                 }
             }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@resources/sts/hypershift/openshift_hcp_control_plane_operator_credentials_policy.json`
around lines 187 - 201, The policy statement with Sid
"CreateDeleteSecurityGroupTags" is too permissive for ec2:DeleteTags; split it
into two statements: one allowing ec2:CreateTags (keep resource
"arn:aws:ec2:*:*:security-group/*" and any existing constraints) and a separate
one allowing ec2:DeleteTags but add conditions to (1) require explicit tag keys
in every delete request (e.g., "Null": {"aws:TagKeys":"false"} or equivalent)
and (2) forbid deletion of the reserved key by adding a
ForAllValues:StringNotEquals on "aws:TagKeys": ["red-hat-managed"] so requests
cannot remove the red-hat-managed ownership tag; update or remove the original
"CreateDeleteSecurityGroupTags" combined statement accordingly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you please double check if this is still a concern? I see the deletetag action is already constrained by a tag. We want all actions to be constrained by a tag whenever possible.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@feichashao, thanks for the question — the concern is still valid, and it's worth clarifying why.

You're correct that ec2:DeleteTags is constrained by aws:ResourceTag/red-hat-managed=true. However, this condition only controls which resources the action is authorized against — it does not restrict which tag keys can be deleted from those resources.

Here's the key distinction:

  • aws:ResourceTag — evaluated against the resource's existing tags at the time the request is made (before the action executes). It answers: "Is this resource allowed to be acted on?"
  • aws:TagKeys — evaluated against the tag keys included in the request itself. It answers: "Which tag keys is this request trying to modify?"

aws:ResourceTag applies to existing resources (e.g., modifying or deleting a security group), while aws:RequestTag applies to new resources being created or when tags are being added.

So with the current policy, this scenario is possible:

  1. A security group has red-hat-managed=true
  2. A ec2:DeleteTags call is made targeting key red-hat-managed
  3. IAM evaluates: does the resource have red-hat-managed=true?Yes → Allow
  4. The red-hat-managed tag is deleted
  5. The security group is now orphaned — future statements guarded by aws:ResourceTag/red-hat-managed=true (e.g., DeleteSecurityGroup, SecurityGroupIngressEgress, ManageVPCEndpointWithCondition) no longer match it

The aws:TagKeys condition key is specifically designed to address this. These condition keys can be applied to resource-creating actions that support tagging, as well as the ec2:CreateTags and ec2:DeleteTags actions.

In practice, the CPO's UpdateResourceTags() is unlikely to intentionally delete the red-hat-managed system tag, so this is more of a defense-in-depth / least-privilege concern. But if the credentials were ever misused or if there's a bug in the tag reconciliation logic, this gap could result in orphaned security groups.

The previously proposed fix remains the recommended approach to guard against this:

             "Condition": {
                 "StringEquals": {
                     "aws:ResourceTag/red-hat-managed": "true"
+                },
+                "ForAllValues:StringNotEquals": {
+                    "aws:TagKeys": [
+                        "red-hat-managed"
+                    ]
+                },
+                "Null": {
+                    "aws:TagKeys": "false"
                 }
             }

This ensures: (1) only red-hat-managed resources can be acted on, (2) the red-hat-managed key itself cannot be deleted, and (3) explicit tag keys must always be present in the request (no accidental blanket deletions).

That said, if this is an accepted risk given the operational context of the CPO, it is a valid trade-off — just worth documenting explicitly.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi @ratnam915 Code Rabbit's comment makes sense to me, but if feels making the policy complicated and not look the same as existing policies.

What is your thought? It is possible to test and validate the suggested change?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@feichashao : Hey Siu, the FedRAMP HCP clusters run the same Control Plane Operator with the same UpdateResourceTags() reconciliation logic for the default worker security group. When a customer modifies ResourceTags on their HostedCluster, the CPO needs ec2:CreateTags and ec2:DeleteTags on the SG regardless of whether it's a commercial or GovCloud cluster. The only difference is the ARN partition (arn:aws-us-gov vs arn:aws), which is already reflected in the FedRAMP policy file.

Without this addition, day-2 tag propagation to the default worker SG would fail on FedRAMP HCP clusters with an AccessDenied error.

Agreed that CodeRabbit's concern is valid — I've pushed the fix. Here's the rationale and test results:

You're right that ec2:DeleteTags is already constrained by aws:ResourceTag/red-hat-managed=true, but that condition only controls which resources can be acted on — it doesn't restrict which tag keys can be deleted from those resources. So a DeleteTags call targeting the red-hat-managed key itself would pass the resource tag check (the tag exists → condition met), then delete it, orphaning the SG from all other policy statements that depend on that tag (DeleteSecurityGroup, SecurityGroupIngressEgress, ManageVPCEndpointWithCondition).

The two new conditions are a standard AWS pattern for this:

  • Null: { "aws:TagKeys": "false" } — tag keys must be explicitly specified in every request (prevents blanket deletion)
  • ForAllValues:StringNotEquals: { "aws:TagKeys": ["red-hat-managed"] } — none of the tag keys in the request may be red-hat-managed

In practice, the CPO's UpdateResourceTags() only creates/deletes tags from the MapsDiff() output based on the HostedCluster's ResourceTags spec. It won't try to delete red-hat-managed since that tag is applied at SG creation time, not tracked in the tag reconciliation loop. So this is defense-in-depth rather than fixing a real CPO bug.

I have attached the below document with the changes that i have validated:

https://docs.google.com/document/d/1xa-_TIq3oJwM86UDK3NtARKGUSybjfobljJucdTT7hg/edit?tab=t.0

@openshift-ci openshift-ci Bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Apr 23, 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you help me understand why we need to add this policy to 4.14 fedramp?

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented May 6, 2026

@ratnam915: all tests passed!

Full PR test history. Your PR dashboard.

Details

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-sigs/prow repository. I understand the commands that are listed here.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants