mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-17 15:50:10 +00:00
Add recommendation for using OnRootMismatch
This commit is contained in:
parent
49dabe56d0
commit
32752fe395
@ -25,6 +25,7 @@ import (
|
||||
"google.golang.org/grpc/status"
|
||||
"k8s.io/component-base/metrics"
|
||||
"k8s.io/component-base/metrics/legacyregistry"
|
||||
"k8s.io/klog/v2"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/util/types"
|
||||
)
|
||||
@ -102,6 +103,7 @@ func OperationCompleteHook(plugin, operationName string) func(types.CompleteFunc
|
||||
if c.Migrated != nil {
|
||||
migrated = *c.Migrated
|
||||
}
|
||||
klog.Infof("foobar Operation %s took %f", operationName, timeTaken)
|
||||
StorageOperationMetric.WithLabelValues(plugin, operationName, status, strconv.FormatBool(migrated)).Observe(timeTaken)
|
||||
}
|
||||
return opComplete
|
||||
|
@ -121,6 +121,8 @@ func (vo *VolumeOwnership) changePermissionsRecursively() error {
|
||||
}
|
||||
|
||||
func (vo *VolumeOwnership) monitorProgress(ctx context.Context) {
|
||||
msg := fmt.Sprintf("Setting volume ownership for %s is taking longer than expected, consider using OnRootMismatch - https://kubernetes.io/docs/tasks/configure-pod-container/security-context/#configure-volume-permission-and-ownership-change-policy-for-pods", vo.dir)
|
||||
vo.recorder.Event(vo.pod, v1.EventTypeWarning, events.VolumePermissionChangeInProgress, msg)
|
||||
ticker := time.NewTicker(progressReportDuration)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
@ -134,7 +136,7 @@ func (vo *VolumeOwnership) monitorProgress(ctx context.Context) {
|
||||
}
|
||||
|
||||
func (vo *VolumeOwnership) logWarning() {
|
||||
msg := fmt.Sprintf("Setting volume ownership for %s, processed %d files", vo.dir, vo.fileCounter.Load())
|
||||
msg := fmt.Sprintf("Setting volume ownership for %s, processed %d files.", vo.dir, vo.fileCounter.Load())
|
||||
klog.Warning(msg)
|
||||
vo.recorder.Event(vo.pod, v1.EventTypeWarning, events.VolumePermissionChangeInProgress, msg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user