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

v2 endpoints to list OpenStack resources #6264

Merged
merged 2 commits into from
Dec 8, 2020

Conversation

zreigz
Copy link
Contributor

@zreigz zreigz commented Dec 7, 2020

What this PR does / why we need it: v2 endpoints to list OpenStack resources

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

v2 endpoints to list OpenStack resources:
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/availabilityzones
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/subnets
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/securitygroups
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/networks
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/tenants
GET /api/v2/projects/{project_id}/clusters/{cluster_id}/providers/openstack/sizes

@kubermatic-bot kubermatic-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 7, 2020
@zreigz zreigz requested a review from lsviben December 7, 2020 14:14
Copy link
Contributor

@lsviben lsviben left a comment

Choose a reason for hiding this comment

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

Looks ok, one small comment

Comment on lines 157 to 142
clusterProvider := ctx.Value(middleware.ClusterProviderContextKey).(provider.ClusterProvider)
assertedClusterProvider, ok := clusterProvider.(*kubernetesprovider.ClusterProvider)
if !ok {
return nil, errors.New(http.StatusInternalServerError, "failed to assert clusterProvider")
}

userInfo, err := userInfoGetter(ctx, projectID)
if err != nil {
return nil, common.KubernetesErrorToHTTPError(err)
}

secretKeySelector := provider.SecretKeySelectorValueFuncFactory(ctx, assertedClusterProvider.GetSeedClusterAdminRuntimeClient())
creds, err := openstack.GetCredentialsForCluster(cluster.Spec.Cloud, secretKeySelector)
if err != nil {
return nil, err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

this is repeated multiple times, we could extract it to getCredentials or getCreds. Maybe without the userInfoGetter check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@lsviben
Copy link
Contributor

lsviben commented Dec 8, 2020

/lgtm
/approve

@kubermatic-bot kubermatic-bot added the lgtm Indicates that a PR is ready to be merged. label Dec 8, 2020
@kubermatic-bot
Copy link
Contributor

LGTM label has been added.

Git tree hash: f886803ba37f25700ca7cb7dbbda69df47d2d35d

@kubermatic-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lsviben, zreigz

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@kubermatic-bot kubermatic-bot merged commit a7c4902 into kubermatic:master Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Denotes that all commits in the pull request have the valid DCO signoff message. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

v2 list OpenStack resources
3 participants