diff --git a/pkg/generated/openapi/zz_generated.openapi.go b/apis/openapi/zz_generated.openapi.go similarity index 100% rename from pkg/generated/openapi/zz_generated.openapi.go rename to apis/openapi/zz_generated.openapi.go diff --git a/cmd/modelschema/main.go b/cmd/modelschema/main.go index 42713567e5..a04294ace5 100644 --- a/cmd/modelschema/main.go +++ b/cmd/modelschema/main.go @@ -24,7 +24,7 @@ import ( "os" "strings" - openapi "sigs.k8s.io/gateway-api/pkg/generated/openapi" + stable "sigs.k8s.io/gateway-api/apis/openapi" "k8s.io/kube-openapi/pkg/common" "k8s.io/kube-openapi/pkg/validation/spec" @@ -43,7 +43,7 @@ func output() error { refFunc := func(name string) spec.Ref { return spec.MustCreateRef(fmt.Sprintf("#/definitions/%s", friendlyName(name))) } - defs := openapi.GetOpenAPIDefinitions(refFunc) + defs := stable.GetOpenAPIDefinitions(refFunc) schemaDefs := make(map[string]spec.Schema, len(defs)) for k, v := range defs { // Replace top-level schema with v2 if a v2 schema is embedded diff --git a/hack/update-clientset.sh b/hack/update-clientset.sh new file mode 100755 index 0000000000..ec3ecceefc --- /dev/null +++ b/hack/update-clientset.sh @@ -0,0 +1,127 @@ +#!/usr/bin/env bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# https://github.com/kubernetes/code-generator provides generator code to generate a custom typed +# and versioned client for custom API types similar to what https://github.com/kubernetes/client-go +# provides for core types. This script generates such a client for the Gateway API types, in service of any +# projects that need them. + +set -o errexit +set -o nounset +set -o pipefail + + +if [[ "${1:-stable}" == "experimental" ]]; then + readonly API_PATH="apisx" +else + readonly API_PATH="apis" +fi + +readonly SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE}")"/.. && pwd)" + +if [[ "${VERIFY_CODEGEN:-}" == "true" ]]; then + echo "Running in verification mode" + readonly VERIFY_FLAG="--verify-only" +fi + +readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt" + +readonly APIS_PKG=sigs.k8s.io/gateway-api +readonly CLIENTSET_NAME=versioned +readonly CLIENTSET_PKG_NAME=clientset +readonly VERSIONS=($(find ./${API_PATH} -maxdepth 1 -name "v*" -exec bash -c 'basename {}' \; | xargs)) + +if [[ "${1:-stable}" == "experimental" ]]; then + readonly OUTPUT_DIR=pkg/clientx + readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/clientx +else + readonly OUTPUT_DIR=pkg/client + readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/client +fi + +GATEWAY_INPUT_DIRS_SPACE="" +GATEWAY_INPUT_DIRS_COMMA="" +for VERSION in "${VERSIONS[@]}" +do + GATEWAY_INPUT_DIRS_SPACE+="${APIS_PKG}/${API_PATH}/${VERSION} " + GATEWAY_INPUT_DIRS_COMMA+="${APIS_PKG}/${API_PATH}/${VERSION}," +done +GATEWAY_INPUT_DIRS_SPACE="${GATEWAY_INPUT_DIRS_SPACE%,}" # drop trailing space +GATEWAY_INPUT_DIRS_COMMA="${GATEWAY_INPUT_DIRS_COMMA%,}" # drop trailing comma + +# throw away +new_report="$(mktemp -t "$(basename "$0").api_violations.XXXXXX")" + +echo "Generating openapi schema" +go run k8s.io/kube-openapi/cmd/openapi-gen \ + --output-file zz_generated.openapi.go \ + --report-filename "${new_report}" \ + --output-dir "${API_PATH}/openapi" \ + --output-pkg "sigs.k8s.io/gateway-api/${API_PATH}/openapi" \ + ${COMMON_FLAGS} \ + $GATEWAY_INPUT_DIRS_SPACE \ + k8s.io/apimachinery/pkg/apis/meta/v1 \ + k8s.io/apimachinery/pkg/runtime \ + k8s.io/apimachinery/pkg/version + + +echo "Generating apply configuration" +go run k8s.io/code-generator/cmd/applyconfiguration-gen \ + --openapi-schema <(go run ${SCRIPT_ROOT}/cmd/modelschema) \ + --output-dir "${API_PATH}/applyconfiguration" \ + --output-pkg "${APIS_PKG}/${API_PATH}/applyconfiguration" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" +go run k8s.io/code-generator/cmd/client-gen \ + --clientset-name "${CLIENTSET_NAME}" \ + --input-base "${APIS_PKG}" \ + --input "${GATEWAY_INPUT_DIRS_COMMA//${APIS_PKG}/}" \ + --output-dir "${OUTPUT_DIR}/${CLIENTSET_PKG_NAME}" \ + --output-pkg "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ + --apply-configuration-package "${APIS_PKG}/${API_PATH}/applyconfiguration" \ + ${COMMON_FLAGS} + +echo "Generating listers at ${OUTPUT_PKG}/listers" +go run k8s.io/code-generator/cmd/lister-gen \ + --output-dir "${OUTPUT_DIR}/listers" \ + --output-pkg "${OUTPUT_PKG}/listers" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating informers at ${OUTPUT_PKG}/informers" +go run k8s.io/code-generator/cmd/informer-gen \ + --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ + --listers-package "${OUTPUT_PKG}/listers" \ + --output-dir "${OUTPUT_DIR}/informers" \ + --output-pkg "${OUTPUT_PKG}/informers" \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +echo "Generating ${VERSION} register at ${APIS_PKG}/${API_PATH}/${VERSION}" +go run k8s.io/code-generator/cmd/register-gen \ + --output-file zz_generated.register.go \ + ${COMMON_FLAGS} \ + ${GATEWAY_INPUT_DIRS_SPACE} + +for VERSION in "${VERSIONS[@]}" +do + echo "Generating ${VERSION} deepcopy at ${APIS_PKG}/${API_PATH}/${VERSION}" + go run sigs.k8s.io/controller-tools/cmd/controller-gen \ + object:headerFile=${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt \ + paths="${APIS_PKG}/${API_PATH}/${VERSION}" +done diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 2608fc2c4f..921bc154f5 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -46,202 +46,8 @@ export GOMODCACHE GO111MODULE GOFLAGS GOPATH mkdir -p "$GOPATH/src/sigs.k8s.io" ln -s "${SCRIPT_ROOT}" "$GOPATH/src/sigs.k8s.io/gateway-api" -readonly OUTPUT_PKG=sigs.k8s.io/gateway-api/pkg/client -readonly APIS_PKG=sigs.k8s.io/gateway-api -readonly CLIENTSET_NAME=versioned -readonly CLIENTSET_PKG_NAME=clientset -readonly VERSIONS=(v1alpha2 v1alpha3 v1beta1 v1) - -GATEWAY_INPUT_DIRS_SPACE="" -GATEWAY_INPUT_DIRS_COMMA="" -for VERSION in "${VERSIONS[@]}" -do - GATEWAY_INPUT_DIRS_SPACE+="${APIS_PKG}/apis/${VERSION} " - GATEWAY_INPUT_DIRS_COMMA+="${APIS_PKG}/apis/${VERSION}," -done -GATEWAY_INPUT_DIRS_SPACE="${GATEWAY_INPUT_DIRS_SPACE%,}" # drop trailing space -GATEWAY_INPUT_DIRS_COMMA="${GATEWAY_INPUT_DIRS_COMMA%,}" # drop trailing comma - - -if [[ "${VERIFY_CODEGEN:-}" == "true" ]]; then - echo "Running in verification mode" - readonly VERIFY_FLAG="--verify-only" -fi - -readonly COMMON_FLAGS="${VERIFY_FLAG:-} --go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt" - echo "Generating CRDs" go run ./pkg/generator -# throw away -new_report="$(mktemp -t "$(basename "$0").api_violations.XXXXXX")" - -echo "Generating openapi schema" -go run k8s.io/kube-openapi/cmd/openapi-gen \ - --output-file zz_generated.openapi.go \ - --report-filename "${new_report}" \ - --output-dir "pkg/generated/openapi" \ - --output-pkg "sigs.k8s.io/gateway-api/pkg/generated/openapi" \ - ${COMMON_FLAGS} \ - $GATEWAY_INPUT_DIRS_SPACE \ - k8s.io/apimachinery/pkg/apis/meta/v1 \ - k8s.io/apimachinery/pkg/runtime \ - k8s.io/apimachinery/pkg/version - - -echo "Generating apply configuration" -go run k8s.io/code-generator/cmd/applyconfiguration-gen \ - --openapi-schema <(go run ${SCRIPT_ROOT}/cmd/modelschema) \ - --output-dir "apis/applyconfiguration" \ - --output-pkg "${APIS_PKG}/apis/applyconfiguration" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - - -# Temporary hack until https://github.com/kubernetes/kubernetes/pull/124371 is released -function fix_applyconfiguration() { - local package="$1" - local version="$(basename $1)" - - echo $package - echo $version - pushd $package > /dev/null - - # Replace import - for filename in *.go; do - import_line=$(grep "$package" "$filename") - if [[ -z "$import_line" ]]; then - continue - fi - import_prefix=$(echo "$import_line" | awk '{print $1}') - sed -i'.bak' -e "s,${import_prefix} \"sigs.k8s.io/gateway-api/${package}\",,g" "$filename" - sed -i'.bak' -e "s,\[\]${import_prefix}\.,\[\],g" "$filename" - sed -i'.bak' -e "s,&${import_prefix}\.,&,g" "$filename" - sed -i'.bak' -e "s,*${import_prefix}\.,*,g" "$filename" - sed -i'.bak' -e "s,^\t${import_prefix}\.,,g" "$filename" - done - - rm *.bak - go fmt . - find . -type f -name "*.go" -exec sed -i'.bak' -e "s,import (),,g" {} \; - rm *.bak - go fmt . - - popd > /dev/null -} - -export -f fix_applyconfiguration -find apis/applyconfiguration/apis -name "v*" -type d -exec bash -c 'fix_applyconfiguration $0' {} \; - -echo "Generating clientset at ${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" -go run k8s.io/code-generator/cmd/client-gen \ - --clientset-name "${CLIENTSET_NAME}" \ - --input-base "${APIS_PKG}" \ - --input "${GATEWAY_INPUT_DIRS_COMMA//${APIS_PKG}/}" \ - --output-dir "pkg/client/${CLIENTSET_PKG_NAME}" \ - --output-pkg "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}" \ - --apply-configuration-package "${APIS_PKG}/apis/applyconfiguration" \ - ${COMMON_FLAGS} - -echo "Generating listers at ${OUTPUT_PKG}/listers" -go run k8s.io/code-generator/cmd/lister-gen \ - --output-dir "pkg/client/listers" \ - --output-pkg "${OUTPUT_PKG}/listers" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -echo "Generating informers at ${OUTPUT_PKG}/informers" -go run k8s.io/code-generator/cmd/informer-gen \ - --versioned-clientset-package "${OUTPUT_PKG}/${CLIENTSET_PKG_NAME}/${CLIENTSET_NAME}" \ - --listers-package "${OUTPUT_PKG}/listers" \ - --output-dir "pkg/client/informers" \ - --output-pkg "${OUTPUT_PKG}/informers" \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -echo "Generating ${VERSION} register at ${APIS_PKG}/apis/${VERSION}" -go run k8s.io/code-generator/cmd/register-gen \ - --output-file zz_generated.register.go \ - ${COMMON_FLAGS} \ - ${GATEWAY_INPUT_DIRS_SPACE} - -for VERSION in "${VERSIONS[@]}" -do - echo "Generating ${VERSION} deepcopy at ${APIS_PKG}/apis/${VERSION}" - go run sigs.k8s.io/controller-tools/cmd/controller-gen \ - object:headerFile=${SCRIPT_ROOT}/hack/boilerplate/boilerplate.generatego.txt \ - paths="${APIS_PKG}/apis/${VERSION}" -done - -echo "Generating gRPC/Protobuf code" - -readonly PROTOC_CACHE_DIR="/tmp/protoc.cache" -readonly PROTOC_BINARY="${PROTOC_CACHE_DIR}/bin/protoc" -readonly PROTOC_VERSION="22.2" -readonly PROTOC_REPO="https://github.com/protocolbuffers/protobuf" - -readonly PROTOC_LINUX_X86_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" -readonly PROTOC_LINUX_X86_CHECKSUM="4805ba56594556402a6c327a8d885a47640ee363 ${PROTOC_BINARY}" - -readonly PROTOC_LINUX_ARM64_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip" -readonly PROTOC_LINUX_ARM64_CHECKSUM="47285b2386f990da319e9eef92cadec2dfa28733 ${PROTOC_BINARY}" - -readonly PROTOC_MAC_UNIVERSAL_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-universal_binary.zip" -readonly PROTOC_MAC_UNIVERSAL_CHECKSUM="2a79d0eb235c808eca8de893762072b94dc6144c ${PROTOC_BINARY}" - -PROTOC_URL="" -PROTOC_CHECKSUM="" - -ARCH=$(uname -m) -OS=$(uname) - -if [[ "${OS}" != "Linux" ]] && [[ "${OS}" != "Darwin" ]]; then - echo "Unsupported operating system ${OS}" >/dev/stderr - exit 1 -fi - -if [[ "${OS}" == "Linux" ]]; then - if [[ "$ARCH" == "x86_64" ]]; then - PROTOC_URL="$PROTOC_LINUX_X86_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_X86_CHECKSUM" - elif [[ "$ARCH" == "arm64" ]]; then - PROTOC_URL="$PROTOC_LINUX_ARM64_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" - elif [[ "$ARCH" == "aarch64" ]]; then - PROTOC_URL="$PROTOC_LINUX_ARM64_URL" - PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" - else - echo "Architecture ${ARCH} is not supported on OS ${OS}." >/dev/stderr - exit 1 - fi -elif [[ "${OS}" == "Darwin" ]]; then - PROTOC_URL="$PROTOC_MAC_UNIVERSAL_URL" - PROTOC_CHECKSUM="$PROTOC_MAC_UNIVERSAL_CHECKSUM" -fi - -function verify_protoc { - if ! echo "${PROTOC_CHECKSUM}" | shasum -c >/dev/null; then - echo "Downloaded protoc binary failed checksum." >/dev/stderr - exit 1 - fi -} - -function ensure_protoc { - mkdir -p "${PROTOC_CACHE_DIR}" - if [ ! -f "${PROTOC_BINARY}" ]; then - curl -sL -o "${PROTOC_CACHE_DIR}/protoc.zip" "${PROTOC_URL}" - unzip -d "${PROTOC_CACHE_DIR}" "${PROTOC_CACHE_DIR}/protoc.zip" - fi - verify_protoc -} - -ensure_protoc -go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 -go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 - -(cd conformance/echo-basic && \ - export PATH="$PATH:$GOPATH/bin" && \ - "${PROTOC_BINARY}" --go_out=grpcechoserver --go_opt=paths=source_relative \ - --go-grpc_out=grpcechoserver --go-grpc_opt=paths=source_relative \ - grpcecho.proto -) +./hack/update-clientset.sh +./hack/update-protos.sh diff --git a/hack/update-protos.sh b/hack/update-protos.sh new file mode 100755 index 0000000000..02828dbe19 --- /dev/null +++ b/hack/update-protos.sh @@ -0,0 +1,94 @@ +#!/usr/bin/env bash + +# Copyright 2025 The Kubernetes Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -o errexit +set -o nounset +set -o pipefail + +readonly SCRIPT_ROOT="$(cd "$(dirname "${BASH_SOURCE}")"/.. && pwd)" + +echo "Generating gRPC/Protobuf code" + +readonly PROTOC_CACHE_DIR="/tmp/protoc.cache" +readonly PROTOC_BINARY="${PROTOC_CACHE_DIR}/bin/protoc" +readonly PROTOC_VERSION="22.2" +readonly PROTOC_REPO="https://github.com/protocolbuffers/protobuf" + +readonly PROTOC_LINUX_X86_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip" +readonly PROTOC_LINUX_X86_CHECKSUM="4805ba56594556402a6c327a8d885a47640ee363 ${PROTOC_BINARY}" + +readonly PROTOC_LINUX_ARM64_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-aarch_64.zip" +readonly PROTOC_LINUX_ARM64_CHECKSUM="47285b2386f990da319e9eef92cadec2dfa28733 ${PROTOC_BINARY}" + +readonly PROTOC_MAC_UNIVERSAL_URL="${PROTOC_REPO}/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-osx-universal_binary.zip" +readonly PROTOC_MAC_UNIVERSAL_CHECKSUM="2a79d0eb235c808eca8de893762072b94dc6144c ${PROTOC_BINARY}" + +PROTOC_URL="" +PROTOC_CHECKSUM="" + +ARCH=$(uname -m) +OS=$(uname) + +if [[ "${OS}" != "Linux" ]] && [[ "${OS}" != "Darwin" ]]; then + echo "Unsupported operating system ${OS}" >/dev/stderr + exit 1 +fi + +if [[ "${OS}" == "Linux" ]]; then + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_URL="$PROTOC_LINUX_X86_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_X86_CHECKSUM" + elif [[ "$ARCH" == "arm64" ]]; then + PROTOC_URL="$PROTOC_LINUX_ARM64_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" + elif [[ "$ARCH" == "aarch64" ]]; then + PROTOC_URL="$PROTOC_LINUX_ARM64_URL" + PROTOC_CHECKSUM="$PROTOC_LINUX_ARM64_CHECKSUM" + else + echo "Architecture ${ARCH} is not supported on OS ${OS}." >/dev/stderr + exit 1 + fi +elif [[ "${OS}" == "Darwin" ]]; then + PROTOC_URL="$PROTOC_MAC_UNIVERSAL_URL" + PROTOC_CHECKSUM="$PROTOC_MAC_UNIVERSAL_CHECKSUM" +fi + +function verify_protoc { + if ! echo "${PROTOC_CHECKSUM}" | shasum -c >/dev/null; then + echo "Downloaded protoc binary failed checksum." >/dev/stderr + exit 1 + fi +} + +function ensure_protoc { + mkdir -p "${PROTOC_CACHE_DIR}" + if [ ! -f "${PROTOC_BINARY}" ]; then + curl -sL -o "${PROTOC_CACHE_DIR}/protoc.zip" "${PROTOC_URL}" + unzip -d "${PROTOC_CACHE_DIR}" "${PROTOC_CACHE_DIR}/protoc.zip" + fi + verify_protoc +} + +ensure_protoc +go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28 +go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2 + +(cd conformance/echo-basic && \ + export PATH="$PATH:$GOPATH/bin" && \ + "${PROTOC_BINARY}" --go_out=grpcechoserver --go_opt=paths=source_relative \ + --go-grpc_out=grpcechoserver --go-grpc_opt=paths=source_relative \ + grpcecho.proto +) diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 116d5cca8a..ef9ef2376f 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -33,19 +33,24 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + GatewayV1() gatewayv1.GatewayV1Interface GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface GatewayV1alpha3() gatewayv1alpha3.GatewayV1alpha3Interface GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface - GatewayV1() gatewayv1.GatewayV1Interface } // Clientset contains the clients for groups. type Clientset struct { *discovery.DiscoveryClient + gatewayV1 *gatewayv1.GatewayV1Client gatewayV1alpha2 *gatewayv1alpha2.GatewayV1alpha2Client gatewayV1alpha3 *gatewayv1alpha3.GatewayV1alpha3Client gatewayV1beta1 *gatewayv1beta1.GatewayV1beta1Client - gatewayV1 *gatewayv1.GatewayV1Client +} + +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return c.gatewayV1 } // GatewayV1alpha2 retrieves the GatewayV1alpha2Client @@ -63,11 +68,6 @@ func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return c.gatewayV1beta1 } -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return c.gatewayV1 -} - // Discovery retrieves the DiscoveryClient func (c *Clientset) Discovery() discovery.DiscoveryInterface { if c == nil { @@ -112,19 +112,19 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error - cs.gatewayV1alpha2, err = gatewayv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1alpha3, err = gatewayv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1alpha2, err = gatewayv1alpha2.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1beta1, err = gatewayv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1alpha3, err = gatewayv1alpha3.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } - cs.gatewayV1, err = gatewayv1.NewForConfigAndClient(&configShallowCopy, httpClient) + cs.gatewayV1beta1, err = gatewayv1beta1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err } @@ -149,10 +149,10 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.gatewayV1 = gatewayv1.New(c) cs.gatewayV1alpha2 = gatewayv1alpha2.New(c) cs.gatewayV1alpha3 = gatewayv1alpha3.New(c) cs.gatewayV1beta1 = gatewayv1beta1.New(c) - cs.gatewayV1 = gatewayv1.New(c) cs.DiscoveryClient = discovery.NewDiscoveryClient(c) return &cs diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 7d165c93ba..7cc8169913 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -122,6 +122,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// GatewayV1 retrieves the GatewayV1Client +func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { + return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} +} + // GatewayV1alpha2 retrieves the GatewayV1alpha2Client func (c *Clientset) GatewayV1alpha2() gatewayv1alpha2.GatewayV1alpha2Interface { return &fakegatewayv1alpha2.FakeGatewayV1alpha2{Fake: &c.Fake} @@ -136,8 +141,3 @@ func (c *Clientset) GatewayV1alpha3() gatewayv1alpha3.GatewayV1alpha3Interface { func (c *Clientset) GatewayV1beta1() gatewayv1beta1.GatewayV1beta1Interface { return &fakegatewayv1beta1.FakeGatewayV1beta1{Fake: &c.Fake} } - -// GatewayV1 retrieves the GatewayV1Client -func (c *Clientset) GatewayV1() gatewayv1.GatewayV1Interface { - return &fakegatewayv1.FakeGatewayV1{Fake: &c.Fake} -} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 502a6efc6e..70e71314d6 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -34,10 +34,10 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1.AddToScheme, gatewayv1alpha2.AddToScheme, gatewayv1alpha3.AddToScheme, gatewayv1beta1.AddToScheme, - gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index c6eca7a83a..715fcc4caa 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -34,10 +34,10 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + gatewayv1.AddToScheme, gatewayv1alpha2.AddToScheme, gatewayv1alpha3.AddToScheme, gatewayv1beta1.AddToScheme, - gatewayv1.AddToScheme, } // AddToScheme adds all types of this clientset into the given scheme. This allows composition