cli-utils icon indicating copy to clipboard operation
cli-utils copied to clipboard

[WIP] chore: Store inventory objs in TaskContext

Open karlkfi opened this issue 3 years ago • 6 comments

This is not ready for review. Will probably need to be split into multiple PRs.

  • Replace InventoryInfo interface with simple struct (ObjectRef + ID)
  • Rename multiple objects & methods in the inventory package to reduce stuttering/repetition
    • InventoryInfo -> Info (new API)
    • InventoryClient -> Client (new API)
    • InventoryClientFactory -> ClientFactory
    • ClusterInventoryClient -> ConfigMapClient (specific to ConfigMap impl)
    • ClusterInventoryClientFactory -> ConfigMapClientFactory (specific to ConfigMap impl)
    • FakeInventoryClient -> FakeClient
    • FakeInventoryClientFactory -> FakeClientFactory
  • Redesign inventory.Client interface to use the Inventory object struct as input/output
    • Merge/Replace -> Store
    • Move InvClient.ApplyInventoryNamespace into InvAddTask (not specific to client impl)
  • Replace inventory.Storage with Converter interface to make the ClusterClient easier to implement.
    • Update e2e tests to the the Converter instead of different InventoryConfig funcs.
  • Modify inventory tasks to use the Inventory in the TaskContext
  • Modify Inventory to satisfy client.Object
    • Use metav1.TypeMeta & metav1.ObjectMeta to satisfy runtime.Object
    • Move Inventory to /pkg/apis/actuation/ to make it easier to run deepcopy-gen
    • Add deepcopy-gen to generate DeepCopy methods on the Inventory objects, so it satisfies client.Object
    • Add conversion-gen to generate version conversion methods in case we want to version the Inventory resource API
    • Add run-in-gopath.sh required to run deepcopy-gen/conversion-gen from outside GOPATH
  • Rename inventory.AddInventoryIDAnnotation -> SetOwningInventoryAnnotation
  • Replace Pruner.GetPruneObjs with inventory.ObjectManager.GetSpecObjects for use in applier/destroyer for both apply & prune.
  • Remove duplicate sorting from applier/destroyer (only the solver needs to sort)
  • Change verbose logs with YAML to level 7
  • Use testutil.AssertEqual in Pruner tests to aid debugging failures
  • Add logs to aid debugging
  • Add inventory.InMemoryClient for testing that doesn't need to fake out REST calls

BREAKING CHANGE: Removed InventoryStrategy (only uses name now) BREAKING CHANGE: Redesigned inventory Client, Factory, Info, & Storage BREAKING CHANGE: Move inventory.Inventory to actuation.Inventory (under pkg/apis/)

TODO:

  • Extract Inventory API change: https://github.com/kubernetes-sigs/cli-utils/pull/542
  • Undo KubectlPrinterAdapter changes
  • Update inventory.Client to enable SSA/CSA (can punt, the current impl doesn't have it)
  • Remove InventoryStrategy remnants
  • Remove extra code in DeleteInvTask & replace with a InvSetTask (to fix https://github.com/kubernetes-sigs/cli-utils/issues/536)
  • Fix TestDeleteInvTask to use inventory.FakeClient
  • Replace InvSetTask logic with Inventory.Spec.Object changes in other Tasks.

karlkfi avatar Feb 08 '22 20:02 karlkfi

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: karlkfi To complete the pull request process, please assign liujingfang1 after the PR has been reviewed. You can assign the PR to them by writing /assign @liujingfang1 in a comment when ready.

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

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

k8s-ci-robot avatar Feb 08 '22 20:02 k8s-ci-robot

@karlkfi: PR needs rebase.

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/test-infra repository.

k8s-ci-robot avatar Feb 11 '22 01:02 k8s-ci-robot

@karlkfi: 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
cli-utils-presubmit-master-stress 0bb5dd3dc5bba6495f2a0b9748c5dfaf03b2418a link true /test cli-utils-presubmit-master-stress

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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

k8s-ci-robot avatar Apr 05 '22 16:04 k8s-ci-robot

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Jul 04 '22 16:07 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Aug 03 '22 17:08 k8s-triage-robot

/remove-lifecycle rotten

karlkfi avatar Aug 11 '22 18:08 karlkfi

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

k8s-triage-robot avatar Nov 09 '22 18:11 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

k8s-triage-robot avatar Dec 09 '22 19:12 k8s-triage-robot

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

k8s-triage-robot avatar Jan 08 '23 19:01 k8s-triage-robot

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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/test-infra repository.

k8s-ci-robot avatar Jan 08 '23 19:01 k8s-ci-robot