mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
add envar to disable non semantic updates feature
enabled by default. can easily be changed in backports
This commit is contained in:
parent
40343793f7
commit
076051135d
@ -19,7 +19,9 @@ package fieldmanager
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/api/equality"
|
"k8s.io/apimachinery/pkg/api/equality"
|
||||||
@ -28,6 +30,24 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/conversion"
|
"k8s.io/apimachinery/pkg/conversion"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apiserver/pkg/endpoints/metrics"
|
"k8s.io/apiserver/pkg/endpoints/metrics"
|
||||||
|
"k8s.io/klog/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func determineIgnoreNonSemanticUpdatesEnabled() bool {
|
||||||
|
if ignoreNonSemanticUpdatesString, exists := os.LookupEnv("KUBE_APISERVER_IGNORE_NON_SEMANTIC_UPDATES"); exists {
|
||||||
|
if ret, err := strconv.ParseBool(ignoreNonSemanticUpdatesString); err == nil {
|
||||||
|
return ret
|
||||||
|
} else {
|
||||||
|
klog.Errorf("failed to parse envar KUBE_APISERVER_IGNORE_NON_SEMANTIC_UPDATES: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// enabled by default
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
var (
|
||||||
|
ignoreNonSemanticUpdatesEnabled = determineIgnoreNonSemanticUpdatesEnabled()
|
||||||
)
|
)
|
||||||
|
|
||||||
var ignoreTimestampEqualities = func() conversion.Equalities {
|
var ignoreTimestampEqualities = func() conversion.Equalities {
|
||||||
@ -57,6 +77,10 @@ func IgnoreManagedFieldsTimestampsTransformer(
|
|||||||
newObj runtime.Object,
|
newObj runtime.Object,
|
||||||
oldObj runtime.Object,
|
oldObj runtime.Object,
|
||||||
) (res runtime.Object, err error) {
|
) (res runtime.Object, err error) {
|
||||||
|
if !ignoreNonSemanticUpdatesEnabled {
|
||||||
|
return newObj, nil
|
||||||
|
}
|
||||||
|
|
||||||
outcome := "unequal_objects_fast"
|
outcome := "unequal_objects_fast"
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
err = nil
|
err = nil
|
||||||
|
Loading…
Reference in New Issue
Block a user