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
69d1d235
Commit
69d1d235
authored
Mar 31, 2015
by
markturansky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rebased and updated
parent
a5ebacb0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
23 deletions
+6
-23
etcd.go
pkg/registry/persistentvolume/etcd/etcd.go
+1
-1
rest.go
pkg/registry/persistentvolume/rest.go
+2
-14
etcd.go
pkg/registry/persistentvolumeclaim/etcd/etcd.go
+1
-1
rest.go
pkg/registry/persistentvolumeclaim/rest.go
+2
-7
No files found.
pkg/registry/persistentvolume/etcd/etcd.go
View file @
69d1d235
...
@@ -56,7 +56,7 @@ func NewStorage(h tools.EtcdHelper) (*REST, *StatusREST) {
...
@@ -56,7 +56,7 @@ func NewStorage(h tools.EtcdHelper) (*REST, *StatusREST) {
}
}
store
.
CreateStrategy
=
persistentvolume
.
Strategy
store
.
CreateStrategy
=
persistentvolume
.
Strategy
store
.
UpdateStrategy
=
persistentvolume
.
Strategy
store
.
UpdateStrategy
=
persistentvolume
.
St
atusSt
rategy
store
.
ReturnDeletedObject
=
true
store
.
ReturnDeletedObject
=
true
statusStore
:=
*
store
statusStore
:=
*
store
...
...
pkg/registry/persistentvolume/rest.go
View file @
69d1d235
...
@@ -49,15 +49,8 @@ func (persistentvolumeStrategy) PrepareForCreate(obj runtime.Object) {
...
@@ -49,15 +49,8 @@ func (persistentvolumeStrategy) PrepareForCreate(obj runtime.Object) {
pv
.
Status
=
api
.
PersistentVolumeStatus
{}
pv
.
Status
=
api
.
PersistentVolumeStatus
{}
}
}
// PrepareForUpdate clears fields that are not allowed to be set by end users on update.
func
(
persistentvolumeStrategy
)
PrepareForUpdate
(
obj
,
old
runtime
.
Object
)
{
newPv
:=
obj
.
(
*
api
.
PersistentVolume
)
oldPv
:=
obj
.
(
*
api
.
PersistentVolume
)
newPv
.
Status
=
oldPv
.
Status
}
// Validate validates a new persistentvolume.
// Validate validates a new persistentvolume.
func
(
persistentvolumeStrategy
)
Validate
(
obj
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
func
(
persistentvolumeStrategy
)
Validate
(
ctx
api
.
Context
,
obj
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
persistentvolume
:=
obj
.
(
*
api
.
PersistentVolume
)
persistentvolume
:=
obj
.
(
*
api
.
PersistentVolume
)
return
validation
.
ValidatePersistentVolume
(
persistentvolume
)
return
validation
.
ValidatePersistentVolume
(
persistentvolume
)
}
}
...
@@ -67,11 +60,6 @@ func (persistentvolumeStrategy) AllowCreateOnUpdate() bool {
...
@@ -67,11 +60,6 @@ func (persistentvolumeStrategy) AllowCreateOnUpdate() bool {
return
false
return
false
}
}
// ValidateUpdate is the default update validation for an end user.
func
(
persistentvolumeStrategy
)
ValidateUpdate
(
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
return
validation
.
ValidatePersistentVolumeUpdate
(
obj
.
(
*
api
.
PersistentVolume
),
old
.
(
*
api
.
PersistentVolume
))
}
type
persistentvolumeStatusStrategy
struct
{
type
persistentvolumeStatusStrategy
struct
{
persistentvolumeStrategy
persistentvolumeStrategy
}
}
...
@@ -84,7 +72,7 @@ func (persistentvolumeStatusStrategy) PrepareForUpdate(obj, old runtime.Object)
...
@@ -84,7 +72,7 @@ func (persistentvolumeStatusStrategy) PrepareForUpdate(obj, old runtime.Object)
newPv
.
Spec
=
oldPv
.
Spec
newPv
.
Spec
=
oldPv
.
Spec
}
}
func
(
persistentvolumeStatusStrategy
)
ValidateUpdate
(
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
func
(
persistentvolumeStatusStrategy
)
ValidateUpdate
(
ctx
api
.
Context
,
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
return
validation
.
ValidatePersistentVolumeStatusUpdate
(
obj
.
(
*
api
.
PersistentVolume
),
old
.
(
*
api
.
PersistentVolume
))
return
validation
.
ValidatePersistentVolumeStatusUpdate
(
obj
.
(
*
api
.
PersistentVolume
),
old
.
(
*
api
.
PersistentVolume
))
}
}
...
...
pkg/registry/persistentvolumeclaim/etcd/etcd.go
View file @
69d1d235
...
@@ -56,7 +56,7 @@ func NewStorage(h tools.EtcdHelper) *REST {
...
@@ -56,7 +56,7 @@ func NewStorage(h tools.EtcdHelper) *REST {
}
}
store
.
CreateStrategy
=
persistentvolumeclaim
.
Strategy
store
.
CreateStrategy
=
persistentvolumeclaim
.
Strategy
store
.
UpdateStrategy
=
persistentvolumeclaim
.
Strategy
store
.
UpdateStrategy
=
persistentvolumeclaim
.
St
atusSt
rategy
store
.
ReturnDeletedObject
=
true
store
.
ReturnDeletedObject
=
true
return
&
REST
{
store
}
return
&
REST
{
store
}
...
...
pkg/registry/persistentvolumeclaim/rest.go
View file @
69d1d235
...
@@ -57,7 +57,7 @@ func (persistentvolumeclaimStrategy) PrepareForUpdate(obj, old runtime.Object) {
...
@@ -57,7 +57,7 @@ func (persistentvolumeclaimStrategy) PrepareForUpdate(obj, old runtime.Object) {
}
}
// Validate validates a new persistentvolumeclaim.
// Validate validates a new persistentvolumeclaim.
func
(
persistentvolumeclaimStrategy
)
Validate
(
obj
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
func
(
persistentvolumeclaimStrategy
)
Validate
(
ctx
api
.
Context
,
obj
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
pvc
:=
obj
.
(
*
api
.
PersistentVolumeClaim
)
pvc
:=
obj
.
(
*
api
.
PersistentVolumeClaim
)
return
validation
.
ValidatePersistentVolumeClaim
(
pvc
)
return
validation
.
ValidatePersistentVolumeClaim
(
pvc
)
}
}
...
@@ -67,11 +67,6 @@ func (persistentvolumeclaimStrategy) AllowCreateOnUpdate() bool {
...
@@ -67,11 +67,6 @@ func (persistentvolumeclaimStrategy) AllowCreateOnUpdate() bool {
return
false
return
false
}
}
// ValidateUpdate is the default update validation for an end user.
func
(
persistentvolumeclaimStrategy
)
ValidateUpdate
(
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
return
validation
.
ValidatePersistentVolumeClaimUpdate
(
obj
.
(
*
api
.
PersistentVolumeClaim
),
old
.
(
*
api
.
PersistentVolumeClaim
))
}
type
persistentvolumeclaimStatusStrategy
struct
{
type
persistentvolumeclaimStatusStrategy
struct
{
persistentvolumeclaimStrategy
persistentvolumeclaimStrategy
}
}
...
@@ -84,7 +79,7 @@ func (persistentvolumeclaimStatusStrategy) PrepareForUpdate(obj, old runtime.Obj
...
@@ -84,7 +79,7 @@ func (persistentvolumeclaimStatusStrategy) PrepareForUpdate(obj, old runtime.Obj
newPvc
.
Spec
=
oldPvc
.
Spec
newPvc
.
Spec
=
oldPvc
.
Spec
}
}
func
(
persistentvolumeclaimStatusStrategy
)
ValidateUpdate
(
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
func
(
persistentvolumeclaimStatusStrategy
)
ValidateUpdate
(
ctx
api
.
Context
,
obj
,
old
runtime
.
Object
)
fielderrors
.
ValidationErrorList
{
return
validation
.
ValidatePersistentVolumeClaimStatusUpdate
(
obj
.
(
*
api
.
PersistentVolumeClaim
),
old
.
(
*
api
.
PersistentVolumeClaim
))
return
validation
.
ValidatePersistentVolumeClaimStatusUpdate
(
obj
.
(
*
api
.
PersistentVolumeClaim
),
old
.
(
*
api
.
PersistentVolumeClaim
))
}
}
...
...
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