Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Add reconciliation wait for repository operations and package update #390

Merged

Conversation

maralavi
Copy link
Contributor

@maralavi maralavi commented Aug 12, 2021

What this PR does / why we need it:

Describe testing done for PR:
Manual testing in the cluster and existing unit tests & integration tests.

Example outputs:

tanzu package repository add test-repo -n test-ns --url <REPOSITORY-URL> --create-namespace

- Validating provided settings for the package repository
/ Creating namespace 'test-ns'
- Creating package repository resource
\ Resource install status: Reconciling

 Added package repository 'test-repo'
anzu package repository delete test-repo -n test-ns 
/ Deleting package repository 'test-repo'
\ Resource deletion status: Deleting

 Deleted package repository 'test-repo' from namespace 'test-ns'

Does this PR introduce a user-facing change?:
None

Release note:

Adds reconciliation wait for package plugin repository operations and package update; also adds progress indicators for repository operations.

New PR Checklist

  • Ensure PR contains only public links or terms
  • Use good commit messages
  • Squash the commits in this branch before merge to preserve our git history
  • If this PR is just an idea or POC, use a Draft PR instead of a full PR
  • Add appropriate kind label according to what type of issue is being addressed.

@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from b18a149 to 69c9425 Compare August 19, 2021 23:04
@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from a2e2be0 to 9f25998 Compare August 20, 2021 06:07
@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 52ad9c3 to 5158c6c Compare September 28, 2021 20:13
@maralavi maralavi added the kind/feature Categorizes issue or PR as related to a new feature label Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from vmwclabot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@vmware-tanzu vmware-tanzu deleted a comment from github-actions bot Sep 28, 2021
@maralavi maralavi added cla-not-required ok-to-merge PRs should be labelled with this before merging and removed ok-to-merge PRs should be labelled with this before merging cla-not-required labels Sep 28, 2021
@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 5158c6c to 43c5a3d Compare September 28, 2021 20:50
@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 325d2ec to 11782fa Compare September 29, 2021 20:46
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929205907/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 11782fa to 46be7b3 Compare September 29, 2021 21:07
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929211716/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 46be7b3 to ab01e97 Compare September 29, 2021 22:31
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929224507/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch 2 times, most recently from e855afb to 145e680 Compare September 29, 2021 23:39
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929234325/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 145e680 to 3322e57 Compare September 29, 2021 23:44
Copy link
Contributor

@blc1996 blc1996 left a comment

Choose a reason for hiding this comment

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

LGTM

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929235038/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210929235411/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@ggpaue ggpaue self-requested a review September 30, 2021 17:32
@ggpaue
Copy link
Contributor

ggpaue commented Sep 30, 2021

LGTM

packageInstallOp.PkgInstallName = args[0]

cmd.SilenceUsage = true
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vijaykatam we ideally want to show the usage info for the cases were there was a mistake from the user on the flags themselves. Putting this in root level, suppresses usage message for such cases too

@@ -0,0 +1,76 @@
// Copyright 2021 VMware, Inc. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

[suggestion]: Consider renaming to display_utils.go so that this file doesn't become a dumping ground for unrelated functions.

"github.com/vmware-tanzu/tanzu-framework/pkg/v1/tkg/tkgpackagedatamodel"
)

func displayProgress(initialMsg string, pp *tkgpackagedatamodel.PackageProgress) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this function be exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At least we don't have a use case for that for now. But sure, will export it; maybe other plugins find it useful.

@@ -104,3 +110,89 @@ func (parser *PackageValuesSchemaParser) walkOnValueSchemaProperties(docMap map[
}
return nil
}

// waitForResourceInstallation waits until the package get installed successfully or a failure happen
func (p *pkgClient) waitForResourceInstallation(name, namespace string, pollInterval, pollTimeout time.Duration, progress chan string, rscType tkgpackagedatamodel.ResourceType) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

I am confused why these functions are in utils but still have pkgClient as a receiver. If these are indeed generic utilities then the functions should be exported with their own struct type such as PackageValuesSchemaParser and additionally we should add unit test coverage.

Copy link
Contributor Author

@maralavi maralavi Sep 30, 2021

Choose a reason for hiding this comment

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

@vijaykatam I had added in utils for package plugin assuming it was a file for shared functions and I wasn't planning to make these two functions generic for any other type. But as these functions rely on the functions defined in the pkgClient receiver and cause they are used by package and repository install, update, delete and they have become confusing the the utils.go, I just moved those to say package install and delete, as unit tests related to these wait functionalities are already in those corresponding test files.

Signed-off-by: Marjan Alavi <malavi@vmware.com>
Signed-off-by: Marjan Alavi <malavi@vmware.com>
@maralavi maralavi force-pushed the package-plugin-add-reconcilliation-wait branch from 3322e57 to ba67b38 Compare September 30, 2021 23:00
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/390/20210930231207/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@vijaykatam vijaykatam added the ok-to-merge PRs should be labelled with this before merging label Sep 30, 2021
@maralavi maralavi merged commit d15a82a into vmware-tanzu:main Oct 1, 2021
@maralavi maralavi deleted the package-plugin-add-reconcilliation-wait branch October 1, 2021 16:41
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/addons area/cli area/plugin kind/enhancement Categorizes issue or PR as related to an enhancement ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tanzu package installed update ... --wait does not wait CLI plugins should not print usage unless -h is used
6 participants