Skip to content

[WIP] KEP 3751 volume attribute class #1

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

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

maxkimambo
Copy link
Owner

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/kind api-change
/kind bug
/kind cleanup
/kind design
/kind documentation
/kind failing-test
/kind feature
/kind flake

What this PR does / why we need it:
PR adds a feature to modify Iops and throughput parameters when using hyperdisk volumes

This implements
Which issue(s) this PR fixes:

Fixes kubernetes-sigs#1693

Special notes for your reviewer:

This PR is still WIP, looking for early feedback.

Does this PR introduce a user-facing change?:


@maxkimambo maxkimambo force-pushed the 3751-volume-attribute-class branch from 82e0b25 to 61fe1b9 Compare June 18, 2024 14:14
verbs: ["*"]
- nonResourceURLs: ["*"]
verbs: ["*"]
---
Copy link
Owner Author

Choose a reason for hiding this comment

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

Role added temporarily, I need to find correct set of permissions that are required before this is final.

Choose a reason for hiding this comment

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

You need view access to VolumeAttributesClasses similar to how CSI driver gets access to StorageClasses

return nil, status.Errorf(codes.InvalidArgument, "Failed to modify volume: modifications not supported for disk type %s", diskType)
}

// TODO : not sure how this metric should be reported
Copy link
Owner Author

Choose a reason for hiding this comment

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

Still outstanding

@@ -0,0 +1,33 @@
{

Choose a reason for hiding this comment

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

Do you intend to check this in?

@@ -313,3 +313,28 @@ roleRef:
kind: Role
name: csi-gce-pd-leaderelection-role
apiGroup: rbac.authorization.k8s.io

Choose a reason for hiding this comment

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

Do you intend to check this in? This in handing over admin privileges to CSI driver. I assume you needed that for testing but we should limit the permissions required by CSI driver as good practice.

function cleanup {
rm -rf "$tmpDir"
}
# function cleanup {

Choose a reason for hiding this comment

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

Don't check this in

@@ -279,6 +280,22 @@ func (cloud *FakeCloudProvider) InsertDisk(ctx context.Context, project string,
return nil
}

func (cloud *FakeCloudProvider) UpdateDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {

if params.IOPS == 0 || params.Throughput == 0 {

Choose a reason for hiding this comment

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

We should check IOPS and throughput separately and generate different errors


func (cloud *CloudProvider) updateZonalDisk(ctx context.Context, project string, volKey *meta.Key, existingDisk *CloudDisk, params common.ModifyVolumeParameters) error {

if params.IOPS == 0 && params.Throughput == 0 {

Choose a reason for hiding this comment

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

Neither IOPS nor throughput must be 0. Can we distinguish user explicitly setting 0 from zero value used by protobuf?

Comment on lines +206 to +208
"pd-balanced": false,
"pd-standard": false,
"pd-ssd": false,

Choose a reason for hiding this comment

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

I would not include legacy here and only explicitly specify disk types that to do support dynamic performance.

Also IOPS and throughput are not valid for all disk types. pd-throghput only supports throughput for instance.

return nil, status.Errorf(codes.InvalidArgument, "Failed to modify volume: modifications not supported for disk type %s", diskType)
}

// TODO : not sure how this metric should be reported

Choose a reason for hiding this comment

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

We are reporting it via gceCS.Metrics.RecordOperationErrorMetrics()

@@ -22,6 +22,8 @@ import (
"reflect"
"sort"
"strconv"
"strings"
"strings"

Choose a reason for hiding this comment

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

How come golang is not complaining about duplicate imports? Just run "go format" before checking in

expError: "",
},
{
name: "Volume attribute class parameters should be ignored for incompatible disk types",

Choose a reason for hiding this comment

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

Shouldn't we rather fail than ignore parameters?

cmdParams := []string{"container", "clusters", "create", *gkeTestClusterName,
locationArg, locationVal, "--num-nodes", strconv.Itoa(numNodes),
"--quiet", "--machine-type", "n1-standard-2", "--image-type", imageType, "--no-enable-autoupgrade"}
"--quiet", "--machine-type", machineType, "--image-type", imageType, "--no-enable-autoupgrade", "--service-account", "[email protected]"}

Choose a reason for hiding this comment

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

Don't hard-code service account

"pd-balanced": false,
"pd-standard": false,
"pd-ssd": false,
"pd-extreme": true,

Choose a reason for hiding this comment

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

should be false (but see comment above)

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.

Support ControllerModifyVolume
2 participants