Skip to content

OCPBUGS-88035: Add e2e test verifying CAPI EC2 instance ownership tag#594

Open
matzew wants to merge 1 commit into
openshift:mainfrom
matzew:OCPBUGS-88035-aws-ownership-tag-test
Open

OCPBUGS-88035: Add e2e test verifying CAPI EC2 instance ownership tag#594
matzew wants to merge 1 commit into
openshift:mainfrom
matzew:OCPBUGS-88035-aws-ownership-tag-test

Conversation

@matzew

@matzew matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member

Verify that a CAPI-created EC2 instance has the
kubernetes.io/cluster/=owned tag that openshift-install destroy cluster relies on to identify and clean up cloud resources.

CAPA may already add this tag automatically via its Build() + WithCloudProvider() tag pipeline. This test confirms whether the tag is present without any explicit AdditionalTags on the AWSCluster object.

Summary by CodeRabbit

  • Tests
    • Enhanced AWS end-to-end testing with additional verification to confirm EC2 instances are properly tagged with cluster ownership information. The test now validates that instances provisioned through the cluster API provider contain the required Kubernetes cluster ownership tag, ensuring proper resource management, accurate tracking of cluster-owned resources, and compliance with tagging standards.

@openshift-ci-robot openshift-ci-robot added jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@matzew: This pull request references Jira Issue OCPBUGS-88035, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

Details

In response to this:

Verify that a CAPI-created EC2 instance has the
kubernetes.io/cluster/=owned tag that openshift-install destroy cluster relies on to identify and clean up cloud resources.

CAPA may already add this tag automatically via its Build() + WithCloudProvider() tag pipeline. This test confirms whether the tag is present without any explicit AdditionalTags on the AWSCluster object.

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

coderabbitai Bot commented Jun 11, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@matzew, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 11 minutes and 15 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more credits in the billing tab to continue.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 38a71978-4728-45dc-bb5c-161fec4bfb33

📥 Commits

Reviewing files that changed from the base of the PR and between 6a9fe4a and eaf2b33.

📒 Files selected for processing (2)
  • e2e/aws_helpers.go
  • e2e/aws_test.go

Walkthrough

This PR adds a test helper function that verifies EC2 instances created by Cluster API contain the Kubernetes cluster ownership tag, then calls this verification in the AWS E2E test after creating and confirming MachineSet readiness.

Changes

CAPI Instance Ownership Tag Verification

