-
Notifications
You must be signed in to change notification settings - Fork 159
v0.2.0.alpha driver initial code push #2
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
v0.2.0.alpha driver initial code push #2
Conversation
A full review probably isn't possible here. But if you're scrolling through and see any glaring issues feel free to put a comment or add an issue to the repo after this gets merged. |
6f85a0f
to
1cf9e6b
Compare
name = "github.com/container-storage-interface/spec" | ||
packages = ["lib/go/csi/v0"] | ||
revision = "35d9f9d77954980e449e52c3f3e43c21bd8171f5" | ||
version = "v0.2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0.3.0 is out. Do you want to do that update separately?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, I'll do it in a future push. This is just the current working code.
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM fedora:26 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm with @tallclair what base image we should use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a TODO. Wont fix for initial commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
deploy/kubernetes/controller.yaml
Outdated
app: csi-gce-pd | ||
ports: | ||
- name: dummy | ||
port: 12345 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add a comments explaining the purpose at the top of the file, e.g.:
# The dummy service is required for creating a StatefulSet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you actually need a service object. I launched the plugin without the service object and it was fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
weird, we've had this discussion before and I remember trying specifically and having it fail. I will test again
volumeMounts: | ||
- name: socket-dir | ||
mountPath: /csi | ||
- name: csi-attacher |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: csi-attacher
-> csi-external-attacher
for consistency?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the image is named csi-attacher. But i'll change it for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modified the csi-external-provisioner
to csi-provisioner
instead for provisioner
1cf9e6b
to
9688b10
Compare
Makefile
Outdated
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
STAGINGIMAGE=gcr.io/dyzz-csi-staging/csi/gce-driver |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you rename all the references to "gce-pd" instead of just "gce"
Step 1 (Create Credentials): | ||
Create Service Account Credential JSON on GCP: | ||
- TODO: Add detailed steps on how to do this | ||
- Requires both Compute Owner and Cloud Project Owner permissions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's pretty broad permissions, there are no reduced scopes for just pd?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
theres a "compute-admin" and a "compute-storage-admin" scope. However when I tried those for some reason there were not enough permissions to Attach. Everything else was fine, just not Attach. I will open an issue on this repo to revisit that and either it will work, or I will open a bug against the compute scopes because I think "Attach" should definitely be covered under "compute-admin"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you separate out vendor from the rest? That could make this slightly easier to review :-) |
9688b10
to
9c3112c
Compare
@msau42 seperated out, its still a 4000+ line commit :P |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the gce-> gce-pd naming change, I meant everywhere in the project. package, file, directory, type names etc.
pkg/gce-cloud-provider/gce.go
Outdated
if err != nil { | ||
return nil, err | ||
} | ||
service.UserAgent = fmt.Sprintf("GCE CSI Driver/%s (%s %s)", "0.2.0", runtime.GOOS, runtime.GOARCH) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a way to make this version number parameterized so you don't have to modify the code everytime you bump the version? I don't think there's a downward api for container image name though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a TODO, don't think its super important, bumping the version is a very manual process and theres no way to get it from the Spec itself AFAIK
pkg/gce-cloud-provider/gce.go
Outdated
} | ||
|
||
func getProjectAndZoneFromMetadata() (string, string, error) { | ||
result, err := metadata.Get("instance/zone") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a metadata.Zone() call
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
9abe2c2
to
a30cd65
Compare
deploy/kubernetes/controller.yaml
Outdated
app: csi-gce-pd | ||
ports: | ||
- name: dummy | ||
port: 12345 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure you actually need a service object. I launched the plugin without the service object and it was fine
namespace: default | ||
roleRef: | ||
kind: ClusterRole | ||
name: system:csi-external-provisioner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a bug and this role doesn't actually have all the permissions needed. So as a workaround, I had to create a custom clusterrole with just persistentvolumes.get and bind to that too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, the bug was hidden from me because external-attacher has PV GET and I have them bundled together in the controller
service account
pkg/gce-csi-driver/controller.go
Outdated
|
||
const ( | ||
// MaxVolumeSize is the maximum standard and ssd size of 64TB | ||
MaxVolumeSize int64 = 64000000000000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can define these in terms of 1000's to make it easier to read
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/gce-csi-driver/controller.go
Outdated
DiskTypeStandard = "pd-standard" | ||
diskTypeDefault = DiskTypeStandard | ||
|
||
diskTypePersistent = "PERSISTENT" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like there's two kinds of "disk types". Can you rename one of them to be disambiguate them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/gce-csi-driver/controller.go
Outdated
capBytes = tcap | ||
} | ||
// Too small, default | ||
if capBytes < DefaultVolumeSize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cap < min volume size?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
pkg/gce-csi-driver/controller.go
Outdated
|
||
func (gceCS *GCEControllerServer) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest) (*csi.DeleteVolumeResponse, error) { | ||
// TODO: Only allow deletion of volumes that were created by the driver | ||
// Assuming ID is of form {project}/{zone}/{id} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need project in the id?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment was obsolete
return splitId[0], splitId[1], nil | ||
} | ||
|
||
func CombineVolumeId(zone, name string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably need to add something for repd in the volume id
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will do in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we're not supporting backwards compatibility yet? I wonder how difficult it would be to change the volume handle format later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will make sure the volume handle is stable before going to beta. I think its fine for alpha (?) @saad-ali
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ya, it's fine for alpha. Update the README file in the root of the repo indicating current status is alpha, and what the implication of alpha are (potentially backwards compatibility breaking changes).
pkg/gce-csi-driver/node.go
Outdated
Mounter mountmanager.Mounter | ||
} | ||
|
||
func (ns *GCENodeServer) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Publish and Unpublish should add some locking in case it gets called multiple times for the same mount. Kubernetes theoretically synchronizes this for the plugin, but it's not a requirement in the CSI spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And similarly for Stage/Unstage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just locked all of the node calls for now, I'll add a TODO to make them more fine grained and only lock mutually exclusive calls with each other in the future
8b53c4c
to
56ce990
Compare
some rudimentary node call locking, changed volume size representations, removed dummy service from statefulset definition.
56ce990
to
f3b2119
Compare
/lgtm |
Pull request from sigs head to forked head
Add OpenShift Dockerfile
All the code written so far for the driver