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

Add doc in vsphere error message & improve verbose logging output #9400

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

charles-large
Copy link
Member

@charles-large charles-large commented Mar 11, 2025

Issue #, if available:
3055
Description of changes:

  • When a user tries to create a vSphere cluster and does not have sufficient permissions, a documentation link to our vSphere permissions docs is now added along with a tip on increasing verbosity for additional info.
  • Verbose logging output of missing permissions is now output in JSON and indicated as so, versus YAML for easier identification and parsing.

Testing (if applicable):
modified existing test in vsphere_test.go

Documentation added/planned (if applicable):

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@eks-distro-bot
Copy link
Collaborator

[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 ask for approval from charles-large. For more information see the Kubernetes Code Review Process.

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

@eks-distro-bot eks-distro-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 11, 2025
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.46%. Comparing base (f85166a) to head (63f20c0).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9400   +/-   ##
=======================================
  Coverage   69.46%   69.46%           
=======================================
  Files         672      672           
  Lines       49360    49361    +1     
=======================================
+ Hits        34286    34287    +1     
  Misses      13288    13288           
  Partials     1786     1786           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@charles-large charles-large force-pushed the iss3055 branch 2 times, most recently from 27d19f3 to 71d5c4c Compare March 11, 2025 22:34
@eks-distro-bot eks-distro-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 11, 2025
@charles-large
Copy link
Member Author

charles-large commented Mar 11, 2025

Previous log message example

❌ Validation failed {"validation": "vsphere Provider setup is valid", "error": "validating vsphere user privileges: user [email protected] missing vSphere permissions", "remediation": ""}

New log message example

❌ Validation failed {"validation": "vsphere Provider setup is valid", "error": "validating vsphere user privileges: user [email protected] missing vSphere permissions | See required permissions at: https://anywhere.eks.amazonaws.com/docs/getting-started/vsphere/vsphere-preparation/ | Use -v 3 for full missing permissions", "remediation": ""}

Verbose logging change example

Previous
{"Permissions": "- username: [email protected]\n objectType: Folder\n path: /\n permissions:\n - ContentLibrary.AddLibraryItem\n - ContentLibrary.CheckInTemplate\n - ContentLibrary.CheckOutTemplate\n - ContentLibrary.CreateLocalLibrary\n - ContentLibrary.UpdateSession\n - InventoryService.Tagging.AttachTag\n - InventoryService.Tagging.CreateCategory\n ...}

New
{"Missing Permissions (JSON)": [{"Username":"[email protected]","ObjectType":"Folder","Path":"/","Permissions":["ContentLibrary.UpdateSession","InventoryService.Tagging.AttachTag","InventoryService.Tagging.CreateCategory","InventoryService.Tagging.CreateTag" ...]}

@charles-large
Copy link
Member Author

/retest

@@ -376,7 +381,7 @@ func (p *vsphereProvider) SetupAndValidateCreateCluster(ctx context.Context, clu

if !p.skippedValidations[validations.VSphereUserPriv] {
if err := p.validator.validateVsphereUserPrivs(ctx, vSphereClusterSpec); err != nil {
return fmt.Errorf("validating vsphere user privileges: %v", err)
return fmt.Errorf("validating vsphere user privileges: %v | See required permissions at: %s | Use -v 3 for full missing permissions", err, vSpherePermissionDoc)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
return fmt.Errorf("validating vsphere user privileges: %v | See required permissions at: %s | Use -v 3 for full missing permissions", err, vSpherePermissionDoc)
return fmt.Errorf("validating vsphere user privileges: %w, please refer to %s for required permissions or use -v 3 for full missing permissions", err, vSpherePermissionDoc)

@2ez4szliu
Copy link
Member

/override

@eks-distro-bot
Copy link
Collaborator

@2ez4szliu: /override requires failed status contexts to operate on, but none was given

In response to this:

/override

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

3 participants