Skip to content

MGMT-19194: Save Agent inventory and status in annotation - #6957

Merged
openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
CrystalChun:testing-govtech-2
Nov 4, 2024
Merged

openshift-merge-bot[bot] merged 1 commit into
openshift:masterfrom
CrystalChun:testing-govtech-2

Conversation

@CrystalChun

Copy link
Copy Markdown
Contributor

For Hypershift's backup and restore of hosted cluster from one hub to a new hub, the Agent requires these status fields to be restored in order for the NodePool to successfully re-adopt the Nodes for the hosted cluster.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested): testing done with govtech environment, see slack thread
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

/cc @danielerez @jhernand @carbonin

@openshift-ci-robot

openshift-ci-robot commented Oct 29, 2024 •

Copy link
Copy Markdown

@CrystalChun: This pull request references MGMT-19194 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 sub-task to target the "4.18.0" version, but no target version was set.

Details

In response to this:

For Hypershift's backup and restore of hosted cluster from one hub to a new hub, the Agent requires these status fields to be restored in order for the NodePool to successfully re-adopt the Nodes for the hosted cluster.

List all the issues related to this PR

  • New Feature
  • Enhancement
  • Bug fix
  • Tests
  • Documentation
  • CI/CD

What environments does this code impact?

  • Automation (CI, tools, etc)
  • Cloud
  • Operator Managed Deployments
  • None

How was this code tested?

  • assisted-test-infra environment
  • dev-scripts environment
  • Reviewer's test appreciated
  • Waiting for CI to do a full test run
  • Manual (Elaborate on how it was tested): testing done with govtech environment, see slack thread
  • No tests needed

Checklist

  • Title and description added to both, commit and PR.
  • Relevant issues have been associated (see CONTRIBUTING guide)
  • This change does not require a documentation update (docstring, docs, README, etc)
  • Does this change include unit-tests (note that code changes require unit-tests)

Reviewers Checklist

  • Are the title and description (in both PR and commit) meaningful and clear?
  • Is there a bug required (and linked) for this change?
  • Should this PR be backported?

/cc @danielerez @jhernand @carbonin

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 Oct 29, 2024
@openshift-ci openshift-ci Bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Oct 29, 2024
@openshift-ci

openshift-ci Bot commented Oct 29, 2024

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CrystalChun

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

The pull request process is described 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 approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 29, 2024
@codecov

codecov Bot commented Oct 29, 2024 •

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 93.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 68.82%. Comparing base (f3d95e1) to head (06f4d75).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
...nternal/controller/controllers/agent_controller.go 93.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #6957   +/-   ##
=======================================
  Coverage   68.81%   68.82%           
=======================================
  Files         251      251           
  Lines       37628    37630    +2     
=======================================
+ Hits        25895    25900    +5     
+ Misses       9416     9414    -2     
+ Partials     2317     2316    -1     
Files with missing lines Coverage Δ
...nternal/controller/controllers/agent_controller.go 76.45% <93.33%> (+0.20%) ⬆️

... and 1 file with indirect coverage changes

@CrystalChun

Copy link
Copy Markdown
Contributor Author

/retest-required

1 similar comment
@CrystalChun

Copy link
Copy Markdown
Contributor Author

/retest-required

@jhernand

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 30, 2024
@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 42c57d5 and 2 for PR HEAD fdcb76bfe76e2700394571360f22eafb2c0d50b9 in total

1 similar comment
@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD 42c57d5 and 2 for PR HEAD fdcb76bfe76e2700394571360f22eafb2c0d50b9 in total

@jhernand

Copy link
Copy Markdown
Contributor

/retest-required

@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD a06654b and 2 for PR HEAD fdcb76bfe76e2700394571360f22eafb2c0d50b9 in total

@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD f3d95e1 and 1 for PR HEAD fdcb76bfe76e2700394571360f22eafb2c0d50b9 in total

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 31, 2024
@jhernand

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Oct 31, 2024
@openshift-ci-robot

Copy link
Copy Markdown

/retest-required

Remaining retests: 0 against base HEAD f3d95e1 and 2 for PR HEAD 990ec8c06a392ec8dc1375e8ea64eef7097456ca in total

@openshift-ci openshift-ci Bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 31, 2024
For Hypershift's backup and restore of hosted cluster
from one hub to a new hub, the Agent requires these
status fields to be restored in order for the NodePool
to successfully re-adopt the Nodes for the hosted cluster.
@CrystalChun

Copy link
Copy Markdown
Contributor Author

/retest-required

@openshift-ci

openshift-ci Bot commented Nov 1, 2024

Copy link
Copy Markdown
Contributor

@CrystalChun: The following test 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/edge-e2e-ai-operator-disconnected-capi 06f4d75 link false /test edge-e2e-ai-operator-disconnected-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.

@jhernand

jhernand commented Nov 4, 2024

Copy link
Copy Markdown
Contributor

/lgtm

@openshift-ci openshift-ci Bot added the lgtm Indicates that a PR is ready to be merged. label Nov 4, 2024
updated := false
updated = setAgentAnnotation(log, agent, AgentStateAnnotation, swag.StringValue(h.Status))
updated = updated || setAgentAnnotation(log, agent, AgentRoleAnnotation, string(h.Role))
if h.Inventory != "" {

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.

Just a minor nit for later, is it crucial to check if inventory is empty?
If not, we can make this func nicer to read I think.
I.e.

updated := false
updated = setAgentAnnotation(log, agent, AgentStateAnnotation, swag.StringValue(h.Status)
updated = setAgentAnnotation(log, agent, AgentRoleAnnotation, string(h.Role)) || updated
updated = setAgentAnnotation(log, agent, AgentInventoryAnnotation, h.Inventory) || updated

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Great suggestion! Will work that into a new PR. Thanks Daniel!!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Small PR with changes: #6967

@openshift-merge-bot
openshift-merge-bot Bot merged commit e971390 into openshift:master Nov 4, 2024
@openshift-bot

Copy link
Copy Markdown
Contributor

[ART PR BUILD NOTIFIER]

Distgit: ose-agent-installer-api-server
This PR has been included in build ose-agent-installer-api-server-container-v4.18.0-202411041337.p0.ge971390.assembly.stream.el9.
All builds following this will include this PR.

CrystalChun added a commit to CrystalChun/assisted-service that referenced this pull request Nov 4, 2024
@CrystalChun

Copy link
Copy Markdown
Contributor Author

/cherry-pick release-ocm-2.12

@openshift-cherrypick-robot

Copy link
Copy Markdown

@CrystalChun: new pull request created: #6968

Details

In response to this:

/cherry-pick release-ocm-2.12

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-merge-bot Bot pushed a commit that referenced this pull request Nov 5, 2024
CrystalChun added a commit to CrystalChun/assisted-service that referenced this pull request Nov 5, 2024
…6957)

For Hypershift's backup and restore of hosted cluster
from one hub to a new hub, the Agent requires these
status fields to be restored in order for the NodePool
to successfully re-adopt the Nodes for the hosted cluster.
openshift-merge-bot Bot pushed a commit that referenced this pull request Nov 6, 2024
* MGMT-18635: Restore missing Host by Agent CR (#6730)

When applying an Agent CR with a missing associated host,
the Agnet CR is currently being deleted by the reconciler.
This scenario would happen on restore to a new hub flows
since the host is a DB only entity.

Thus, this change introduces handling of a missing host
by restoring the object into DB according to properties
from the Agent CR.
For restoring the host's status, added 'state' annotation
to the agent which is set on reconcile.

See full flow and more details in the enhancement:
https://github.com/openshift/assisted-service/blob/master/docs/enhancements/backup-restore-support.md#solution-for-deleted-agent-crs

* MGMT-19194: Save Agent inventory and status in annotation (#6957)

For Hypershift's backup and restore of hosted cluster
from one hub to a new hub, the Agent requires these
status fields to be restored in order for the NodePool
to successfully re-adopt the Nodes for the hosted cluster.

---------

Co-authored-by: Daniel Erez <danielerez@gmail.com>
@CrystalChun
CrystalChun deleted the testing-govtech-2 branch July 25, 2025 16:07
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/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants