migrate mitchellh/hashstructure to v2 (#9651)

This commit is contained in:
Mitsuo Heijo 2023-02-23 00:27:57 +09:00 committed by GitHub
parent d21ae2dbf6
commit c5d73d58c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 11 deletions

View file

@ -23,7 +23,7 @@ import (
"strings"
"time"
"github.com/mitchellh/hashstructure"
"github.com/mitchellh/hashstructure/v2"
apiv1 "k8s.io/api/core/v1"
networking "k8s.io/api/networking/v1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
@ -187,7 +187,7 @@ func (n *NGINXController) syncIngress(interface{}) error {
if !utilingress.IsDynamicConfigurationEnough(pcfg, n.runningConfig) {
klog.InfoS("Configuration changes detected, backend reload required")
hash, _ := hashstructure.Hash(pcfg, &hashstructure.HashOptions{
hash, _ := hashstructure.Hash(pcfg, hashstructure.FormatV1, &hashstructure.HashOptions{
TagName: "json",
})

View file

@ -26,7 +26,7 @@ import (
"k8s.io/klog/v2"
"github.com/mitchellh/hashstructure"
"github.com/mitchellh/hashstructure/v2"
"github.com/mitchellh/mapstructure"
"k8s.io/apimachinery/pkg/util/sets"
@ -431,7 +431,7 @@ func ReadConfig(src map[string]string) config.Configuration {
klog.Warningf("unexpected error merging defaults: %v", err)
}
hash, err := hashstructure.Hash(to, &hashstructure.HashOptions{
hash, err := hashstructure.Hash(to, hashstructure.FormatV1, &hashstructure.HashOptions{
TagName: "json",
})
if err != nil {

View file

@ -23,7 +23,7 @@ import (
"time"
"github.com/kylelemons/godebug/pretty"
"github.com/mitchellh/hashstructure"
"github.com/mitchellh/hashstructure/v2"
"k8s.io/ingress-nginx/internal/ingress/annotations/authreq"
"k8s.io/ingress-nginx/internal/ingress/controller/config"
@ -104,7 +104,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
def.DefaultType = "text/plain"
def.DebugConnections = []string{"127.0.0.1", "1.1.1.1/24", "::1"}
hash, err := hashstructure.Hash(def, &hashstructure.HashOptions{
hash, err := hashstructure.Hash(def, hashstructure.FormatV1, &hashstructure.HashOptions{
TagName: "json",
})
if err != nil {
@ -134,7 +134,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
def.LuaSharedDicts = defaultLuaSharedDicts
def.DisableIpv6DNS = true
hash, err = hashstructure.Hash(def, &hashstructure.HashOptions{
hash, err = hashstructure.Hash(def, hashstructure.FormatV1, &hashstructure.HashOptions{
TagName: "json",
})
if err != nil {
@ -155,7 +155,7 @@ func TestMergeConfigMapToStruct(t *testing.T) {
def.WhitelistSourceRange = []string{"1.1.1.1/32"}
def.DisableIpv6DNS = true
hash, err = hashstructure.Hash(def, &hashstructure.HashOptions{
hash, err = hashstructure.Hash(def, hashstructure.FormatV1, &hashstructure.HashOptions{
TagName: "json",
})
if err != nil {