Layer / File(s) Summary
CAPI instance ownership tag verification
e2e/aws_helpers.go, e2e/aws_test.go
Helper function verifyCAPIInstanceOwnershipTag fetches the EC2 instance backing a CAPI AWSMachineSet, iterates through instance tags, and asserts the presence of the kubernetes.io/cluster/<infraName>=owned ownership tag. The verification is called in the default provider spec test after MachineSet readiness.

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 13 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Test Structure And Quality ⚠️ Warning The verifyCAPIInstanceOwnershipTag function lacks timeout handling for EC2 tag visibility. It performs a single-shot assertion without Eventually(), which can fail intermittently due to tag propaga... Wrap the tag check in Eventually(..., framework.WaitLong, framework.RetryShort) and re-fetch the instance each poll, following the codebase pattern used elsewhere.
Microshift Test Compatibility ⚠️ Warning New e2e test uses machine.openshift.io API (mapiv1beta1.MachineSet) and config.openshift.io Infrastructure which are unavailable on MicroShift. Test lacks [apigroup:...] tag or [Skipped:MicroShift]... Add [apigroup:machine.openshift.io] tag to test name or add [Skipped:MicroShift] label. Recommended: Add [apigroup:machine.openshift.io] to "should be able to run a machine with a default provider spec" test.
✅ Passed checks (13 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an e2e test that verifies CAPI EC2 instance ownership tag, which matches the code additions in aws_helpers.go and aws_test.go.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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 All Ginkgo test declarations in the PR use stable, static test names: "Cluster API AWS MachineSet" and "should be able to run a machine with a default provider spec". No dynamic values are embedded...
Single Node Openshift (Sno) Test Compatibility ✅ Passed Test creates 1 MachineSet replica and makes no multi-node assumptions; compatible with SNO. The test setup skips on non-AWS platforms, which is appropriate.
Topology-Aware Scheduling Compatibility ✅ Passed Changes are limited to E2E test files (e2e/aws_helpers.go and e2e/aws_test.go), not deployment manifests, operator code, or controllers. No topology-aware scheduling constraints were introduced.
Ote Binary Stdout Contract ✅ Passed New code in aws_helpers.go and aws_test.go contains no process-level stdout writes; function properly uses GinkgoHelper() and test assertions, called from within It() blocks.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The new e2e test code contains no hardcoded IPv4 addresses, IPv4-only parsing logic, external connectivity requirements, or public registry pulls; it uses AWS EC2 and Kubernetes APIs configured for...
No-Weak-Crypto ✅ Passed The PR adds test code for verifying AWS EC2 instance ownership tags. No weak crypto (MD5, SHA1, DES, RC4, 3DES, Blowfish, ECB), custom crypto implementations, or non-constant-time secret comparison...
Container-Privileges ✅ Passed PR adds only Go test code (e2e/aws_helpers.go and e2e/aws_test.go) with no container/K8s manifests or privileged container configurations introduced.
No-Sensitive-Data-In-Logs ✅ Passed The code only logs a test status message and a tag key name (kubernetes.io/cluster/), neither of which constitutes sensitive data like passwords, tokens, API keys, or PII.

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

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

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-merge-bot

Copy link
Copy Markdown
Contributor

Pipeline controller notification
This repo is configured to use the pipeline controller. Second-stage tests will be triggered either automatically or after lgtm label is added, depending on the repository configuration. The pipeline controller will automatically detect which contexts are required and will utilize /test Prow commands to trigger the second stage.

For optional jobs, comment /test ? to see a list of all defined jobs. To trigger manually all jobs from second stage use /pipeline required command.

This repository is configured in: LGTM mode

@openshift-ci openshift-ci Bot requested review from mdbooth and nrb June 11, 2026 07:10
@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign theobarberbany 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@e2e/aws_helpers.go`:
- Around line 224-235: The single-shot assertion on EC2 tags can flake due to
propagation lag; wrap the ownership-tag check in an Eventually block that
re-fetches the instance each poll using getCAPICreatedInstance(awsClient,
capiMsName), inspect instance.Tags for the expectedTagKey
(fmt.Sprintf("kubernetes.io/cluster/%s", infraName)) and value "owned", and
assert Expect(found).To(BeTrue()) inside Eventually with a reasonable timeout
and poll interval so the test retries until the tag appears.
🪄 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 YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 076f6d18-6e47-4e93-9bb9-d5143ffd5b5f

📥 Commits

Reviewing files that changed from the base of the PR and between 05c113e and 6a9fe4a.

📒 Files selected for processing (2)
  • e2e/aws_helpers.go
  • e2e/aws_test.go

Comment thread e2e/aws_helpers.go Outdated
Verify that a CAPI-created EC2 instance has the
kubernetes.io/cluster/<infraID>=owned tag that openshift-install
destroy cluster relies on to identify and clean up cloud resources.

CAPA may already add this tag automatically via its Build() +
WithCloudProvider() tag pipeline. This test confirms whether the tag
is present without any explicit AdditionalTags on the AWSCluster
object.

Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>
@matzew matzew force-pushed the OCPBUGS-88035-aws-ownership-tag-test branch from 6a9fe4a to eaf2b33 Compare June 11, 2026 07:58
@matzew

matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/retest

@mdbooth

mdbooth commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Jun 11, 2026
@openshift-merge-bot

Copy link
Copy Markdown
Contributor

Scheduling tests matching the pipeline_run_if_changed or not excluded by pipeline_skip_if_only_changed parameters:
/test e2e-aws-capi-disconnected-techpreview
/test e2e-aws-capi-techpreview
/test e2e-aws-capi-techpreview-post-install
/test e2e-aws-ovn
/test e2e-aws-ovn-serial-1of2
/test e2e-aws-ovn-serial-2of2
/test e2e-aws-ovn-techpreview
/test e2e-aws-ovn-techpreview-upgrade
/test e2e-azure-capi-techpreview
/test e2e-azure-ovn-techpreview
/test e2e-azure-ovn-techpreview-upgrade
/test e2e-gcp-capi-techpreview
/test e2e-gcp-ovn-techpreview
/test e2e-metal3-capi-techpreview
/test e2e-openstack-capi-techpreview
/test e2e-openstack-ovn-techpreview
/test e2e-vsphere-capi-techpreview
/test regression-clusterinfra-aws-ipi-techpreview-capi

@matzew

matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@matzew: This pull request references Jira Issue OCPBUGS-88035, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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.

@matzew

matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot

Copy link
Copy Markdown

@matzew: This pull request references Jira Issue OCPBUGS-88035, which is invalid:

  • expected the bug to target the "5.0.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

Details

In response to this:

/jira refresh

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.

@matzew

matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Jun 11, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@matzew: This pull request references Jira Issue OCPBUGS-88035, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (5.0.0) matches configured target version for branch (5.0.0)
  • bug is in the state New, which is one of the valid states (NEW, ASSIGNED, POST)
Details

In response to this:

/jira refresh

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.

@matzew

matzew commented Jun 11, 2026

Copy link
Copy Markdown
Member Author

/retest

@mdbooth

mdbooth commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Permafailing:
/override ci/prow/e2e-openstack-ovn-techpreview

@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@mdbooth: Overrode contexts on behalf of mdbooth: ci/prow/e2e-openstack-ovn-techpreview

Details

In response to this:

Permafailing:
/override ci/prow/e2e-openstack-ovn-techpreview

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.

@openshift-ci

openshift-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

@matzew: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn-techpreview eaf2b33 link true /test e2e-gcp-ovn-techpreview
ci/prow/e2e-azure-ovn-techpreview eaf2b33 link false /test e2e-azure-ovn-techpreview
ci/prow/e2e-azure-ovn-techpreview-upgrade eaf2b33 link true /test e2e-azure-ovn-techpreview-upgrade
ci/prow/e2e-aws-ovn-techpreview-upgrade eaf2b33 link true /test e2e-aws-ovn-techpreview-upgrade
ci/prow/e2e-aws-capi-techpreview-post-install eaf2b33 link true /test e2e-aws-capi-techpreview-post-install
ci/prow/e2e-aws-ovn-techpreview eaf2b33 link true /test e2e-aws-ovn-techpreview
ci/prow/regression-clusterinfra-aws-ipi-techpreview-capi eaf2b33 link false /test regression-clusterinfra-aws-ipi-techpreview-capi

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.

@damdo

damdo commented Jun 19, 2026

Copy link
Copy Markdown
Member

@mdbooth as this change only affects the CAPI e2e operator tests, I think we can override all the other unrelated failures presubs.

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

Labels

jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants