Skip to content

Commit 4ccd657

Browse files
authored
Merge pull request #102 from jmpfar/mutualchap
Adding SetMutualChapSecret method to iSCSI API
2 parents ffb169f + 7cd707c commit 4ccd657

File tree

18 files changed

+3696
-57
lines changed

18 files changed

+3696
-57
lines changed

client/api/iscsi/v1alpha2/api.pb.go

Lines changed: 1204 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/api/iscsi/v1alpha2/api.proto

Lines changed: 175 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
syntax = "proto3";
2+
3+
package v1alpha2;
4+
5+
option go_package = "github.com/kubernetes-csi/csi-proxy/client/api/iscsi/v1alpha2";
6+
7+
service Iscsi {
8+
// AddTargetPortal registers an iSCSI target network address for later
9+
// discovery.
10+
// AddTargetPortal currently does not support selecting different NICs or
11+
// a different iSCSI initiator (e.g a hardware initiator). This means that
12+
// Windows will select the initiator NIC and instance on its own.
13+
rpc AddTargetPortal(AddTargetPortalRequest)
14+
returns (AddTargetPortalResponse) {}
15+
16+
// DiscoverTargetPortal initiates discovery on an iSCSI target network address
17+
// and returns discovered IQNs.
18+
rpc DiscoverTargetPortal(DiscoverTargetPortalRequest)
19+
returns (DiscoverTargetPortalResponse) {}
20+
21+
// RemoveTargetPortal removes an iSCSI target network address registration.
22+
rpc RemoveTargetPortal(RemoveTargetPortalRequest)
23+
returns (RemoveTargetPortalResponse) {}
24+
25+
// ListTargetPortal lists all currently registered iSCSI target network
26+
// addresses.
27+
rpc ListTargetPortals(ListTargetPortalsRequest)
28+
returns (ListTargetPortalsResponse) {}
29+
30+
// ConnectTarget connects to an iSCSI Target
31+
rpc ConnectTarget(ConnectTargetRequest) returns (ConnectTargetResponse) {}
32+
33+
// DisconnectTarget disconnects from an iSCSI Target
34+
rpc DisconnectTarget(DisconnectTargetRequest)
35+
returns (DisconnectTargetResponse) {}
36+
37+
// GetTargetDisks returns the disk addresses that correspond to an iSCSI
38+
// target
39+
rpc GetTargetDisks(GetTargetDisksRequest) returns (GetTargetDisksResponse) {}
40+
41+
// SetMutualChapSecret sets the default CHAP secret that all initiators on
42+
// this machine (node) use to authenticate the target on mutual CHAP
43+
// authentication.
44+
// NOTE: This method affects global node state and should only be used
45+
// with consideration to other CSI drivers that run concurrently.
46+
rpc SetMutualChapSecret(SetMutualChapSecretRequest)
47+
returns (SetMutualChapSecretResponse) {}
48+
}
49+
50+
// TargetPortal is an address and port pair for a specific iSCSI storage
51+
// target.
52+
message TargetPortal {
53+
// iSCSI Target (server) address
54+
string target_address = 1;
55+
56+
// iSCSI Target port (default iSCSI port is 3260)
57+
uint32 target_port = 2;
58+
}
59+
60+
message AddTargetPortalRequest {
61+
// iSCSI Target Portal to register in the initiator
62+
TargetPortal target_portal = 1;
63+
}
64+
65+
message AddTargetPortalResponse {
66+
// Intentionally empty
67+
}
68+
69+
message DiscoverTargetPortalRequest {
70+
// iSCSI Target Portal on which to initiate discovery
71+
TargetPortal target_portal = 1;
72+
}
73+
74+
message DiscoverTargetPortalResponse {
75+
// List of discovered IQN addresses
76+
// follows IQN format: iqn.yyyy-mm.naming-authority:unique-name
77+
repeated string iqns = 1;
78+
}
79+
80+
message RemoveTargetPortalRequest {
81+
// iSCSI Target Portal
82+
TargetPortal target_portal = 1;
83+
}
84+
85+
message RemoveTargetPortalResponse {
86+
// Intentionally empty
87+
}
88+
89+
message ListTargetPortalsRequest {
90+
// Intentionally empty
91+
}
92+
93+
message ListTargetPortalsResponse {
94+
// A list of Target Portals currently registered in the initiator
95+
repeated TargetPortal target_portals = 1;
96+
}
97+
98+
// iSCSI logon authentication type
99+
enum AuthenticationType {
100+
// No authentication is used
101+
NONE = 0;
102+
103+
// One way CHAP authentication. The target authenticates the initiator.
104+
ONE_WAY_CHAP = 1;
105+
106+
// Mutual CHAP authentication. The target and initiator authenticate each
107+
// other.
108+
MUTUAL_CHAP = 2;
109+
}
110+
111+
message ConnectTargetRequest {
112+
// Target portal to which the initiator will connect
113+
TargetPortal target_portal = 1;
114+
115+
// IQN of the iSCSI Target
116+
string iqn = 2;
117+
118+
// Connection authentication type, None by default
119+
//
120+
// One Way Chap uses the chap_username and chap_secret
121+
// fields mentioned below to authenticate the initiator.
122+
//
123+
// Mutual Chap uses both the user/secret mentioned below
124+
// and the Initiator Chap Secret (See `SetMutualChapSecret`)
125+
// to authenticate the target and initiator.
126+
AuthenticationType auth_type = 3;
127+
128+
// CHAP Username used to authenticate the initiator
129+
string chap_username = 4;
130+
131+
// CHAP password used to authenticate the initiator
132+
string chap_secret = 5;
133+
}
134+
135+
message ConnectTargetResponse {
136+
// Intentionally empty
137+
}
138+
139+
message GetTargetDisksRequest {
140+
// Target portal whose disks will be queried
141+
TargetPortal target_portal = 1;
142+
143+
// IQN of the iSCSI Target
144+
string iqn = 2;
145+
}
146+
147+
message GetTargetDisksResponse {
148+
// List composed of disk ids (numbers) that are associated with the
149+
// iSCSI target
150+
repeated string diskIDs = 1;
151+
}
152+
153+
message DisconnectTargetRequest {
154+
// Target portal from which initiator will disconnect
155+
TargetPortal target_portal = 1;
156+
157+
// IQN of the iSCSI Target
158+
string iqn = 2;
159+
}
160+
161+
message DisconnectTargetResponse {
162+
// Intentionally empty
163+
}
164+
165+
message SetMutualChapSecretRequest {
166+
// the default CHAP secret that all initiators on this machine (node) use to
167+
// authenticate the target on mutual CHAP authentication.
168+
// Must be at least 12 byte long for non-Ipsec connections, at least one
169+
// byte long for Ipsec connections, and at most 16 bytes long.
170+
string MutualChapSecret = 1;
171+
}
172+
173+
message SetMutualChapSecretResponse {
174+
// Intentionally empty
175+
}
Lines changed: 18 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integrationtests/iscsi_ps_scripts.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,17 +105,22 @@ func setReverseChap(targetName string, password string) error {
105105
return nil
106106
}
107107

108-
func cleanup(t *testing.T) error {
108+
func cleanup() error {
109109
_, err := runPowershellScript(IscsiCleanupScript)
110110
if err != nil {
111-
msg := fmt.Sprintf("failed cleaning up environment. err=%v", err)
112-
t.Fatal(msg)
113-
// exits function
111+
return fmt.Errorf("failed cleaning up environment. err=%v", err)
114112
}
115113

116114
return nil
117115
}
118116

117+
func requireCleanup(t *testing.T) {
118+
err := cleanup()
119+
if err != nil {
120+
t.Fatal(err)
121+
}
122+
}
123+
119124
const IscsiCleanupScript = `
120125
$ErrorActionPreference = "Stop"
121126
$ProgressPreference = "SilentlyContinue"

0 commit comments

Comments
 (0)