Skip to content
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

MGMT-18437: Use consumer label on ACI for data collection #117

Merged

Conversation

CrystalChun
Copy link
Collaborator

@CrystalChun CrystalChun commented Mar 31, 2025

When collecting on-premises data, it's useful to know when a cluster is being used by this controller. This adds the consumer label to the AgentClusterInstall so that the cluster may be identified when data is collected from assisted-service.

agentclusterinstalls.agent-install.openshift.io/consumer: OpenshiftAssistedControlPlane

Summary by CodeRabbit

  • New Features

    • Enhanced cluster management by applying clear identification tags to cluster installation objects to improve categorization.
  • Tests

    • Strengthened validations to ensure that deployment objects are correctly associated with their respective clusters.
  • Chores

    • Upgraded dependencies for related assisted service components to the latest versions, ensuring enhanced functionality and reliability.

Upgrade to version v0.0.0-20250331101551-1de1416d9f90
to pull in the new AgentClusterInstall consumer
label.
To identify this cluster is being used by the CAPI Openshift
Assisted controllers, we'll add the consumer label on
the AgentClusterInstall with the value set to this controller's name.
@CrystalChun CrystalChun requested a review from rccrdpccl March 31, 2025 18:53
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 31, 2025

@CrystalChun: This pull request references MGMT-18437 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 "4.19.0" version, but no target version was set.

In response to this:

When collecting on-premises data, it's useful to know when a cluster is being used by this controller. This adds the consumer label to the AgentClusterInstall so that the cluster may be identified when data is collected from assisted-service.

agentclusterinstalls.agent-install.openshift.io/consumer: OpenshiftAssistedControlPlane

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.

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Mar 31, 2025
@openshift-ci openshift-ci bot requested a review from gamli75 March 31, 2025 18:53
Copy link

coderabbitai bot commented Mar 31, 2025

Walkthrough

The changes update the ClusterDeployment controller to assign an additional label to the AgentClusterInstall (ACI) object. The controller now sets ClusterConsumerLabel within the computeAgentClusterInstall function. The test suite is modified to use a new instantiation method that includes an owner cluster parameter and checks for the proper label settings. Additionally, dependency versions for the assisted-service API and models are updated in the go.mod file.

Changes

Files Change Summary
controlplane/.../clusterdeployment_controller.go Added label assignment in computeAgentClusterInstall to set ClusterConsumerLabel on the ACI object
controlplane/.../clusterdeployment_controller_test.go Replaced cluster deployment instantiation with NewClusterDeploymentWithOwnerCluster, and added assertions for verifying ACI label assignments
go.mod Updated versions for github.com/openshift/assisted-service/api and .../models to newer releases

Sequence Diagram(s)

sequenceDiagram
    participant Test as Test Suite
    participant Controller as ClusterDeployment Controller
    participant ACI as AgentClusterInstall

    Test->>Controller: Invoke reconciliation process
    Controller->>ACI: Create ACI object
    Controller->>ACI: Set labels (including ClusterConsumerLabel)
    ACI-->>Controller: Return labeled ACI object
    Controller-->>Test: Processed outcome with proper labeling
Loading

Poem

I am a rabbit in a code-filled land,
Hopping through commits, oh so grand.
Labels now shine with a brilliant glow,
Guiding clusters where they need to go.
With each line and test so neat,
I celebrate this change with a joyful beat!

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (1.64.8)

level=warning msg="The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar."
level=error msg="[linters_context] exportloopref: This linter is fully inactivated: it will not produce any reports."
{"Issues":[],"Report":{"Warnings":[{"Text":"The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar."}],"Linters":[{"Name":"asasalint"},{"Name":"asciicheck"},{"Name":"bidichk"},{"Name":"bodyclose"},{"Name":"canonicalheader"},{"Name":"containedctx"},{"Name":"contextcheck"},{"Name":"copyloopvar"},{"Name":"cyclop"},{"Name":"decorder"},{"Name":"deadcode"},{"Name":"depguard"},{"Name":"dogsled"},{"Name":"dupl","Enabled":true},{"Name":"dupword"},{"Name":"durationcheck"},{"Name":"errcheck","Enabled":true,"EnabledByDefault":true},{"Name":"errchkjson"},{"Name":"errname"},{"Name":"errorlint"},{"Name":"execinquery"},{"Name":"exhaustive"},{"Name":"exhaustivestruct"},{"Name":"exhaustruct"},{"Name":"exportloopref","Enabled":true},{"Name":"exptostd"},{"Name":"forbidigo"},{"Name":"forcetypeassert"},{"Name":"fatcontext"},{"Name":"funlen"},{"Name":"gci"},{"Name":"ginkgolinter"},{"Name":"gocheckcompilerdirectives"},{"Name":"gochecknoglobals"},{"Name":"gochecknoinits"},{"Name":"gochecksumtype"},{"Name":"gocognit"},{"Name":"goconst","Enabled":true},{"Name":"gocritic"},{"Name":"gocyclo","Enabled":true},{"Name":"godot"},{"Name":"godox"},{"Name":"err113"},{"Name":"gofmt","Enabled":true},{"Name":"gofumpt"},{"Name":"goheader"},{"Name":"goimports","Enabled":true},{"Name":"golint"},{"Name":"mnd"},{"Name":"gomnd"},{"Name":"gomoddirectives"},{"Name":"gomodguard"},{"Name":"goprintffuncname"},{"Name":"gosec"},{"Name":"gosimple","Enabled":true,"EnabledByDefault":true},{"Name":"gosmopolitan"},{"Name":"govet","Enabled":true,"EnabledByDefault":true},{"Name":"grouper"},{"Name":"ifshort"},{"Name":"iface"},{"Name":"importas"},{"Name":"inamedparam"},{"Name":"ineffassign","Enabled":true,"EnabledByDefault":true},{"Name":"interfacebloat"},{"Name":"interfacer"},{"Name":"intrange"},{"Name":"ireturn"},{"Name":"lll","Enabled":true},{"Name":"loggercheck"},{"Name":"maintidx"},{"Name":"makezero"},{"Name":"maligned"},{"Name":"mirror"},{"Name":"misspell","Enabled":true},{"Name":"musttag"},{"Name":"nakedret","Enabled":true},{"Name":"nestif"},{"Name":"nilerr"},{"Name":"nilnesserr"},{"Name":"nilnil"},{"Name":"nlreturn"},{"Name":"noctx"},{"Name":"nonamedreturns"},{"Name":"nosnakecase"},{"Name":"nosprintfhostport"},{"Name":"paralleltest"},{"Name":"perfsprint"},{"Name":"prealloc","Enabled":true},{"Name":"predeclared"},{"Name":"promlinter"},{"Name":"protogetter"},{"Name":"reassign"},{"Name":"recvcheck"},{"Name":"revive"},{"Name":"rowserrcheck"},{"Name":"sloglint"},{"Name":"scopelint"},{"Name":"sqlclosecheck"},{"Name":"spancheck"},{"Name":"staticcheck","Enabled":true,"EnabledByDefault":true},{"Name":"structcheck"},{"Name":"stylecheck"},{"Name":"tagalign"},{"Name":"tagliatelle"},{"Name":"tenv"},{"Name":"testableexamples"},{"Name":"testifylint"},{"Name":"testpackage"},{"Name":"thelper"},{"Name":"tparallel"},{"Name":"typecheck","Enabled":true,"EnabledByDefault":true},{"Name":"unconvert","Enabled":true},{"Name":"unparam","Enabled":true},{"Name":"unused","Enabled":true,"EnabledByDefault":true},{"Name":"usestdlibvars"},{"Name":"usetesting"},{"Name":"varcheck"},{"Name":"varnamelen"},{"Name":"wastedassign"},{"Name":"whitespace"},{"Name":"wrapcheck"},{"Name":"wsl"},{"Name":"zerologlint"},{"Name":"nolintlint"}],"Error":"exportloopref: This linter is fully inactivated: it will not produce any reports."}}


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7bef640 and 12ef821.

⛔ Files ignored due to path filters (10)
  • go.sum is excluded by !**/*.sum
  • vendor/github.com/openshift/assisted-service/api/hiveextension/v1beta1/agentclusterinstall_types.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/bundle.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/cluster.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/cluster_validation_id.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/feature_support_level_id.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/host_validation_id.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/install_cmd_request.go is excluded by !vendor/**
  • vendor/github.com/openshift/assisted-service/models/monitored_operator.go is excluded by !vendor/**
  • vendor/modules.txt is excluded by !vendor/**
📒 Files selected for processing (3)
  • controlplane/internal/controller/clusterdeployment_controller.go (1 hunks)
  • controlplane/internal/controller/clusterdeployment_controller_test.go (2 hunks)
  • go.mod (1 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
controlplane/internal/controller/clusterdeployment_controller_test.go (1)
test/utils/unit.go (1)
  • NewClusterDeploymentWithOwnerCluster (48-54)
🔇 Additional comments (4)
controlplane/internal/controller/clusterdeployment_controller.go (1)

250-250: Review of added consumer label to AgentClusterInstall object.

This line adds the ClusterConsumerLabel to identify clusters utilized by the controller during data collection from the assisted-service, which aligns with the PR objective. The implementation is clean and straightforward.

go.mod (1)

132-133: Dependency versions updated appropriately.

The update to newer versions of the assisted-service API and models (from February to March 2025) is necessary to support the new consumer label functionality.

controlplane/internal/controller/clusterdeployment_controller_test.go (2)

107-107: Updated test to use proper cluster deployment initialization.

Good change to use NewClusterDeploymentWithOwnerCluster instead of NewClusterDeployment, which ensures the ClusterDeployment object has the proper owner cluster reference for testing.


159-167: Comprehensive test assertions for the new consumer label.

These assertions thoroughly verify that the AgentClusterInstall object has all the expected labels, including the newly added ClusterConsumerLabel. The tests check both the presence of the label keys and their correct values, providing good test coverage for the implementation.

✨ Finishing Touches
  • 🔥 Error while generating docstrings. (🔄 Check again to generate docstrings again)

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@openshift-ci openshift-ci bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 31, 2025
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 31, 2025

@CrystalChun: This pull request references MGMT-18437 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 "4.19.0" version, but no target version was set.

In response to this:

When collecting on-premises data, it's useful to know when a cluster is being used by this controller. This adds the consumer label to the AgentClusterInstall so that the cluster may be identified when data is collected from assisted-service.

agentclusterinstalls.agent-install.openshift.io/consumer: OpenshiftAssistedControlPlane

Summary by CodeRabbit

  • New Features

  • Enhanced cluster management by applying clear identification tags to cluster installation objects to improve categorization.

  • Tests

  • Strengthened validations to ensure that deployment objects are correctly associated with their respective clusters.

  • Chores

  • Upgraded dependencies for related assisted service components to the latest versions, ensuring enhanced functionality and reliability.

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.

@openshift-assisted openshift-assisted deleted a comment from coderabbitai bot Mar 31, 2025
@rccrdpccl
Copy link
Contributor

/lgtm
/approve

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2025
Copy link

openshift-ci bot commented Apr 1, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CrystalChun, rccrdpccl

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [CrystalChun,rccrdpccl]

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

@openshift-merge-bot openshift-merge-bot bot merged commit 5300f6d into openshift-assisted:master Apr 1, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. 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. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants