Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
4b7e084a
Commit
4b7e084a
authored
Mar 17, 2017
by
Huamin Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add iSCSI CHAP API
Signed-off-by:
Huamin Chen
<
hchen@redhat.com
>
parent
8667d7c4
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
79 additions
and
2 deletions
+79
-2
types.go
pkg/api/types.go
+11
-1
types.go
pkg/api/v1/types.go
+9
-0
zz_generated.conversion.go
pkg/api/v1/zz_generated.conversion.go
+2
-0
zz_generated.deepcopy.go
pkg/api/v1/zz_generated.deepcopy.go
+5
-0
validation.go
pkg/api/validation/validation.go
+3
-0
validation_test.go
pkg/api/validation/validation_test.go
+36
-0
zz_generated.deepcopy.go
pkg/api/zz_generated.deepcopy.go
+5
-0
zz_generated.openapi.go
pkg/generated/openapi/zz_generated.openapi.go
+8
-1
No files found.
pkg/api/types.go
View file @
4b7e084a
...
@@ -653,10 +653,20 @@ type ISCSIVolumeSource struct {
...
@@ -653,10 +653,20 @@ type ISCSIVolumeSource struct {
// the ReadOnly setting in VolumeMounts.
// the ReadOnly setting in VolumeMounts.
// +optional
// +optional
ReadOnly
bool
ReadOnly
bool
//
Required
: list of iSCSI target portal ips for high availability.
//
Optional
: list of iSCSI target portal ips for high availability.
// the portal is either an IP or ip_addr:port if port is other than default (typically TCP ports 860 and 3260)
// the portal is either an IP or ip_addr:port if port is other than default (typically TCP ports 860 and 3260)
// +optional
// +optional
Portals
[]
string
Portals
[]
string
// Optional: whether support iSCSI Discovery CHAP authentication
// +optional
DiscoveryCHAPAuth
bool
// Optional: whether support iSCSI Session CHAP authentication
// +optional
SessionCHAPAuth
bool
// Optional: CHAP secret for iSCSI target and initiator authentication.
// The secret is used if either DiscoveryCHAPAuth or SessionCHAPAuth is true
// +optional
SecretRef
*
LocalObjectReference
}
}
// Represents a Fibre Channel volume.
// Represents a Fibre Channel volume.
...
...
pkg/api/v1/types.go
View file @
4b7e084a
...
@@ -1047,6 +1047,15 @@ type ISCSIVolumeSource struct {
...
@@ -1047,6 +1047,15 @@ type ISCSIVolumeSource struct {
// is other than default (typically TCP ports 860 and 3260).
// is other than default (typically TCP ports 860 and 3260).
// +optional
// +optional
Portals
[]
string
`json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"`
Portals
[]
string
`json:"portals,omitempty" protobuf:"bytes,7,opt,name=portals"`
// whether support iSCSI Discovery CHAP authentication
// +optional
DiscoveryCHAPAuth
bool
`json:"chapAuthDiscovery,omitempty" protobuf:"varint,8,opt,name=chapAuthDiscovery"`
// whether support iSCSI Session CHAP authentication
// +optional
SessionCHAPAuth
bool
`json:"chapAuthSession,omitempty" protobuf:"varint,11,opt,name=chapAuthSession"`
// CHAP secret for iSCSI target and initiator authentication
// +optional
SecretRef
*
LocalObjectReference
`json:"secretRef,omitempty" protobuf:"bytes,10,opt,name=secretRef"`
}
}
// Represents a Fibre Channel volume.
// Represents a Fibre Channel volume.
...
...
pkg/api/v1/zz_generated.conversion.go
View file @
4b7e084a
...
@@ -1706,6 +1706,7 @@ func autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSo
...
@@ -1706,6 +1706,7 @@ func autoConvert_v1_ISCSIVolumeSource_To_api_ISCSIVolumeSource(in *ISCSIVolumeSo
out
.
FSType
=
in
.
FSType
out
.
FSType
=
in
.
FSType
out
.
ReadOnly
=
in
.
ReadOnly
out
.
ReadOnly
=
in
.
ReadOnly
out
.
Portals
=
*
(
*
[]
string
)(
unsafe
.
Pointer
(
&
in
.
Portals
))
out
.
Portals
=
*
(
*
[]
string
)(
unsafe
.
Pointer
(
&
in
.
Portals
))
out
.
SecretRef
=
(
*
api
.
LocalObjectReference
)(
unsafe
.
Pointer
(
in
.
SecretRef
))
return
nil
return
nil
}
}
...
@@ -1721,6 +1722,7 @@ func autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolu
...
@@ -1721,6 +1722,7 @@ func autoConvert_api_ISCSIVolumeSource_To_v1_ISCSIVolumeSource(in *api.ISCSIVolu
out
.
FSType
=
in
.
FSType
out
.
FSType
=
in
.
FSType
out
.
ReadOnly
=
in
.
ReadOnly
out
.
ReadOnly
=
in
.
ReadOnly
out
.
Portals
=
*
(
*
[]
string
)(
unsafe
.
Pointer
(
&
in
.
Portals
))
out
.
Portals
=
*
(
*
[]
string
)(
unsafe
.
Pointer
(
&
in
.
Portals
))
out
.
SecretRef
=
(
*
LocalObjectReference
)(
unsafe
.
Pointer
(
in
.
SecretRef
))
return
nil
return
nil
}
}
...
...
pkg/api/v1/zz_generated.deepcopy.go
View file @
4b7e084a
...
@@ -1198,6 +1198,11 @@ func DeepCopy_v1_ISCSIVolumeSource(in interface{}, out interface{}, c *conversio
...
@@ -1198,6 +1198,11 @@ func DeepCopy_v1_ISCSIVolumeSource(in interface{}, out interface{}, c *conversio
*
out
=
make
([]
string
,
len
(
*
in
))
*
out
=
make
([]
string
,
len
(
*
in
))
copy
(
*
out
,
*
in
)
copy
(
*
out
,
*
in
)
}
}
if
in
.
SecretRef
!=
nil
{
in
,
out
:=
&
in
.
SecretRef
,
&
out
.
SecretRef
*
out
=
new
(
LocalObjectReference
)
**
out
=
**
in
}
return
nil
return
nil
}
}
}
}
...
...
pkg/api/validation/validation.go
View file @
4b7e084a
...
@@ -622,6 +622,9 @@ func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, fldPath *field.Path
...
@@ -622,6 +622,9 @@ func validateISCSIVolumeSource(iscsi *api.ISCSIVolumeSource, fldPath *field.Path
if
iscsi
.
Lun
<
0
||
iscsi
.
Lun
>
255
{
if
iscsi
.
Lun
<
0
||
iscsi
.
Lun
>
255
{
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"lun"
),
iscsi
.
Lun
,
validation
.
InclusiveRangeError
(
0
,
255
)))
allErrs
=
append
(
allErrs
,
field
.
Invalid
(
fldPath
.
Child
(
"lun"
),
iscsi
.
Lun
,
validation
.
InclusiveRangeError
(
0
,
255
)))
}
}
if
(
iscsi
.
DiscoveryCHAPAuth
||
iscsi
.
SessionCHAPAuth
)
&&
iscsi
.
SecretRef
==
nil
{
allErrs
=
append
(
allErrs
,
field
.
Required
(
fldPath
.
Child
(
"secretRef"
),
""
))
}
return
allErrs
return
allErrs
}
}
...
...
pkg/api/validation/validation_test.go
View file @
4b7e084a
...
@@ -948,6 +948,42 @@ func TestValidateVolumes(t *testing.T) {
...
@@ -948,6 +948,42 @@ func TestValidateVolumes(t *testing.T) {
errtype
:
field
.
ErrorTypeRequired
,
errtype
:
field
.
ErrorTypeRequired
,
errfield
:
"iscsi.iqn"
,
errfield
:
"iscsi.iqn"
,
},
},
{
name
:
"empty secret"
,
vol
:
api
.
Volume
{
Name
:
"iscsi"
,
VolumeSource
:
api
.
VolumeSource
{
ISCSI
:
&
api
.
ISCSIVolumeSource
{
TargetPortal
:
"127.0.0.1"
,
IQN
:
"iqn.2015-02.example.com:test"
,
Lun
:
1
,
FSType
:
"ext4"
,
ReadOnly
:
false
,
DiscoveryCHAPAuth
:
true
,
},
},
},
errtype
:
field
.
ErrorTypeRequired
,
errfield
:
"iscsi.secretRef"
,
},
{
name
:
"empty secret"
,
vol
:
api
.
Volume
{
Name
:
"iscsi"
,
VolumeSource
:
api
.
VolumeSource
{
ISCSI
:
&
api
.
ISCSIVolumeSource
{
TargetPortal
:
"127.0.0.1"
,
IQN
:
"iqn.2015-02.example.com:test"
,
Lun
:
1
,
FSType
:
"ext4"
,
ReadOnly
:
false
,
SessionCHAPAuth
:
true
,
},
},
},
errtype
:
field
.
ErrorTypeRequired
,
errfield
:
"iscsi.secretRef"
,
},
// Secret
// Secret
{
{
name
:
"valid Secret"
,
name
:
"valid Secret"
,
...
...
pkg/api/zz_generated.deepcopy.go
View file @
4b7e084a
...
@@ -1226,6 +1226,11 @@ func DeepCopy_api_ISCSIVolumeSource(in interface{}, out interface{}, c *conversi
...
@@ -1226,6 +1226,11 @@ func DeepCopy_api_ISCSIVolumeSource(in interface{}, out interface{}, c *conversi
*
out
=
make
([]
string
,
len
(
*
in
))
*
out
=
make
([]
string
,
len
(
*
in
))
copy
(
*
out
,
*
in
)
copy
(
*
out
,
*
in
)
}
}
if
in
.
SecretRef
!=
nil
{
in
,
out
:=
&
in
.
SecretRef
,
&
out
.
SecretRef
*
out
=
new
(
LocalObjectReference
)
**
out
=
**
in
}
return
nil
return
nil
}
}
}
}
...
...
pkg/generated/openapi/zz_generated.openapi.go
View file @
4b7e084a
...
@@ -3971,11 +3971,18 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
...
@@ -3971,11 +3971,18 @@ func GetOpenAPIDefinitions(ref openapi.ReferenceCallback) map[string]openapi.Ope
},
},
},
},
},
},
"secretRef"
:
{
SchemaProps
:
spec
.
SchemaProps
{
Description
:
"CHAP secret for iSCSI target and initiator authentication"
,
Ref
:
ref
(
"k8s.io/kubernetes/pkg/api/v1.LocalObjectReference"
),
},
},
},
},
Required
:
[]
string
{
"targetPortal"
,
"iqn"
,
"lun"
},
Required
:
[]
string
{
"targetPortal"
,
"iqn"
,
"lun"
},
},
},
},
},
Dependencies
:
[]
string
{},
Dependencies
:
[]
string
{
"k8s.io/kubernetes/pkg/api/v1.LocalObjectReference"
},
},
},
"k8s.io/kubernetes/pkg/api/v1.KeyToPath"
:
{
"k8s.io/kubernetes/pkg/api/v1.KeyToPath"
:
{
Schema
:
spec
.
Schema
{
Schema
:
spec
.
Schema
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment