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

[GCP FileShare Support] Implement Create Fileshare API for GCP Fileshare Driver #1097

Merged
merged 2 commits into from
Sep 20, 2020

Conversation

himanshuvar
Copy link
Member

What type of PR is this?

/kind new feature

What this PR does / why we need it: This PR is needed to support File Share Creation for GCP cloud backend.

Which issue(s) this PR fixes:

Fixes #1076

Test Report Added?:

/kind TESTED

Test Report:

The following testing is done for Create File Share API for GCP cloud backend:

  • Register Backend

  • List Backend

  • Create FileShare for GCP Backend

Register a Backend

Example 1: Registering an Azure Backend for File Share

POST http://192.168.20.162:8089/v1/94b280022d0c4401bcf3b0ea85870519/backends

Request:

{
  "name": "gcp-backend-file",
  "type": "gcp-file",
  "Region": "<project_id>",
  "Access": "<access_key>",
  "Security": "<secret_key>"
}

Response:

{
    "id": "5f66397740852a0001bcc3f7",
    "tenantId": "94b280022d0c4401bcf3b0ea85870519",
    "userId": "558057c4256545bd8a307c37464003c9",
    "name": "gcp-backend-file",
    "type": "gcp-file",
    "region": "<project_id>",
    "access": "<access_key>",
    "security": "<secret_key>"
}

List Backend:
GET http://192.168.20.162:8089/v1/94b280022d0c4401bcf3b0ea85870519/backends
Response:

{
    "backends": [
        {
            "id": "5f66397740852a0001bcc3f7",
            "tenantId": "94b280022d0c4401bcf3b0ea85870519",
            "userId": "558057c4256545bd8a307c37464003c9",
            "name": "gcp-backend-file",
            "type": "gcp-file",
            "region": "<project_id>"
        }
    ],
    "next": 1
}

Create a File share

Example 1: Creating File Share for AWS Backend

POST http://192.168.20.162:8089/v1/94b280022d0c4401bcf3b0ea85870519/file/shares
Request:

{
    "name": "gcpfshim",
    "description": "GCP FileShare",
    "backendId": "5f66397740852a0001bcc3f7",
    "availabilityZone": "asia-east1-a",
    "size": 1099511627776,
    "type": "cloudFS",
    "tags": [
      {
        "key": "creator",
        "value": "himanshu"
      }
    ],
    "metadata": {
      "Tier": "STANDARD"
    }
}

Response:

{
    "id": "5f663ac22c7bc100019d2cd6",
    "createdAt": "2020-09-19T22:37:14",
    "updatedAt": "2020-09-19T22:37:14",
    "name": "gcpfshim",
    "description": "GCP FileShare",
    "tenantId": "94b280022d0c4401bcf3b0ea85870519",
    "userId": "558057c4256545bd8a307c37464003c9",
    "backendId": "5f66397740852a0001bcc3f7",
    "backend": "gcp-backend-file",
    "size": 1099511627776,
    "type": "cloudFS",
    "region": "<project_id>",
    "availabilityZone": "asia-east1-a",
    "status": "creating",
    "tags": [
        {
            "key": "creator",
            "value": "himanshu"
        }
    ],
    "metadata": {
        "fields": {
            "Tier": {
                "Kind": {
                    "StringValue": "STANDARD"
                }
            }
        }
    }
}

image
image

Special notes for your reviewer:
Since GET Fileshare API for GCP implementation is not included in this PR. Sync Metadata from cloud to DB will break.

@codecov
Copy link

codecov bot commented Sep 19, 2020

Codecov Report

Merging #1097 into master will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1097   +/-   ##
=======================================
  Coverage   55.58%   55.58%           
=======================================
  Files           8        8           
  Lines        1002     1002           
=======================================
  Hits          557      557           
  Misses        415      415           
  Partials       30       30           

Copy link
Collaborator

@kumarashit kumarashit left a comment

Choose a reason for hiding this comment

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

Please fix fs naming conventions

@himanshuvar
Copy link
Member Author

himanshuvar commented Sep 20, 2020

Please fix fs naming conventions

If we needs to take the instance id from User input. I can add instance id to metadata. What do you say?

Copy link
Collaborator

@kumarashit kumarashit left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@skdwriting skdwriting left a comment

Choose a reason for hiding this comment

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

LGTM

@skdwriting skdwriting merged commit 1962e88 into sodafoundation:master Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[GCP FileShare Support] Implement GCP FileShare Create API
3 participants