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 Prism-based topology discovery #18

Merged
merged 1 commit into from
Aug 9, 2022
Merged

Conversation

yannickstruyf3
Copy link
Contributor

What this PR does / why we need it:
Allows Category based topology and also Prism based topology (PC = Region, PE=Zone). Also makes enabling custom labels optional.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
N/A

How Has This Been Tested?:
make unit-test

Ran 62 of 62 Specs in 0.210 seconds
SUCCESS! -- 62 Passed | 0 Failed | 0 Pending | 0 Skipped
--- PASS: TestCloudProviderNutanix (0.21s)
PASS
coverage: 83.0% of statements

Special notes for your reviewer:
This PR changes the configmap structure used by CCM

Release note:

- Adds Topology discovery based on Prism where PC indicates region and PE zone

return nutanixConfig, fmt.Errorf("topologyCategories must be set when using topology discovery type: %s", CategoriesTopologyDiscoveryType)
}
default:
return nutanixConfig, fmt.Errorf("unsupported topology discovery type: %s", nutanixConfig.TopologyDiscovery.Type)
Copy link
Contributor

Choose a reason for hiding this comment

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

Define errors as package variables. This enables client code to distinguish between different types of errors for granular error handling and documentation of errors.

nutanixConfig.TopologyDiscovery.Type = PrismTopologyDiscoveryType
case CategoriesTopologyDiscoveryType:
if nutanixConfig.TopologyDiscovery.TopologyCategories == nil {
return nutanixConfig, fmt.Errorf("topologyCategories must be set when using topology discovery type: %s", CategoriesTopologyDiscoveryType)
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar to bellow

pkg/provider/instances_v2_test.go Show resolved Hide resolved
Expect(err).ToNot(HaveOccurred())
cReader := bytes.NewReader(cBytes)
_, err = newNtnxCloud(cReader)
Expect(err).To(HaveOccurred())
Copy link
Contributor

Choose a reason for hiding this comment

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

If you defined errors as package variables you could compare explicitly

@github-actions
Copy link

github-actions bot commented Aug 8, 2022

✅ None of your dependencies violate policy!

@thunderboltsid
Copy link
Contributor

+1 on @heiko-koehler suggestion on an errors package for unifying error categories and specific errors as directly referenceable for testing assertions. However, we can do that refactoring in a separate PR.

@tuxtof tuxtof merged commit 547c2a3 into main Aug 9, 2022
@tuxtof tuxtof deleted the feat/prism-topology-discovery branch August 9, 2022 11:32
@tuxtof tuxtof added the enhancement New feature or request label Aug 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants