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
2a2f88b9
Commit
2a2f88b9
authored
Jan 24, 2018
by
NickrenREN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename PVCProtection feature gate so that PV protection can share the feature…
Rename PVCProtection feature gate so that PV protection can share the feature gate with PVC protection
parent
494664a7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
11 additions
and
11 deletions
+11
-11
core.go
cmd/kube-controller-manager/app/core.go
+1
-1
kube_features.go
pkg/features/kube_features.go
+4
-4
desired_state_of_world_populator.go
...lumemanager/populator/desired_state_of_world_populator.go
+1
-1
admission.go
...dmission/persistentvolumeclaim/pvcprotection/admission.go
+1
-1
admission_test.go
...ion/persistentvolumeclaim/pvcprotection/admission_test.go
+2
-2
controller_policy.go
...auth/authorizer/rbac/bootstrappolicy/controller_policy.go
+1
-1
pvc_protection.go
test/e2e/storage/pvc_protection.go
+1
-1
No files found.
cmd/kube-controller-manager/app/core.go
View file @
2a2f88b9
...
@@ -393,7 +393,7 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
...
@@ -393,7 +393,7 @@ func startGarbageCollectorController(ctx ControllerContext) (bool, error) {
}
}
func
startPVCProtectionController
(
ctx
ControllerContext
)
(
bool
,
error
)
{
func
startPVCProtectionController
(
ctx
ControllerContext
)
(
bool
,
error
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
PVC
Protection
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Storage
Protection
)
{
go
pvcprotection
.
NewPVCProtectionController
(
go
pvcprotection
.
NewPVCProtectionController
(
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
PersistentVolumeClaims
(),
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
PersistentVolumeClaims
(),
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
Pods
(),
ctx
.
InformerFactory
.
Core
()
.
V1
()
.
Pods
(),
...
...
pkg/features/kube_features.go
View file @
2a2f88b9
...
@@ -203,10 +203,10 @@ const (
...
@@ -203,10 +203,10 @@ const (
BlockVolume
utilfeature
.
Feature
=
"BlockVolume"
BlockVolume
utilfeature
.
Feature
=
"BlockVolume"
// owner: @pospispa
// owner: @pospispa
//
// alpha: v1.9
// alpha: v1.9
// Postpone deletion of a persistent volume claim in case it is used by a pod
//
PVCProtection
utilfeature
.
Feature
=
"PVCProtection"
// Postpone deletion of a PV or a PVC when they are being used
StorageProtection
utilfeature
.
Feature
=
"StorageProtection"
// owner: @aveshagarwal
// owner: @aveshagarwal
// alpha: v1.9
// alpha: v1.9
...
@@ -261,7 +261,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
...
@@ -261,7 +261,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
CSIPersistentVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CSIPersistentVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CustomPodDNS
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
CustomPodDNS
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
BlockVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
BlockVolume
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
PVCProtection
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
StorageProtection
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
ResourceLimitsPriorityFunction
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
ResourceLimitsPriorityFunction
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
SupportIPVSProxyMode
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Beta
},
SupportIPVSProxyMode
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Beta
},
SupportPodPidsLimit
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
SupportPodPidsLimit
:
{
Default
:
false
,
PreRelease
:
utilfeature
.
Alpha
},
...
...
pkg/kubelet/volumemanager/populator/desired_state_of_world_populator.go
View file @
2a2f88b9
...
@@ -434,7 +434,7 @@ func (dswp *desiredStateOfWorldPopulator) getPVCExtractPV(
...
@@ -434,7 +434,7 @@ func (dswp *desiredStateOfWorldPopulator) getPVCExtractPV(
err
)
err
)
}
}
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
PVC
Protection
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Storage
Protection
)
{
// Pods that uses a PVC that is being deleted must not be started.
// Pods that uses a PVC that is being deleted must not be started.
//
//
// In case an old kubelet is running without this check or some kubelets
// In case an old kubelet is running without this check or some kubelets
...
...
plugin/pkg/admission/persistentvolumeclaim/pvcprotection/admission.go
View file @
2a2f88b9
...
@@ -80,7 +80,7 @@ func (c *pvcProtectionPlugin) ValidateInitialization() error {
...
@@ -80,7 +80,7 @@ func (c *pvcProtectionPlugin) ValidateInitialization() error {
//
//
// This prevents users from deleting a PVC that's used by a running pod.
// This prevents users from deleting a PVC that's used by a running pod.
func
(
c
*
pvcProtectionPlugin
)
Admit
(
a
admission
.
Attributes
)
error
{
func
(
c
*
pvcProtectionPlugin
)
Admit
(
a
admission
.
Attributes
)
error
{
if
!
feature
.
DefaultFeatureGate
.
Enabled
(
features
.
PVC
Protection
)
{
if
!
feature
.
DefaultFeatureGate
.
Enabled
(
features
.
Storage
Protection
)
{
return
nil
return
nil
}
}
...
...
plugin/pkg/admission/persistentvolumeclaim/pvcprotection/admission_test.go
View file @
2a2f88b9
...
@@ -77,7 +77,7 @@ func TestAdmit(t *testing.T) {
...
@@ -77,7 +77,7 @@ func TestAdmit(t *testing.T) {
ctrl
.
SetInternalKubeInformerFactory
(
informerFactory
)
ctrl
.
SetInternalKubeInformerFactory
(
informerFactory
)
for
_
,
test
:=
range
tests
{
for
_
,
test
:=
range
tests
{
feature
.
DefaultFeatureGate
.
Set
(
fmt
.
Sprintf
(
"
PVC
Protection=%v"
,
test
.
featureEnabled
))
feature
.
DefaultFeatureGate
.
Set
(
fmt
.
Sprintf
(
"
Storage
Protection=%v"
,
test
.
featureEnabled
))
obj
:=
test
.
object
.
DeepCopyObject
()
obj
:=
test
.
object
.
DeepCopyObject
()
attrs
:=
admission
.
NewAttributesRecord
(
attrs
:=
admission
.
NewAttributesRecord
(
obj
,
// new object
obj
,
// new object
...
@@ -102,5 +102,5 @@ func TestAdmit(t *testing.T) {
...
@@ -102,5 +102,5 @@ func TestAdmit(t *testing.T) {
// Disable the feature for rest of the tests.
// Disable the feature for rest of the tests.
// TODO: remove after alpha
// TODO: remove after alpha
feature
.
DefaultFeatureGate
.
Set
(
"
PVC
Protection=false"
)
feature
.
DefaultFeatureGate
.
Set
(
"
Storage
Protection=false"
)
}
}
plugin/pkg/auth/authorizer/rbac/bootstrappolicy/controller_policy.go
View file @
2a2f88b9
...
@@ -324,7 +324,7 @@ func buildControllerRoles() ([]rbac.ClusterRole, []rbac.ClusterRoleBinding) {
...
@@ -324,7 +324,7 @@ func buildControllerRoles() ([]rbac.ClusterRole, []rbac.ClusterRoleBinding) {
eventsRule
(),
eventsRule
(),
},
},
})
})
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
PVC
Protection
)
{
if
utilfeature
.
DefaultFeatureGate
.
Enabled
(
features
.
Storage
Protection
)
{
addControllerRole
(
&
controllerRoles
,
&
controllerRoleBindings
,
rbac
.
ClusterRole
{
addControllerRole
(
&
controllerRoles
,
&
controllerRoleBindings
,
rbac
.
ClusterRole
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
saRolePrefix
+
"pvc-protection-controller"
},
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
saRolePrefix
+
"pvc-protection-controller"
},
Rules
:
[]
rbac
.
PolicyRule
{
Rules
:
[]
rbac
.
PolicyRule
{
...
...
test/e2e/storage/pvc_protection.go
View file @
2a2f88b9
...
@@ -33,7 +33,7 @@ import (
...
@@ -33,7 +33,7 @@ import (
"k8s.io/kubernetes/test/e2e/storage/utils"
"k8s.io/kubernetes/test/e2e/storage/utils"
)
)
var
_
=
utils
.
SIGDescribe
(
"PVC Protection [Feature:
PVC
Protection]"
,
func
()
{
var
_
=
utils
.
SIGDescribe
(
"PVC Protection [Feature:
Storage
Protection]"
,
func
()
{
var
(
var
(
client
clientset
.
Interface
client
clientset
.
Interface
nameSpace
string
nameSpace
string
...
...
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