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 image lookup #281

Draft
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

shyamradhakrishnan
Copy link
Contributor

What this PR does / why we need it:
Add ability to lookup images.

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 #280

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

unit test

KUBEBUILDER_ASSETS="/home/ubuntu/.local/share/kubebuilder-envtest/k8s/1.24.2-linux-amd64" 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	44.324s	coverage: 23.8% of statements
ok  	github.com/oracle/cluster-api-provider-oci/api/v1beta2	0.030s	coverage: 15.6% of statements
?   	github.com/oracle/cluster-api-provider-oci/cloud/config	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/metrics	[no test files]
ok  	github.com/oracle/cluster-api-provider-oci/cloud/ociutil	0.011s	coverage: 19.6% of statements
ok  	github.com/oracle/cluster-api-provider-oci/cloud/scope	243.051s	coverage: 75.7% 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/loadbalancer	[no test files]
?   	github.com/oracle/cluster-api-provider-oci/cloud/services/loadbalancer/mock_lb	[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	0.274s	coverage: 76.1% of statements
ok  	github.com/oracle/cluster-api-provider-oci/controllers	26.003s	coverage: 67.5% of statements
ok  	github.com/oracle/cluster-api-provider-oci/exp/api/v1beta1	30.715s	coverage: 18.6% of statements
ok  	github.com/oracle/cluster-api-provider-oci/exp/api/v1beta2	0.026s	coverage: 9.5% of statements
ok  	github.com/oracle/cluster-api-provider-oci/exp/controllers	1.188s	coverage: 56.7% 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

if len(response.Items) == 0 {
return nil, errors.New(fmt.Sprintf("could not lookup image from lookup parameters"))
}
imageId = *response.Items[0].Id
Copy link
Member

Choose a reason for hiding this comment

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

add a quick todo maybe for "pagination"?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we have limit in the request to one as we really need the latest one, hence we sort by time created. I hope this makes sense.

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.

Add ability to lookup image instead of image id
2 participants