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

Adding the iSCSI APIs #99

Merged
merged 6 commits into from
Oct 24, 2020
Merged

Adding the iSCSI APIs #99

merged 6 commits into from
Oct 24, 2020

Conversation

jmpfar
Copy link
Contributor

@jmpfar jmpfar commented Oct 20, 2020

What type of PR is this?
/kind feature

What this PR does / why we need it:

Adding the iSCSI API group to csi-proxy.
This includes:

  • CHAP support
  • Limited Mutual CHAP support (secret needs to be set by the user on the node, not through CSIProxy)
  • Limited Multipath support (needs to be configured and installed by the user on the node not through CSI Proxy)

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

  • The tests are enabled through an environment variable ENABLE_ISCSI_TESTS which needs to be set to "TRUE" in order to run the iSCSI tests. This was done as a fail safe mechanism as the integration tests install an iSCSI Target on the local machine and format an empty iSCSI drive. So it's advisable to run this on a clean VM if possible.
  • The tests require a Windows Server machine in order to use the iSCSI target feature.

Does this PR introduce a user-facing change?:

Added the iSCSI api group with CHAP support

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Oct 20, 2020
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 20, 2020
@k8s-ci-robot
Copy link
Contributor

Hi @jmpfar. Thanks for your PR.

I'm waiting for a kubernetes-csi member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Oct 20, 2020
@jmpfar
Copy link
Contributor Author

jmpfar commented Oct 20, 2020

I've currently disabled the iSCSI integration tests on github workflow as they do not work on that environment.
A possible long term solution is using an image that already has an iSCSI target installed.

Notes to reviewer:

  • The integration tests can be tested on a clean VM without any required prerequisites except for the env var above
  • Windows iSCSI target has some issues with long computer names, if you see issues try a VM with a short computer name (<= 15 chars)

@ddebroy
Copy link
Contributor

ddebroy commented Oct 20, 2020

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 20, 2020
1. Currently has a very limited support for Multipath
2. Does not contain node level APIs to set reverse
   CHAP or node IQN
3. Tests format a disk, so special flag is used to
   enable the iSCSI tests. Take care to use
   disposable clean VMs for tests.

Change-Id: I0fe8431fed00715883ad0431671ec6a060718e0e
Change-Id: Ib669ed4aafad4a7ce6fa4821998e24264072c049
I've tried the test on a clean GCP Windows 2016/2019
VM and this works.
This might be related to the Server Target feature
install on the github workflow environment.
Might be worth fixing with the other disabled
integration tests.

Change-Id: If76902118f1a2887caf5c554d339ad1dc13f04a8
@jmpfar
Copy link
Contributor Author

jmpfar commented Oct 20, 2020

/retest

@jmpfar
Copy link
Contributor Author

jmpfar commented Oct 20, 2020

/test all

@jmpfar
Copy link
Contributor Author

jmpfar commented Oct 20, 2020

Hey,
I'm trying to rerun the integration tests as they seemed to flake on the last run, any idea how do I trigger those on my pull request?

@ddebroy
Copy link
Contributor

ddebroy commented Oct 21, 2020

@jmpfar invoked rerun from the github actions UI linked from the details link.

Copy link
Contributor

@ddebroy ddebroy left a comment

Choose a reason for hiding this comment

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

Looks pretty good from a first scan. A few minor comments to clarify code comments.

}

message GetTargetDisksRequest {
// Target portal to which the initiator will connect.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix the comment to mention something along the lines of: Target portal whose disks will be querried

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

}

message DisconnectTargetRequest {
// Target portal to which the initiator will connect.
Copy link
Contributor

Choose a reason for hiding this comment

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

Please fix the comment to mention something along the lines of Target portal from which initiator will disconnect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

message GetTargetDisksResponse {
// List composed of disk ids (numbers) that are associated with the
// iSCSI target
repeated string diskIds = 1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed


func (APIImplementor) AddTargetPortal(portal *TargetPortal) error {
cmdLine := fmt.Sprintf(
`New-IscsiTargetPortal -TargetPortalAddress ${Env:iscsi_tp_address} ` +
Copy link
Contributor

Choose a reason for hiding this comment

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

The lack of -InitiatorInstanceName parameter assumes csi-proxy will always use the software iSCSI initiator in Windows rather any hardware NICs with iSCSI offload/support - which is fine. If you can add a comment to specify this, that would be great!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've added clarifying comments (in the proto), I think this is a good idea to add this in later versions.
According to Windows documentation, if you don't specify an initiator:

"iSCSI initiator service will use any initiator that can reach the target portal."

(AddIScsiSendTargetPortalW)

So, at least by wording, this might suggest that the hardware initiator may be used

`Connect-IscsiTarget -TargetPortalAddress ${Env:iscsi_tp_address}` +
` -TargetPortalPortNumber ${Env:iscsi_tp_port} -NodeAddress ${Env:iscsi_target_iqn}` +
` -AuthenticationType ${Env:iscsi_auth_type}` +
` -IsMultipathEnabled $([System.Convert]::ToBoolean(${Env:iscsi_is_multipath}))`)
Copy link
Contributor

Choose a reason for hiding this comment

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

If IsMultipathEnabled is true then Connect-IscsiTarget will need to be invoked with InitiatorPortalAddress set to the IP address of each network adapter that wants to participate in the multi-path configuration. I think it will probably be better to block specification of IsMultipathEnabled for now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't consider the multipath scenario where you use two initiators to the same target, what I was thinking about was the other direction
e.g. I have one NIC that connects to two IPs of the storage array, each one exposing the same IQN.
This scenario will work with the current API
I guess this is more of a scenario for high availability rather than performance, and it was at least what we used in a product I've worked on (although it was far from the normal storage product)

WDYT? The multipath option here was added really quickly just to give an option for users with an already well configured node to use multipath. Full support will probably require more effort anyway, so I can remove the multipath bool and save it for a later version

Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting - most production multipath configurations I have seen involve redundant paths all the way from the initiator NICs to the target.

I would say let’s remove the multipath option for now in v1alpha1 and add it later if we hear requests/feedback around it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Once the multipath option is removed for now, I will lgtm/approve the PR. Thanks for getting basic iSCSI support going!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!
Removed the multipath option

MUTUAL_CHAP = 2;
}

message ConnectTargetRequest {
Copy link
Contributor

@ddebroy ddebroy Oct 22, 2020

Choose a reason for hiding this comment

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

Any thoughts on adding a initiator_address parameter to ConnectTargetRequest ? Can be added in a later version but was wondering if it would be useful in nodes with multiple NICs. We will probably need to add another API group potentially as part of the system group to query the set of host IP addresses as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See the MPIO comments, but I agree, this is a good feature for a later version
This is a mammoth commit as it is, I think I'll start adding features in separate PRs, where the first one is mutual chap support (the node-level set chap function)

jmpfar and others added 3 commits October 22, 2020 11:42
Change-Id: Iff20646f3837b952abe10d81c86bdcab799d5d53
1. Fixing errors in proto comments
2. Adding missing comments for AuthenticationType enum
3. Renaming DiskIds to DiskIDs to better conform to other apis
4. Documenting lack of initiator selection features in AddTargetPortal
5. Improving multipath related documentation

Change-Id: Ic9ec4387a140f522fa2e3a3ad781a439bc2cb918
This was decided as currently we don't have a way of specifying
different initiators. Effectively making multipath very limited
in usage, as well as probably confusing

Change-Id: I0cd9b7fa7cdb309dbc29ab1a5a5c64909a429f1e
@ddebroy
Copy link
Contributor

ddebroy commented Oct 23, 2020

Thanks! One more request: can you please squash the commits please? Would like the commit history to not have “address cr comments” commits.

@ddebroy
Copy link
Contributor

ddebroy commented Oct 24, 2020

/lgtm
/approve
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 24, 2020
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 24, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ddebroy, jmpfar

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 24, 2020
@ddebroy ddebroy merged commit dc98fe9 into kubernetes-csi:master Oct 24, 2020
@ddebroy
Copy link
Contributor

ddebroy commented Oct 24, 2020

I squashed and merged this manually. So please ignore #99 (comment) for this PR.

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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. 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.

3 participants