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

Move ad map to spec #228

Closed

Conversation

shyamradhakrishnan
Copy link
Contributor

What this PR does / why we need it:
Move ad map to spec. This will enable users to specify AD information in the cluster spec.

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

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 20, 2023
@shyamradhakrishnan
Copy link
Contributor Author

e2e test

SynchronizedAfterSuite] PASSED [0.947 seconds]
[SynchronizedAfterSuite]
/home/ubuntu/go/src/github.com/oracle/cluster-api-provider-oci/test/e2e/e2e_suite_test.go:252

  Timeline >>
  STEP: Tearing down the management cluster @ 03/20/23 11:59:16.308
  << Timeline
------------------------------

Ran 6 of 26 Specs in 3794.662 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 20 Skipped

@shyamradhakrishnan
Copy link
Contributor Author

unit test

➜  ~/go/src/github.com/oracle/cluster-api-provider-oci git:(move_ad_map_to_spec) ✗ make test-cover
GOBIN=/Users/shyaradh/go/src/github.com/oracle/cluster-api-provider-oci/hack/tools/bin ./scripts/go_install.sh sigs.k8s.io/controller-runtime/tools/setup-envtest setup-envtest v0.0.0-20230131074648-f5014c077fc3
kube-builder assets: /Users/shyaradh/Library/Application Support/io.kubebuilder.envtest/k8s/1.24.2-darwin-arm64
KUBEBUILDER_ASSETS="/Users/shyaradh/Library/Application Support/io.kubebuilder.envtest/k8s/1.24.2-darwin-arm64" go test -coverprofile=coverage.out ./...
?   	github.com/oracle/cluster-api-provider-oci	[no test files]
ok  	github.com/oracle/cluster-api-provider-oci/api/v1beta1	0.911s	coverage: 16.3% of statements
?   	github.com/oracle/cluster-api-provider-oci/cloud/config	[no test files]
ok  	github.com/oracle/cluster-api-provider-oci/cloud/ociutil	0.812s	coverage: 25.0% of statements
ok  	github.com/oracle/cluster-api-provider-oci/cloud/scope	166.562s	coverage: 76.5% of statements
?   	github.com/oracle/cluster-api-provider-oci/cloud/scope/mocks	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/base	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/base/mock_base	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/compute	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/compute/mock_compute	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/computemanagement/mock_computemanagement	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/containerengine/mock_containerengine	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/identity	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/identity/mock_identity	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/networkloadbalancer/mock_nlb	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/vcn	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/vcn/mock_vcn	[no test files]
ok  	github.com/oracle/cluster-api-provider-oci/cloud/util	1.205s	coverage: 60.0% of statements
ok  	github.com/oracle/cluster-api-provider-oci/controllers	27.651s	coverage: 67.6% of statements
ok  	github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1	0.416s	coverage: 10.9% of statements
ok  	github.com/oracle/cluster-api-provider-oci/exp/controllers	2.149s	coverage: 56.3% of statements
?   	github.com/oracle/cluster-api-provider-oci/feature	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/version	[no test files]
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html

for i, ad := range respAd.Items {
s.SetFailureDomain(strconv.Itoa(i+1), clusterv1.FailureDomainSpec{
for k := range adMap {
adIndex := strings.LastIndexAny(k, "-")
Copy link
Member

Choose a reason for hiding this comment

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

I see all the tests are changed from ad1 to ad-1 did something change? I know that AD names are something like US-ASHBURN-AD-1 but wasn't sure why this was changed in our code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, the code was changed few lines before to use the map from spec rather than the response object, for which we have to parse the ad name.

SETUP_ENVTEST_VER := v0.0.0-20230131074648-f5014c077fc3
SETUP_ENVTEST_BIN := setup-envtest
SETUP_ENVTEST := $(abspath $(TOOLS_BIN_DIR)/$(SETUP_ENVTEST_BIN)-$(SETUP_ENVTEST_VER))
SETUP_ENVTEST_PKG := sigs.k8s.io/controller-runtime/tools/setup-envtest
Copy link
Member

Choose a reason for hiding this comment

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

And I want to discuss this new tool so I understand its usecase

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did not change the tool, made the code similar to other providers as the old code was giving problems in arm64 mac. The old code was using older version of controller runtime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Move AvailabilityDomains from OCI Cluster status to spec
2 participants