Skip to content

Using Gateway API 1.3.0 and its types clientset causes sigs.k8s.io/structured-merge-diff deps conflict #4055

@pmalek

Description

@pmalek

What happened:

Importing an API package like sigs.k8s.io/gateway-api/apis/v1 and one of the typed clients e.g. sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1 causes compilation errors due to conflicted sigs.k8s.io/structured-merge-diff major dependencies

go run .
# sigs.k8s.io/gateway-api/applyconfiguration/apis/v1
../../../.gvm/pkgsets/go1.25.0/global/pkg/mod/sigs.k8s.io/[email protected]/applyconfiguration/apis/v1/gateway.go:74:44: cannot use internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1.Gateway") (value of struct type "sigs.k8s.io/structured-merge-diff/v4/typed".ParseableType) as "sigs.k8s.io/structured-merge-diff/v6/typed".ParseableType value in argument to managedfields.ExtractInto
../../../.gvm/pkgsets/go1.25.0/global/pkg/mod/sigs.k8s.io/[email protected]/applyconfiguration/apis/v1/gatewayclass.go:73:49: cannot use internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1.GatewayClass") (value of struct type "sigs.k8s.io/structured-merge-diff/v4/typed".ParseableType) as "sigs.k8s.io/structured-merge-diff/v6/typed".ParseableType value in argument to managedfields.ExtractInto
../../../.gvm/pkgsets/go1.25.0/global/pkg/mod/sigs.k8s.io/[email protected]/applyconfiguration/apis/v1/grpcroute.go:74:46: cannot use internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1.GRPCRoute") (value of struct type "sigs.k8s.io/structured-merge-diff/v4/typed".ParseableType) as "sigs.k8s.io/structured-merge-diff/v6/typed".ParseableType value in argument to managedfields.ExtractInto
../../../.gvm/pkgsets/go1.25.0/global/pkg/mod/sigs.k8s.io/[email protected]/applyconfiguration/apis/v1/httproute.go:74:46: cannot use internal.Parser().Type("io.k8s.sigs.gateway-api.apis.v1.HTTPRoute") (value of struct type "sigs.k8s.io/structured-merge-diff/v4/typed".ParseableType) as "sigs.k8s.io/structured-merge-diff/v6/typed".ParseableType value in argument to managedfields.ExtractInto

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

package main

import (
	gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
	gwapiv1client "sigs.k8s.io/gateway-api/pkg/client/clientset/versioned/typed/apis/v1"
)

func main() {
	var g gatewayv1.Gateway
	_ = g
	var gwClient gwapiv1client.GatewayV1Client
	_ = gwClient
}

go.mod

module gatewayapimergediff

go 1.24.0

require sigs.k8s.io/gateway-api v1.3.0

require (
	github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
	github.com/emicklei/go-restful/v3 v3.12.2 // indirect
	github.com/go-openapi/jsonpointer v0.21.0 // indirect
	github.com/go-openapi/jsonreference v0.21.0 // indirect
	github.com/go-openapi/swag v0.23.0 // indirect
	github.com/google/gnostic-models v0.7.0 // indirect
	github.com/google/uuid v1.6.0 // indirect
	github.com/josharian/intern v1.0.0 // indirect
	github.com/mailru/easyjson v0.7.7 // indirect
	github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
	github.com/onsi/ginkgo/v2 v2.22.0 // indirect
	github.com/onsi/gomega v1.36.1 // indirect
	github.com/pkg/errors v0.9.1 // indirect
	go.yaml.in/yaml/v2 v2.4.2 // indirect
	go.yaml.in/yaml/v3 v3.0.4 // indirect
	golang.org/x/oauth2 v0.27.0 // indirect
	golang.org/x/sys v0.32.0 // indirect
	golang.org/x/term v0.31.0 // indirect
	golang.org/x/time v0.9.0 // indirect
	google.golang.org/protobuf v1.36.6 // indirect
	gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
	gopkg.in/yaml.v3 v3.0.1 // indirect
	k8s.io/api v0.34.0 // indirect
	k8s.io/client-go v0.34.0 // indirect
	k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
	sigs.k8s.io/randfill v1.0.0 // indirect
	sigs.k8s.io/structured-merge-diff/v4 v4.7.0 // indirect
	sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect
)

require (
	github.com/fxamacker/cbor/v2 v2.9.0 // indirect
	github.com/go-logr/logr v1.4.2 // indirect
	github.com/gogo/protobuf v1.3.2 // indirect
	github.com/json-iterator/go v1.1.12 // indirect
	github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
	github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect
	github.com/x448/float16 v0.8.4 // indirect
	golang.org/x/net v0.39.0 // indirect
	golang.org/x/text v0.24.0 // indirect
	gopkg.in/inf.v0 v0.9.1 // indirect
	k8s.io/apimachinery v0.34.0 // indirect
	k8s.io/klog/v2 v2.130.1 // indirect
	k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect
	sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
	sigs.k8s.io/yaml v1.6.0 // indirect
)

Anything else we need to know?:

This came up when bumping the controller-runtime dependency to v0.22.0 in Kong/kong-operator#2149 (where Gateway API is already at 1.3.0).

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions